Home  >  Article  >  Backend Development  >  WeChat Development - How to write WeChat Payment? What should be written on the PHP side?

WeChat Development - How to write WeChat Payment? What should be written on the PHP side?

WBOY
WBOYOriginal
2016-09-08 08:44:00855browse

**Our project is an app. Now we need to write a native WeChat payment interface.
How to write the PHP backend?
Which one of the official documents provided by WeChat should be read (didn’t understand)?
Is that a document used in the backend?
(I am a newbie and have never written a payment interface. If there is a development tutorial or something, please provide a link. Thank you!!!)**

WeChat Development - How to write WeChat Payment? What should be written on the PHP side?
This is the development, how to write the php backend?

WeChat Development - How to write WeChat Payment? What should be written on the PHP side?
Why does this have an SDK for PHP?

WeChat Development - How to write WeChat Payment? What should be written on the PHP side?
And the app payment I make does not have a PHP SDK?

Reply content:

**Our project is an app. Now we need to write a native WeChat payment interface.
How to write the PHP backend?
Which one of the official documents provided by WeChat should be read (didn’t understand)?
Is that a document used in the backend?
(I am a newbie and have never written a payment interface. If there is a development tutorial or something, please provide a link. Thank you!!!)**

WeChat Development - How to write WeChat Payment? What should be written on the PHP side?
This is the development, how to write the php backend?

WeChat Development - How to write WeChat Payment? What should be written on the PHP side?
Why does this have an SDK for PHP?

WeChat Development - How to write WeChat Payment? What should be written on the PHP side?
And the app payment I make does not have a PHP SDK?

Thank you for the invitation.

  • php can directly refer to the corresponding interface document to write the corresponding logic, such as the menu query interface

<code>// 你封装一个curl的方法,直接获取这个链接即可
https://api.weixin.qq.com/cgi-bin/menu/get?access_token=ACCESS_TOKEN</code>
  • The WeChat interface document does not mention any money backend. They all have the same interface and the same documentation. Maybe I didn’t understand what you saidBackstage

  • You can set up a WeChat payment management menu in your backend management, write the functional logic of the corresponding interface call into it, and treat it as a plain CURD

  • Several special interfaces such as WeChat payment can use the SDK

Although many people complain about the pitfalls of the official document, if you read the document carefully, it is not difficult to develop. It is important to understand its business logic. There is no difficulty in the technical level, just communicate with the interface provided by WeChat and handle the callbacks. Yes, you must be careful when developing and don’t take too much for granted. If you find it technically difficult, it is not recommended to encapsulate the interface yourself, just use the official demo.

This is the app https://pay.weixin.qq.com/wik...
This is PHP
https://pay.weixin.qq.com/wik...

The principle is the same. After loading, payment is triggered.
If it is in the WeChat browser, the payment process is like this. I have just come into contact with it recently.
1: Authorization, grab openid
2. Order information + openid to get the payment page
3. Payment, the program ends.

4. Asynchronously, Tencent server executes callback. The main purpose of the callback is for Tencent to tell us whether the order has been paid successfully, and we can handle the status of our order and some business logic accordingly.

If it is an app payment, I have not touched it, but I guess it is like this.
1: The app generates order number, amount and other information through the PHP interface
2. The app loads the corresponding parameters and jumps out of the payment page
3. The PHP page performs payment callback processing.

The app is actually responsible for jumping out of the payment page, and then making a jump to completion of payment through the information returned by Tencent's server. All other work is done by PHP.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn