Log in to WeChat Pay, where you can configure the payment result callback interface. After the WeChat payment is successful, your program interface will be called to pass the payment result information to you. At this time, you can do whatever you want with the information after you get it
You can study the payment principles of WeChat payment or Alipay, which mainly include return_url.php and notify_url.php What you need to use here is notify_url.php. If you judge the transaction is successful here, you can change the order information status and write it to the database. This notification The page can only be started when called by WeChat, and it is between servers. We cannot see it. You can touch and write logs for debugging.
Method 1. First, the code is written in the program location corresponding to the configured notification address. (notify_url) Then the data returned from the WeChat notification is xml data, which needs to be parsed into the format you need! Pay attention to the cdata data Method 2 (commonly used) . The data in the notification class in SDK has been parsed for you. Write a class to continue with the notification class WxPayNotifyWxPayNotify 重写NotifyProcessRewrite the NotifyProcess function (the location of your code), example Just call it and handle
The callback url for successful payment in the demo is the notification address, notify_url() method
Log in to WeChat Pay, where you can configure the payment result callback interface. After the WeChat payment is successful, your program interface will be called to pass the payment result information to you. At this time, you can do whatever you want with the information after you get it
You can study the payment principles of WeChat payment or Alipay, which mainly include return_url.php and notify_url.php
What you need to use here is notify_url.php. If you judge the transaction is successful here, you can change the order information status and write it to the database. This notification The page can only be started when called by WeChat, and it is between servers. We cannot see it. You can touch and write logs for debugging.
Method 1.
First, the code is written in the program location corresponding to the configured notification address. (notify_url)
Then the data returned from the WeChat notification is xml data, which needs to be parsed into the format you need! Pay attention to the cdata data
Method 2 (commonly used) .
The data in the notification class in SDK has been parsed for you. Write a class to continue with the notification class
WxPayNotify
WxPayNotify
重写
NotifyProcess
Rewrite theNotifyProcess
function (the location of your code), example Just call it and handlePS: The WeChat payment SDK code is so messy...