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.

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
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: 
Invoke wx.login , then get a
codefrom the response.Invoke jscode2session from server-side with the
codeobtained 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
You will get a response similar to the following.
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.