Search...
Log inGet started
Airwallex logo
Home
Core API
Payments
Transactional FX
Payouts
Issuing
Back to home
OverviewChoose your payments solutionGet started with payments
Supported currencies
Online payments
Invoice integrations
Payment methods
Payment Methods OverviewGlobal
EU & UK
APAC
7-Eleven
Alipay CN
Alipay HK
Atome
Boost
DANA
DOKU Wallet
Dragonpay
DuitNow
E.SUN (Taiwan ATM & Internet banking)
FPS
FPX
GCash
GoPay
GrabPay - Malaysia
GrabPay - Singapore
Indonesian Bank Transfer
Indonesian Convenience Stores - BETA
Jenius Pay
Kakao Pay
Kiosk Payments
Konbini
Korean Local Cards - BETA
LinkAja
Naver Pay - BETA
OVO
Pay-easy
Payco - BETA
PayNow
Philippines Online Banking
PromptPay
Rabbit LINE Pay
Samsung Pay - BETA
ShopeePay
Taiwan Convenience Stores
Tesco Lotus
Thailand Online Banking
Toss Pay - BETA
Touch 'n Go
TrueMoney
WeChat Pay
Pay with QR Code (Desktop Website Browser) - WeChat PayMobile App - WeChat Pay WeChat Official Account - WeChat PayWeChat Mini Program - WeChat Pay
Mobile Browser (H5) - WeChat PayCustoms Declaration - WeChat PayFunds Split - WeChat Pay
Zip - BETA
NORTH AMERICA & LATAM

WeChat Mini Program - WeChat Pay

To enable WeChat Mini Program payment, additional offline review process is required, please contact your account manager for detailed information.

Accept WeChat Pay from your WeChat mini program. To complete the integration, you will need to interact with WeChat Mini Program API in your mini program.

Wechat - mini program

Step 1. Initialize a Payment Intent

Create a Payment Intent with the Create a Payment Intent API API.

POST /api/v1/pa/payment_intents/create

JSON

Step 2. Redirect to WeChat Pay to complete payment

2.1. Obtain the data to be used for calling the WeChat Pay mini program API

You need to get the open_id of the shopper before proceeding with the mini_program flow. open_id refers to the unique identifier of a WeChat user in a specific mini program. It is required when confirming with mini_program flow. To get the open_id, follow the instructions below:

  1. Invoke wx.login , then get a code from the response.

  2. Invoke jscode2session from server-side with the code obtained from the last step to get the open ID of the shopper.

Then, call the Confirm a Payment Intent API API with the open_id to get the data required when calling the WeChat Pay mini program API.

POST /api/v1/pa/payment_intents/{id}/confirm

JSON

You will get a response similar to the following.

JSON

2.2. Pass the data to WeChat Mini Program Payment API

Pass data in next_action you get in the previous step to WeChat Mini Program Payment API wx.requestPayment . The shopper will be redirected to the payment page to complete the payment.

Step 3. Obtain the payment result status

Once the order is successfully paid or failed, WeChat Pay will invoke the callback functions success and fail provided when calling wx.requestPayment respectively. We suggest you poll the status of the Payment Intent via the Retrieve a Payment Intent API API upon the invocation of the success callback function to get a reliable final status of the order.

GET /api/v1/pa/payment_intents/{id}

In addition, Airwallex will notify you of the payment result asynchronously via the webhooks. Please refer to the webhook documentation to set up your webhook accordingly. Although subscribing to webhook events is optional, it is recommended to subscribe to the payment_intent.succeeded webhook which indicates that the shopper has paid the order.