Mini Program - Alipay CN
Accept Alipay from your mini program on your shopper’s Android or iOS phone.
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 the Alipay payment page to complete the payment
When a shopper selects to pay with Alipay in the mini program, call the Confirm a Payment Intent API API for a redirect URL.
POST /api/v1/pa/payment_intents/{id}/confirm
You will get a response similar to the following.
Pass data
in next_action
to Alipay Mini Program Payment API to redirect the shopper to the payment page.
Step 3. Obtain the payment result status
Alipay will return the payment result to your mini-program once the order is completed. We suggest you poll the status of the Payment Intent via the Retrieve a Payment Intent API API upon receiving the response from Alipay 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.