WeChat Mini Program Payment Scenarios
WeChat Mini Program Payment.
At present, we can only use the method of mini program payment API to invoke WeChat payment.
Scenario Introduction
Step 1: The buyer chooses the products in merchant’s mini program, and puts them in the shopping cart. The buyer clicks the checkout button. As in picture 1.
Step 2: Mini program will invoke WeChat payment module. The user will enter the payment password.
Step 3: Once password is verified, payment is done. Merchant’s server will receive the notification from SnapPay.

chooses the products

invoke WeChat payment module
Payment Workflow

Detailed flows
-
After user places order [1.1], merchant backend calls Mini Program Payment API to submit the payment request to SnapPay OpenAPI Service Gateway [1.2] ;
-
SnapPay verifies the payment request and returns WeChat Mini Program payment parameters (request_payment) [1.3];
-
On the user’s mobile, the merchant’s mini program invokes WeChat Pay and passes in payment parameters [1.4]. User complete the payment [1.5];
-
After user pays successfully, WeChat will return payment result to the merchant’s mini program [2.1];
-
To ensure the payment is truly successful, merchant should call Query Order API [2.2];
-
When SUCCESS status is returned [2.3], merchant update the order status [2.4], and show the success page to the user [2.5];
-
After the payment is successful, WeChat will send an asynchronous notification to SnapPay [3.1]. SnapPay backend will notify the merchant that the payment is successful. Please refer to Asynchronous Notification [3.2].
WeChat Mini Program Application procedure
In order for the merchant to enable the WeChat Pay function in their mini program, the following procedures need to happen before development.
-
Merchant needs to apply an account in WeChat Official Accounts Platform website: https://mp.weixin.qq.com
-
Once it passes the WeChat approval, register the Mini Program service. Merchant will then receive the APPID.
For more details, please refer to: https://developers.weixin.qq.com/miniprogram/introduction -
Once the merchant receives the APPID, send APPID and Company Name (recommend same as Company Name when merchant registered on SnapPay) to SnapPay Customer Service customerservice@snappay.ca. SnapPay will contact WeChat to combine the APP ID with merchant account.
-
Once SnapPay notifies you the setup is complete, Merchant can start development.
Where to get Company Name for Mini Program on in WeChat Open Platform website.

Example
For example, SnapPay will send the following info to WeChat Support
SnapPay Institution Information:
Merchant ID:1234567890
Institution Name:Snappay
Official Account:wx1234567890abcdef
Merchant Mini Program Information:
Mini Program APPID: wx0987654321abcdef
Sub Merchant ID: 123456789
Company Name: Super Merchant Inc.