Accept payment
To integrate the Merchant-presented Mode Payment Order Code, the Acquiring Service Provider (ACQP) needs to complete the following steps.
Merchant registration
In certain countries or regions, for legal or compliance reasons, the merchant information that is related to this payment must be registered before a payment can be processed. The merchant registration process only needs to be performed once.
The following figure illustrates the merchant registration flow:
Figure 2. Merchant registration flow
Processing logic
When processing merchant registration requests, Mobile Payment Provider must pay attention to the following items:
- Batch operations are not supported. Each time, only one merchant or store can be registered.
- For the cashier payment scenario, at least the merchant information must be registered.
- The response of the merchant registration request only indicates that the registration request is successfully accepted.
- Mobile Payment Provider returns the registration status to Alipay+ asynchronously (normally within 7 days), the ACQP can obtain the registration result by using inquiryRegistrationStatus interface.
- Alipay+ will notify the ACQP of the merchant registration status via notifyRegistrationStatus interface if the ACQP integrates this interface.
Sample
Alipay+ sends merchant registration request to Mobile Payment Provider.
{
"registrationRequestId": "202009181105860200000600142****",
"merchantInfo": {
"referenceMerchantId": "218812000019****",
"merchantDisplayName": "Example",
"merchantMCC": "5735",
"logo": {
"logoUrl": "www.example.com",
"logoName": "Example Inc"
},
"merchantAddress": {
"region": "CN",
"address1": "浙江省杭州市..."
},
"registrationDetail": {
"legalName": "Example.com",
"contactInfo": [{
"contactNo": "abc@example.com",
"contactType": "EMAIL"
}, {
"contactNo": "9326*****56",
"contactType": "MOBILE_PHONE"
}],
"registrationType": "ENTERPRISE_REGISTRATION_NO",
"registrationNo": "RN1**",
"registrationEffectiveDate": "2019-01-01T12:08:55+08:00",
"registrationExpireDate": "2020-01-01T12:08:55+08:00",
"registrationAddress": {
"region": "CN",
"address1": "浙江省杭州市"
},
"websites": [{
"url": "http://electrolibs.com",
"websiteType": "WEB"
}],
"businessType": "ENTERPRISE"
},
"shareholderName": "Zhangsan",
"shareholderId": "69833444422"
},
"storeInfo": {
"referenceStoreId": "218812****",
"storeName": "Example",
"storeMCC": "5735",
"storeAddress": {
"region": "CN",
"address1": "浙江省杭州市..."
}
},
"productCodes": ["IN_STORE_PAYMENT"]
}
Mobile Payment Provider returns result to Alipay+.
{
"result": {
"resultCode": "SUCCESS",
"resultStatus": "S",
"resultMessage": "Success"
}
}
More information
For more information about how to use the APIs (such as the field description), see registration.
Create a payment
To initiate a payment request, merchants should present an order code for users to complete the payment. The order code here is a unique QR code that is generated by the Alipay+ system for each transaction.
Processing logic
After the user scans the order code and completes the payment, the ACQP is recommended to monitor the payment result notifications, or use the inquiryPayment interface to query the payment result.
Note:
- It is recommended to listen to the Async notification from the Alipay+ system. Meanwhile, calling the inquiryPayment interface to get the result is also needed.
- When the order is closed, you must also stop displaying the order code.
Sample
The ACQP sends a request to Alipay+.
{
"paymentExpiryTime": "2019-06-01T12:01:01+08:00",
"paymentNotifyUrl": "http://xmock.inc.alipay.net/api/Ipay/globalSite/automtion/paymentNotify.htm",
"paymentRequestId": "pay_1089760038715669_102775745075669",
"paymentFactor": {
"isInStorePayment": "true",
"isCashierPayment": "true",
"inStorePaymentScenario":"OrderCode"
},
"order": {
"referenceOrderId": "102775745075669",
"orderDescription": "Mi Band 3 Wrist Strap Metal Screwless Stainless Steel For Xiaomi Mi Band 3 ",
"orderAmount": {
"currency": "JPY",
"value": "100"
},
"merchant": {
"referenceMerchantId": "M00000000001",
"merchantName": "cup Hu",
"merchantMCC": "1405",
"merchantAddress": {
"region": "JP",
"city": "xxx"
},
"store": {
"referenceStoreId": "S00000000001",
"storeName": "UGG-2",
"storeMcc": "1405"
}
},
"env":{
"storeTerminalId":"122222",
"storeTerminalRequestTime": "2019-06-01T12:01:01+08:00"
}
},
"settlementStrategy": {
"settlementCurrency": "USD"
},
"paymentAmount": {
"currency": "JPY",
"value": "100"
},
"paymentMethod": {
"paymentMethodType": "CONNECT_WALLET"
}
}
Alipay+ returns a response to the ACQP.
{
"acquirerId": "2021228100000000",
"result": {
"resultCode": "PAYMENT_IN_PROCESS",
"resultMessage": "The payment in process.",
"resultStatus": "U"
},
"paymentId": "20190608114010800100188820200355883",
"paymentAmount": {
"value": "100",
"currency": "JPY"
},
"orderCodeForm": {
"paymentMethodType": "CONNECT_WALLET",
"expireTime": "2019-06-01T12:01:01+08:30",
"codeDetails": [{
"codeValueType": "QRCODE",
"codeValue": "https://qr.alipay.com/bavh4wjlxf12tper3b",
"displayType": "TEXT"
},
{
"codeValueType": "QRCODE",
"codeValue": "https://global.alipay.com/merchant/order/showQrImage.htm?code=https%3A%2F%2Fglobal.alipay.com%2F281002040011kGko31tPT30V6G9hJiH8YNMa&picSize=L",
"displayType": "BIGIMAGE"
},
{
"codeValueType": "QRCODE",
"codeValue": "https://global.alipay.com/merchant/order/showQrImage.htm?code=https%3A%2F%2Fglobal.alipay.com%2F281002040011kGko31tPT30V6G9hJiH8YNMa&picSize=M",
"displayType": "MIDDLEIMAGE"
},
{
"codeValueType": "QRCODE",
"codeValue": "https://global.alipay.com/merchant/order/showQrImage.htm?code=https%3A%2F%2Fglobal.alipay.com%2F281002040011kGko31tPT30V6G9hJiH8YNMa&picSize=S",
"displayType": "SMALLIMAGE"
}
]
}
}
More information
For more information about how to use the interface (such as the field description), see pay.
Handle payment result notifications
Alipay+ calls the notifyPayment interface to notify the ACQP about the payment result when payment reaches a final state of success or failure. After that, the ACQP needs to notify merchants of the result accordingly.
Processing logic
Accept notifications
For a successful payment transaction, an HTTP POST is fired once the transaction is successfully completed. The HTTP request is sent in the raw JSON, of which the Content-Type request header is specified as application/json
. Ensure that you can access the HTTP body accordingly.
For more information about what the request header, the successful payment notification request body and the failed payment notification body look like, see the samples below.
Verify the signature
The notification request that Alipay+ sends to the ACQP is signed. The merchant needs to verify the signature to confirm whether the notification is sent from Alipay+. For how to validate a signature, see Validate a signature.
After the notification is delivered successfully, verify whether the values of the paymentAmount and paymentRequestId parameters are as you expect (for example, the amount that you have calculated for the order that you are going to ship).
Acknowledge the notification with the required response
After receiving the notification, no matter whether the order processing succeeds or fails, you must return a receipt acknowledgment message to Alipay+. Meanwhile, the required response must also be signed.
For more information about what the header and body of the response look like, see the samples below.
Note: The notifyPayment interface cannot accept the failure that is caused by business reasons, for example, risk control validation failure. If the payment fails due to some business reasons, the ACQP must firstly accept the payment notification and return SUCCESS
to Alipay+, and then call the cancelPayment interface to perform refunds.
Retrial mechanism
After receiving the notification, you must respond with an HTTP status code of 200
and send an acknowledgment with result.resultStatus of S
to indicate that your server received and processed the call. If you respond with other status codes, or acknowledge with other values, Alipay+ takes the notification delivery as unsuccessful. Therefore, Alipay+ will retry the notification sending.
- The interval between two adjacent times is: 2m, 10m, 10m, 1h, 2h, 6h, 15h
- 7 times - up to 24 hours 22 minutes
Samples
Alipay+ sends a request to the ACQP.
- Request header:
"Content-Type": "application/json",
"Request-Time": "2019-07-12T12:08:56.253+05:30",
"client-id": "T_111222333",
"Signature": "algorithm=RSA256,keyVersion=1,signature=jTOHqknjk%2fnDjEn8lfg%2beNODdoh2eHGJV%2blvrKaDwP782WxJ7ro49giqUu23MUM8sFVVNvhg32qHS3sd4O6uf5kAVLqztqNOPJFZcjw141EVi1vrs%2bIB4vU0%2fK%2f8z2GyWUByh2lHOWFsp%2b5QKCclXp%2bjacYqWYUur5IVbuebR1LoD5IiJ7u7J9qYriFxodkxmIAJYJyJs7mks2FWHh2YePLj3K%2f4B65"
- Successful payment notification body:
{
"acquirerId": "1111088000000000002",
"pspId":"1022172000000000001",
"paymentResult": {
"resultCode":"SUCCESS",
"resultStatus":"S",
"resultMessage":"success"
},
"paymentRequestId":"pay_1089760038715669_102775745075669",
"paymentId":"20200101234567890134567",
"paymentTime": "2020-01-01T12:01:01+08:30",
"paymentAmount":{
"value":"100",
"currency":"JPY"
},
"customerId":"1235678",
"walletBrandName":"KAKAOPAY"
}
- Failed payment notification request body:
{
"acquirerId":"1022165000000000001",
"customerId":"210220900020254424845",
"paymentAmount": {
"currency":"THB",
"value":"565900"
},
"paymentId":"2021032919074101000220016046283",
"paymentRequestId":"2021032989031300002162325476274",
"paymentResult": {
"resultCode":"PROCESS_FAIL",
"resultMessage":"General business failure. No retry.",
"resultStatus":"F"
},
"paymentTime":"2021-03-29T11:00:52+08:00",
"pspId":"2021226300000000"
}
The ACQP returns a response to Alipay+.
- Response header:
"Content-Type": "application/json",
"response-time": "2019-07-12T12:08:56+05:30",
"client-id": "T_111222333",
"Signature": "algorithm=RSA256,keyVersion=1,signature=jTOHqknjk%2fnDjEn8lfg%2beNODdoh2eHGJV%2blvrKaDwP782WxJ7ro49giqUu23MUM8sFVVNvhg32qHS3sd4O6uf5kAVLqztqNOPJFZcjw141EVi1vrs%2bIB4vU0%2fK%2f8z2GyWUByh2lHOWFsp%2b5QKCclXp%2bjacYqWYUur5IVbuebR1LoD5IiJ7u7J9qYriFxodkxmIAJYJyJs7mks2FWHh2YePLj3K%2f4B65"
- Response body
{
"result": {
"resultCode":"SUCCESS",
"resultStatus":"S",
"resultMessage":"Success"
}
}
More information
For more information about how to use the interface (such as the field description), see notifyPayment.