AlipayCN & AlipayHK
1. Required Tools or Apps
Method A - Register Your Own Test Account
Method B - Use a Shared Test Account
- Install the Alipay test wallet app AWallet at here.
- Contact technical support to obtain test account credentials.
2. General Guidelines
- For payment code scenarios, set
is_presenttotrue.
3. Initiating a Payment Request
3.1 QR Code
Sample Request Payload
{
"amount": "7.77",
"currency": "SGD",
"payment_method": {
"type": "alipaycn",
"alipaycn": {
"flow": "qrcode",
"is_present": false
}
},
"merchant_order_id": "{{$guid}}",
"description": "acquiring sandbox testing",
"metadata": {
"request_id": "{{$guid}}"
},
"return_url": "https://127.0.0.1:8080/api/v1/callback"
}Sample Response Payload
{
"amount": 7.77,
"available_payment_method_types": null,
"cancel_time": "",
"cancellation_reason": "",
"captured_amount": "7.77",
"client_secret": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtYXN0ZXJfaWQiOiIwIiwiYWNjb3VudF9pZCI6ImE3YjkyYTE5LWJmYzMtNGM4Yi04YTRmLWNmY2Y3NGNhYjM0NSIsImludGVudF9pZCI6IlBJMTkzNTU4MDU1MTgzNDUwNTIxNiIsImV4cCI6MTc1MDMxNTEzOSwiaWF0IjoxNzUwMzEzMzM5fQ.tWrR1JjQbdAoNN7TiynKK2I77mEdA8apcBXl6fkhoeU",
"complete_time": "",
"create_time": "2025-06-19T14:08:59+08:00",
"currency": "SGD",
"description": "acquiring sandbox testing",
"intent_status": "REQUIRES_CUSTOMER_ACTION",
"latest_payment_attempt": {
"amount": 7.77,
"attempt_id": "PA1935580551901614080",
"attempt_status": "AUTHENTICATION_REDIRECTED",
"captured_amount": 7.77,
"complete_time": "",
"create_time": "2025-06-19T14:08:59+08:00",
"currency": "SGD",
"failure_code": "",
"refunded_amount": 0,
"update_time": "2025-06-19T14:08:59+08:00"
},
"merchant_order_id": "f2c98168-2f07-4459-853a-329655ebf90e",
"metadata": {
"request_id": "16cfe523-ac95-4f02-9e31-58bb090a0138"
},
"next_action": {
"display_qr_code": {
"expires_at": "2025-06-19T14:38:59.563+08:00",
"qr_code": "https://global.alipay.com/281002040092rZoN1k6ln7O91r9fwjb2tUo2",
"qr_code_url": "https://global.alipay.com/merchant/order/showQrImage.htm?code=https%3A%2F%2Fglobal.alipay.com%2F281002040092rZoN1k6ln7O91r9fwjb2tUo2&picSize=M"
}
},
"payment_intent_id": "PI1935580551834505216",
"return_url": "https://127.0.0.1:8080/api/v1/callback",
"update_time": "2025-06-19T14:08:59+08:00"
}Testing Steps
- Open the QR code URL provided in the
qr_code_urlfield of response. - Use the AWallet app to scan the QR code and complete the payment.
Note: The value of
"intent_status"will be"REQUIRES_CUSTOMER_ACTION", indicating that customer interaction (i.e., scanning and confirming the payment) is required to proceed.
3.2 PaymentCode
Sample Request Payload
{
"amount": "1.11",
"currency": "SGD",
"payment_method": {
"type": "alipaycn",
"alipaycn": {
"flow": "qrcode",
"os_type": "ios",
"is_present": true,
"payment_code": "284057804613761079"
}
},
"merchant_order_id": "{{$guid}}",
"description": "acquiring sandbox testing",
"metadata": {
"request_id": "{{$guid}}"
},
"return_url": "https://127.0.0.1:8080/api/v1/callback"
}Sample Response Payload
{
"amount": 1.11,
"available_payment_method_types": null,
"cancel_time": "",
"cancellation_reason": "",
"captured_amount": "1.11",
"client_secret": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtYXN0ZXJfaWQiOiIwIiwiYWNjb3VudF9pZCI6ImE3YjkyYTE5LWJmYzMtNGM4Yi04YTRmLWNmY2Y3NGNhYjM0NSIsImludGVudF9pZCI6IlBJMTkzNTI3NTQyODQ5MTAzODcyMCIsImV4cCI6MTc1MDI0MjM5MiwiaWF0IjoxNzUwMjQwNTkyfQ.4xy27scaYXdxjUc16OJ0CnujNdZ1DF9CqWEfF1jphxI",
"complete_time": "2025-06-18T17:56:32+08:00",
"create_time": "2025-06-18T17:56:32+08:00",
"currency": "SGD",
"description": "acquiring sandbox testing",
"intent_status": "SUCCEEDED",
"latest_payment_attempt": {
"amount": 1.11,
"attempt_id": "PA1935275428566536192",
"attempt_status": "CAPTURE_REQUESTED",
"captured_amount": 1.11,
"complete_time": "2025-06-18T17:56:32+08:00",
"create_time": "2025-06-18T17:56:32+08:00",
"currency": "SGD",
"failure_code": "",
"refunded_amount": 0,
"update_time": "2025-06-18T17:56:32+08:00"
},
"merchant_order_id": "59f89515-e9f6-4ce5-a83c-9d70605d30c5",
"metadata": {
"request_id": "48f4c0f0-5c08-4624-95c2-e63518afb435"
},
"next_action": null,
"payment_intent_id": "PI1935275428491038720",
"return_url": "https://127.0.0.1:8080/api/v1/callback",
"update_time": "2025-06-18T17:56:32+08:00"
}Testing Steps
- Open the AWallet app and tap "Payment Code"
- Tap the Barcode to view the numeric payment code.
- Set the retrieved code as the
payment_codefield in your API request payload.
Note: The returned "intent_status" will be "SUCCEEDED", indicating that the payment was successfully completed.
Unlike QR code scenarios, no further customer interaction is required—the payment is confirmed immediately upon submission.
Updated 11 months ago
Did this page help you?
