Learn how to initiate payments from your WeChat Official page.
A WeChat Official page is similar to a Facebook page or Verified Twitter profile. In addition to keeping your WeChat followers up-to-date, you can also serve your mobile website within the WeChat app. From here, you can initiate WeChat Pay payments.
When initiating a payment from the WeChat app, the shopper is prompted to verify the payment. If successful, they are redirected back to your mobile website and presented with the payment result.
Official account payments must be initiated from the WeChat in-app browser. They cannot be initiated from another browser, such as Chrome or Safari.
The WeChat Pay Official account payment flow is supported by our:
To initiate Official account payments you'll need to register for a WeChat Official (服务号) account:
- Go to https://pay.weixin.qq.com/index.php/public/wechatpay and click Apply Now.
- Download, fill in, and submit the vendor information form.
WeChat will contact you to verify your information and provide an agreement you need to sign. Once this is approved, you will be able to accept WeChat Pay payments initiated using the WeChat browser.
Integrate with Checkout Web SDK
Our Checkout SDK for Web can initiate payments from within the WeChat app without any additional integration.
Integrate with API
In this section, we show the integration steps required to initiate payments from the WeChat app using our API integration.
Before you begin this section, make sure you read and understand our API Integration guide.
Step 1: Make a payment
When a shopper initiates the WeChat Pay payment:
- Make a
/paymentsAPI call, providing:
reference: Your unique reference for this payment.
paymentMethod.type: Set to wechatpayWeb
returnUrl: The URL of your payments page. The shopper is redirected to this page when they've verified the payment.
This returns a
/paymentsresponse containing a:
redirectobject containing a
Step 2: Redirect shopper
To complete the payment, the shopper will need to verify it in the WeChat app.
Redirect the shopper to the URL specified at
This prompts the shopper to enter their WeChat Pay PIN to verify the payment. Once completed, they are redirected back to your mobile website using the
returnUrlyou specified earlier. This will be appended with a
Do not use the
resultCodeyou receive from the
returnUrlto determine whether the payment was successful. Instead, verify the result on your server.
Step 3: Present payment result
/payments/detailsendpoint to verify the result of the payment:
The response will contain a
pspReference, which is our unique identifier for this payment, and a
resultCodeyou received from the
/payments/detailsendpoint to present the payment result to the shopper in your mobile website.
You can track the status of the payment using notifications.
WeChat Pay result codes
resultCode you will receive for WeChat Pay is:
- Received: The payment was successfully received. You will receive a notification when the status of the payment has been updated. If successful, you will receive the funds in 2 days.
To find out more about result codes and how you can action them, see Result codes.
WeChat Pay notifications
If you're accepting WeChat Pay payments you will need to set up notifications to know whether a payment is successful. Each WeChat Pay notification has a:
pspReference: identifies which payment is being referred to.
eventCode: indicates the status of the payment.
If you haven't already set up notifications, refer to our notifications documentation for instructions.
You'll know a WeChat Pay payment has been successful when you receive a notification for the transaction that has:
Testing Official account payments
Before accepting payments from your shoppers, we recommend testing your setup. There is currently no test platform for WeChat Pay. If you have a personal WeChat account you can test your integration by making live WeChat Pay payments with a low value, or you can cancel the transaction when you are asked to verify the payment.
You can check the status of a WeChat Pay payment in your Customer Area > Transactions > Payments.