Accept PayMe payments
You can accept PayMe in three simple steps:
- Initialize a Payment Intent
- Specify the Payment Flow with qrcode (desktop) or mobile_web (mobile)
- Query the Payment Status
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
1{2 "request_id": "ed11e38a-7234-11ea-aa94-7fd44ffd1b89",3 "amount": 1000,4 "currency": "HKD",5 "merchant_order_id": "85d7b0e0-7235-11ea-862e-9f6aa1adfca6",6 "return_url": "https://www.airwallex.com"7}
Step 2. Generate and render the QR code to the shopper
PayMe supports two separate flows for desktop and mobile. When a shopper selects PayMe, call the Confirm a Payment Intent API API and specify the appropriate flow:
-
On desktop: qrcode flow, we will return:
- A string representation of the QR code
- A fallback URL pointing to the PayMe page
-
On mobile: mobile_web flow:
- A redirect link to the shopper's PayMe app will be returned
Desktop flow - sample request
1{2 "request_id": "ed11e38a-7234-11ea-aa94-7fd44ffd1b89",3 "payment_method": {4 "type": "payme",5 "payme": {6 "flow": "qrcode"7 }8 }9}
Desktop flow - sample response
1{2 // ... other fields omitted.3 "next_action": {4 "type": "render_qrcode",5 "qrcode": "https://prod.paymebiz.hsbc.com.hk/93b4dcfa-0351-42b6-9bbe-946fb0ae555b?appSuccessCallback=https://www.airwallex.com/",6 "url": "https://prod.paymebiz.hsbc.com.hk/93b4dcfa-0351-42b6-9bbe-946fb0ae555b?appSuccessCallback=https://www.airwallex.com/"7 }8}
We recommended converting the next_action.qrcode value into a QR code for direct display to the shopper.
To ensure brand consistency and a seamless customer journey, please follow PayMe's established design and branding guidelines here when presenting the QR code.
Once generated, the QR code and the URL will expire after 10 minutes. Reconfirming the same Payment Intent with PayMe or switching to another payment method will invalidate the previously generated QR code and URL.
Mobile flow - sample request
1{2 "request_id": "ed11e38a-7234-11ea-aa94-7fd44ffd1b89",3 "payment_method": {4 "type": "payme",5 "payme": {6 "flow": "mobile_web"7 }8 }9}
Mobile flow - sample response
1{2 // ... other fields omitted.3 "next_action": {4 "type": "redirect",5 "method": "GET",6 "url": "https://prod.paymebiz.hsbc.com.hk/93b4dcfa-0351-42b6-9bbe-946fb0ae555b?appSuccessCallback=https://www.airwallex.com/"7 }8}
Step 3. Query the payment result status
To get the payment result, we suggest you poll the status of the Payment Intent via the Retrieve a Payment Intent API API.
GET /api/v1/pa/payment_intents/{id}
If you directly render and present the QR code to the shopper, you should start polling the status immediately.
If you redirected the shopper to the PayMe page, you may start polling the Payment Intent status after the shopper is redirected back to your website (i.e., the return_url passed when creating the Payment Intent).
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 for the order.