Respond to payment inquiry
After a payment is initiated, Alipay+ repeatedly calls the inquiryPayment API to obtain the payment status from the Mobile Payment Provider (MPP). Polling stops once Alipay+ receives the final payment result, either in an inquiryPayment response or from a pay response.
Processing logic
When responding to the inquiryPayment request from Alipay+, you need to pay attention to the rules below.
- You need to return two kinds of results. The parameter result is the result of the API call and the parameter paymentResult is the result of the payment.
- If the payment order does not exist, return a result.resultStatus of
Fand result.resultCode ofORDER_NOT_EXIST. - If the payment order exists, return a result.resultStatus of
S, a result.resultCode ofSUCCESS, and a paymentResult according to your payment processing result.
- If the payment succeeds, return a paymentResult.resultStatus of
S, a paymentResult.resultCode ofSUCCESS. - If the payment is being processed, return a paymentResult.resultStatus of
U, a paymentResult.resultCode ofPAYMENT_IN_PROCESS. - If the payment fails, return a paymentResult.resultStatus of
Fand an error code that is corresponding to a specific reason.
- Required: If the user's balance is not enough, return a paymentResult.resultCode of
USER_BALANCE_NOT_ENOUGH. - Recommended: If the payment is declined for risk reasons, return a paymentResult.resultCode of
RISK_REJECT. - Recommended: If the user does not exist, or the user's status is abnormal, return a paymentResult.resultCode of
USER_NOT_EXISTorUSER_STATUS_ABNORMAL. - Recommended: If the user's payment methods that are linked to the MPP are unavailable, return a paymentResult.resultCode of
UNAVAILABLE_PAYMENT_METHOD. - Recommended: If the user verification fails, return a paymentResult.resultCode of
USER_PAYMENT_VERIFICATION_FAILED. - Recommended: If the user's KYC fails, return a paymentResult.resultCode of
USER_KYC_NOT_QUALIFIED. - Recommended: If the merchant verification fails, return a paymentResult.resultCode of
MERCHANT_NOT_REGISTERED.
- If the payment is cancelled, return a paymentResult.resultStatus of
Fand a paymentResult.resultCode ofORDER_IS_CLOSED.
- When no response from the MPP is received, Alipay+ retries the inquiry request at incremental time intervals until receiving the final payment result status of
SorF, or until the payment expires. Currently, the intervals are 4s, 4s, 30s, 60s, 60s, 60s, 5min, and 5min. The intervals are subject to change in the future by Alipay+.
Sample
The following sample shows the request and response of the inquiryPayment API.
Request from Alipay+ to the MPP
Alipay+ sends the payment inquiry request.
copy
{
"acquirerId": "1022188000000000001",
"pspId": "1022172000000000001",
"paymentRequestId": "20200101234567890132"
}Response from the MPP to Alipay+
The MPP returns a response that indicates a successful payment result.
copy
{
"result": {
"resultCode":"SUCCESS",
"resultStatus":"S",
"resultMessage":"Success"
},
"paymentResult": {
"resultCode":"SUCCESS",
"resultStatus":"S",
"resultMessage":"Success"
},
"paymentId":"2020010123456789013****",
"paymentTime": "2020-01-01T12:01:01+08:30",
"paymentAmount":{
"value":"100",
"currency":"JPY"
},
"payToAmount":{
"value":"1000",
"currency":"KRW"
},
"customerId":"1234567"
}Related links
For more information about how to use the inquiryPayment API (such as the field description), see inquiryPayment.