Before starting tests, the payment directory should be set. If the page which calls JSAPI is http(s)://172.168.0.0/test/xxx, the payment directory is http(s)://172.169.0.0/test/. You can set the payment directory through “Dev Configuration-> Development Config”, as shown in Figure 8.7.
Figure 8.7 Official Account Payment Authorization Directory Settings
Figure 8.8 Official Account Payment Sequence Chart
How the Merchant's system interacts with the WeChat payment system:
1. The Merchant's server calls the Unified Order API to create an order. For more information, see 【Unified Order】
2. The Merchant's server receives payment notifications. For more information, see 【Payment Result Notification】
3. The Merchant's server queries payment result. For more information, see 【Query Order】
WeChat supports the payment feature in versions 5.0 and greater, so payers using versions prior to version 5.0 can't access WeChat payment. As a consequence, we suggest the Merchant confirm the Payer's version via the user agent string before using WeChat payment features. Using an iPhone WeChat client as an example, the Merchant can check the Payer's WeChat version via user agent below:
"Mozilla/5.0(iphone;CPU iphone OS 5_1_1 like Mac OS X) AppleWebKit/534.46(KHTML,like Geocko) Mobile/9B206 MicroMessenger/5.0"
where 5.0 indicates the Payer's WeChat version. Merchants can parse the above HTTP header to check whether the WeChat version is greater than or equal to 5.0.
For transaction security reasons, the Payer can see WeChat Security Payment subtitle in the page header of their payment page in WeChat. We suggest merchants use this subtitle for their WeChat payment transaction.
Figure 8.8 Official Account Payment Sequence Chart
To display the subtitle, the Merchants should add "showwxpaytitle=1" to the end of the original URL. After doing so, their page will show the "WeChat Security Payment" subtitle. For example, for the original URL (https://www.wechat.com/en/), the Merchant can change it to the one with the subtitle (https://www.wechat.com/en/).
As a result, when the Payer opens http://weixin.qq.com in WeChat, they won’t see the subtitle. However, if they go with https://www.wechat.com/en/, the subtitle will be displayed in the header of their opened page.
Customer Service Tel
Business Development
9:00-18:00
Monday-Friday GMT+8
Technical Support
WeChat Pay Global
ICP证