Alipay+ DocsAlipay+ Docs

Respond to payment inquiry

Alipay+ calls the inquiryPayment API to retrieve the final status of a transaction if that status was not received in the initial pay API response or through a notifyPayment notification. This guide explains how to correctly implement your response to ensure the transaction status is synchronized.

The following figure shows the payment result inquiry flow of a transaction.

inquiry.jpg

The process of notifying the payment result consists of the following steps:

  1. The Ant server calls the inquiryPayment API to inquire about the payment status from the MPP server when the payment status is not final.
  2. The MPP server returns the payment status to the Ant server.

Processing logic

When responding to the inquiryPayment request from Alipay+, you must return the result of the API call (result) and the result of the payment (paymentResult) as follows:

Scenario

result.resultStatus

result.resultCode

paymentResult.resultStatus

Payment successful

S

SUCCESS

S

Payment failed

S

SUCCESS

F

Payment is processing

S

SUCCESS

U

Payment order does not exist

F

ORDER_NOT_EXIST

N/A

System or network issue

U

UNKNOWN_EXCEPTION

N/A

If no response from you is received, Alipay+ retries the inquiry request at increasing intervals until a final payment status (S or F) is received. The intervals are 4 sec, 4 sec, 30 sec, 60 sec, 60 sec, 60 sec, 5 min, and 5 min.

For more information about how to define your result codes, see Result codes.

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":"20200101234567890133333", 
 "paymentTime": "2020-01-01T12:01:01+08:30",
 "paymentAmount":{
    "value":"100",
    "currency":"JPY"
 },
 "payToAmount":{
    "value":"1000",
    "currency":"KRW"
 }, 
 "customerId":"1234567"
}