In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces PHP Weixin Pay development after scanning payment callback example analysis, has a certain reference value, interested friends can refer to, I hope you read this article after a great harvest, the following let Xiaobian take you to understand.
I. Download Weixin Pay SDK
After downloading the SDK package and extracting it, under the extracted directory, we will see the following directory
II. After consulting the developer document of Weixin Pay, we know that the demo of WeChat code scanning payment is the native.php file under the example directory.
For convenience, what we're going to do is put the whole extracted file into the wxpay (name it like) folder at the root of our local environment
Third, take the author as an example, enter http://localhost/wxpay/example/native.php in the browser
After opening the above website, I found that there are two QR codes, such as the title, what we are studying today is mode 2 scanning code (official also recommends mode 2 scanning code payment)
IV. We log in WeChat with our mobile phone, scan the QR code of mode 2 in the above page, and pay
Here we find an interesting problem, when you pay successfully, there is no change in the PC page, so the main problem we consider is how to make a callback after payment.
Not much nonsense here, the author refers to many methods on the Internet, summarized as follows:
1. Delete some html of scan mode 1 in the native.php file, leaving only some related html code of scan mode 2.
2. Since the official document also states that the payment result of scanning mode 2 is asynchronous response and will not actively return the payment result, we use javascript to monitor the payment result from time to time, and then according to the result of the request, we will do the next page callback. The author's final code is as follows, interested friends can refer to the following:
native.php file
Sample of Weixin Pay Scan Payment Mode II
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.