This article mainly describes the pitfalls encountered during the development of small program access payment, which are divided into two major blocks: Encapsulation of small program end and background interface. The main content of this article is as follows: 1. backend interface encapsulation; 2. integration of small programs; 3. Summary of step-by-step attacks. This article mainly describes the pitfalls encountered during the development of small program access payment, which are divided into two major blocks: Encapsulation of small program end and background interface. The main content of this article is as follows:
1. backend interface encapsulation;
2. integration of small program terminals;
3. Summary.
I. backend interface encapsulation
Perform interface encapsulation based on ThinkPHP 5 as follows:
1. the official payment documents provide PHP script payment samples and download them;
2. the sample has encapsulated each class. we only need to add a namespace to create a directory wxpay under the extend directory of TP5 and copy the class in the sample to the directory, add the namespace;
III. Summary
1. the payment API of jssdk, the public account used by the mini-program Payment API, has an error in the parameter in the official documentation, that is, the "I" in the uploaded appid must be in uppercase, otherwise, a Parameter error is always prompted. I have been debugging on this for a long time and want to see some of my friends.
2. after the unified order interface is called, the results returned by the unified order cannot be directly returned to the applet, and the signature must be re-generated.
3. if you have any questions, please leave a message.
The above is the details of small program payment access development. For more information, see other related articles in the first PHP community!