Airwallex logo
Airwallex logoAirwallex logo

Accept an FPS payment

Copy for LLMView as Markdown

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 https://api-demo.airwallex.com/api/v1/pa/payment_intents/create \
2 -H 'Content-Type: application/json' \
3 -H 'Authorization: Bearer {{ACCESS_TOKEN}}' \
4 -d '{
5 "request_id": "ed11e38a-7234-11ea-aa94-7fd44ffd1b89",
6 "amount": 100,
7 "currency": "CNY",
8 "merchant_order_id": "85d7b0e0-7235-11ea-862e-9f6aa1adfca6"
9 }'

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 https://api-demo.airwallex.com/api/v1/pa/payment_intents/{{PAYMENT_INTENT_ID}}/confirm \
2 -H 'Content-Type: application/json' \
3 -H 'Authorization: Bearer {{ACCESS_TOKEN}}' \
4 -d '{
5 "request_id": "ed11e38a-7234-11ea-aa94-7fd44ffd1b89",
6 "payment_method": {
7 "type": "fps",
8 "fps": {
9 "flow": "webqr"
10 }
11 }
12 }'

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

JSON
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

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

Was this page helpful?