Article From:

This article is the first in a series of articles on Wechat Payment. It will mainly introduce why we wrote this series and a little experience about Wechat Payment, so we can share with you.

The following will be divided into several steps to tell me the process of learning to pay by Wechat. It is also a bitter history. I also hope that my friends will not fall into the pit again and save time.

1. Company Needs

As the headline is general, the company has come to such a demand, need access to Wechat payment, it must be done to him, I believe that most of the small partners are in such contact with Wechat payment bar.

First of all, we need to clarify a demand. If the company is doing App payment, besides accessing WeChat payment, it also needs to access the three party payment, such as Alipay and UnionPay, then we need to consider several issues. Is the company choosing to develop independently or by means of third party aggregated payment (such as Ping++), from the cost side, etc.In fact, access aggregation payment is also a good choice.

If we choose to develop Wechat Payment on our own, then problems will follow.

What is Wechat Payment?What can Wechat Payment do?How do we achieve it?Are there demos written by gods on the Internet that can be brought directly?Does Wechat Official Official Provide Clear Documentation?

Above all, we will solve these problems one by one and look forward to it!!!

2. Overturning Site

After we have made it clear that we should pay by Wechat, we should go to the official documents of Wechat as soon as possible. The address is as follows:

Now the small program is very popular, let’s take the small program as an example, enter the development document page of the small program payment:
Unfortunately, Wechat’s documents are known to be for their own programmers to see, if it is a small white instant intrusion, it is a face of confusion, how should I start? Black question mark? Uh huh?

Don’t panic! In fact, the Wechat payment routine is also very simple. They complicate the simple problems for fear that the developers will not understand them. The document is written in great detail (laughing around) so that we don’t know how to start. From here until all the links of payment are the same. The real key parts of the document are vague and the details are true.Very meticulous.

Now let’s talk about how I learned to pay by Wechat.

3. Forcing Liangshan

Absolutely forced to Liangshan, in a nutshell, a Wechat payment development process is as follows:

The main interaction between merchant system and Wechat payment system is as follows:1. Call the login interface in the applet to get the user's openid. See the public API [applet login API]2. Merchant server calls and pays unified order, API refers to public API [unified order AP]I]3. Business server calls re-signature, API refers to public API [re-signature]4. The merchant server receives payment notification. The API refers to the public API [Payment Result Notification API]5. Business server queries payment results, API see PublicAPI [query order API]

The difficulty in the above steps lies in the second and third steps. There will be some pits in the middle. Why? For instance,

Some of the parameters in the Wechat Payment Interface Document are humps and some are underlined, but there is no strong official prompt to say that.Because some parameters of the version relationship will be different.The parameters needed for re-signing and how to sign are very simple and need to be tried and error again and again.The biggest problem isThe support for Java development is not very good. The official SDK demo can't be used directly. It's really a demo.

Friends who haven’t experienced it may not be able to appreciate this feeling, it’s really hard; because the above problems can not be solved, they have to manually Baidu + Google, but the problem has come, the homogeneity of online articles is very serious, often point in five articles, three of which are the same, tears… Some people pay for teaching.Cheng, this is also a good way to make money.

Such experience is why this series of articles, of course, eventually I also screened out the essence of the articles of the network gods, to achieve most of the main functions of Wechat Payment, enough to meet the needs of conventional enterprise development.

4, original intention”

In fact, this series of articles has long had the idea of writing, because in the process of solving problems, I encountered many peer complaints very painful, but it is really lazy + not polished to the point of ready-to-use, and now I feel almost the same, so share with you.

The main features of this series I have arranged will be posted below, as follows:

1.Brief Analysis of Wechat Payment: Previous Outline2. Brief Introduction of Wechat Payment3. preparation before development4. unified order interface5. notification of payment results6. enquiry order7. closing orders8. apply for a refund.9. notice of refund results10. inquiries for refund11. download the bill.TwelveDownload funds bill13. How to use sandbox for environmental testing14. Payment Acceptance Guidelines15. Use case of credit card payment acceptance16. Scan Payment Acceptance Use Cases17. Public Number Payment Acceptance Use Cases18. Guidelines for Functional Use of Non-rechargeable Products19. (Balance Cash) Business Payment to ZeroMoney funds use merchant account balance funds20. Business platform - cash red envelope - ordinary red envelope21. Business platform - cash red envelope - inquiry red envelope record22. Business platform - vouchers or discounts - vouchers23. Businessmen Platform - Vouchers or Offers - Inquire Vouchers Lettersinterest24. Businessmen Platform - Vouchers or Offers - Search Vouchers Batch25. Public Platform - Wechat Card Vouchers - Create Card Vouchers26. Public Platform - Wechat Card Vouchers - HTML5 Online Vouchers (JS-SDK Interface)27. Public Platform - Wechat Card Vouchers - Check the details of the Card Vouchers28. Public Platform - Social Money Reduction Activities - Overview29. Public Platform - Social Fund Reduction Activities - Opening Product Rights30. Public Platform - Social Fund Reduction Activities - Acceptance of Non-recharge Mode31. Public Platform - Social Money Reduction Activities - Create Vouchers and Set up Skip ProgramsThirty-twoPublic Platform - Social Deduction Activities - Create a Deduction Activity Interface after PaymentChapter 4:1. Authorization of Wechat Public Number Web Page2. Wechat Public Number Template Message Sending3. Generation of Permanent and Unconstrained Wechat Program Two-Dimensional Code4. Payment Processing of Multiple Wechat Public Numbers on the Same Business Platform5. The Processing of JDK Replacing Safety Pack when Wechat Refunds6. The classes of encryption and decryption tools for Wechat payment MD5, HMACSHA256, SHA1 and AES

The description of the above function points will be more or less, and some problems or exception handling, database and business processing logic will be interpolated.

I also created a group of Wechat to provide you with communication and progress together.


I hope this series of articles can give you some inspiration, help solve some problems, and encourage you!!!

If you want to see the source code in advance, you can first look at my github, the address is as follows:

In addition to the author’s personal tweet, the author’s micro-signal is as followsyclimb,ReplyWeChat payment Can pull into the Wechat Payment Discussion Group and discuss with small partners, oh, must be marked.WeChat payment Oh ~

This is the end of this article, pay attention to the public number to see more push!!!

Pay attention to my public number.</p><hr></div><div class= Post Views: 10

Leave a Reply

Your email address will not be published. Required fields are marked *