WeChat Pay for Payment Setup API
Last updated: April 30, 2026
To accept WeChat Pay payments, you must:
- Create a payment setup.
- Confirm the payment.
- Redirect the customer to WeChat Pay.
Call the Create a payment setup endpoint.
Information
Your base URL's {prefix} value is unique to your account and environment. To learn how to retrieve your base URLs for the sandbox and production environments, see API endpoints.
post
https://{prefix}.api.checkout.com/payments/setups
1{2"amount": 1000,3"currency": "CNY",4"settings": {5"success_url": "https://example.com/payments/success",6"failure_url": "https://example.com/payments/failure"7}8}
In the request body, provide the following:
| Field | Description |
|---|---|
number | The payment amount, in the minor currency unit. |
string | Three-letter ISO 4217 currency code. |
string | The URL to redirect the customer to if the payment fails. |
string | The URL to redirect the customer to if the payment is successful. |
object | The customer's billing details. |
object | The customer's billing address. |
string | The country of the billing address. |
string | A description of the payment. |
string | A reference you can use to identify the payment. |
1{2"id": "set_rcmepwrchqab2wsergcafvijfy",3"processing_channel_id": "pc_wzjki6hw5puepb5fnvqlizj2e4",4"amount": 1000,5"currency": "CNY",6"payment_type": "Regular",7"reference": "ORD-5023-4E89",8"description": "WeChat Pay payment",9"payment_methods": {10"wechatpay": {11"status": "ready",12"flags": []13}14},15"available_payment_methods": [16"wechatpay"17],18"settings": {19"success_url": "https://example.com/payments/success",20"failure_url": "https://example.com/payments/failure"21}22}
The response includes a payment_methods object with the payment methods on your account.
If all required fields are set, the payment_methods.wechatpay object has a ready status.
Confirm the payment by calling the Confirm a payment setup endpoint and provide:
- The payment setup
idas the{id}path parameter. wechatpayas the payment method name.
post
https://{prefix}.api.checkout.com/payments/setups/{id}/confirm/wechatpay
1{2"id": "pay_gdbok753fk3ebk4dpq7xqq72te",3"status": "Pending",4"reference": "ORD-5023-4E89",5"customer": {6"id": "cus_ujs5uvwcshhujllodxegkknwou"7},8"_links": {9"self": {10"href": "https://{prefix}.api.sandbox.checkout.com/payments/pay_gdbok753fk3ebk4dpq7xqq72te"11},12"redirect": {13"href": "weixin://wxpay/bizpayurl?pr=MQ4aYOXzz"14}15}16}
Use the _links.redirect.href URL from the response to generate a QR code. Display the QR code to the customer. They scan it with the WeChat Pay app to complete the payment. After payment, they are redirected to your settings.success_url or settings.failure_url.