Airwallex logo
Airwallex logo

Desktop/Mobile Website Browser

Step 1. Initialize a Payment Intent

Create a PaymentIntent object with a request_id, amount, currency and a merchant_order_id from your backend server.

Shell
1curl -X POST \
2 https://api.airwallex.com/api/v1/pa/payment_intents/create \
3 -H 'Content-Type: application/json' \
4 -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJhNDc...' \
5 -d '{
6 "request_id": "ed11e38a-7234-11ea-aa94-7fd44ffd1b89",
7 "amount": 100,
8 "currency": "CNY",
9 "merchant_order_id": "85d7b0e0-7235-11ea-862e-9f6aa1adfca6"
10 }'

Step 2: Generate QR and accept payments

When a shopper selects to pay with FPS on their desktop browser, call the following API endpoints to get a QR code in the response, which you can then render on your website.

a. Generate a QR code/Refresh a QR code upon expiry

Request:

Shell
1curl -X POST \
2 https://api.airwallex.com/api/v1/pa/payment_intents/{id}/confirm \
3 -H 'Content-Type: application/json' \
4 -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJhNDc...' \
5 -d '{
6 "request_id": "ed11e38a-7234-11ea-aa94-7fd44ffd1b89",
7 "payment_method":
8 {
9 "type": "fps",
10 "fps": {
11 "flow": "webqr"
12 }
13 }
14 }'

Response: Render the value of qrcode as a QR code on your website for the shopper to scan with his/her Mobile banking app.

Shell
1{
2 "next_action": {
3 "type": "render_qrcode",
4 "qrcode": "00020101021226390012hk.com.hkicl020345605122211280314255204000053031565406100.005802HK5902NA6002HK62230119sgstws2kjgftpsmd2k3630432EA"
5 }
6}

b. Wait for notification from Airwallex

Airwallex will notify you the payment result asynchronously via webhook API. Please refer to webhook documentation to set up your webhook accordingly. While it is optional to subscribe to different events, we recommend that you at least subscribe to payment_intent.succeeded, which notifies you that the shopper completed his/her order and successfully paid through FPS.

c. Query the Payment Intent status (optional)

A QR code expires in 10 minutes once generated. You may query the status of a payment anytime via the PaymentIntents API

Shell
1GET /payment_intents/{id}
Was this page helpful?