Alipay+ DocsAlipay+ Docs

Inquire about payment result

The Acquiring Service Provider (ACQP) can call the inquiryPayment API to inquire about the payment result at the Mobile Payment Provider side. When you (the ACQP) cannot receive the payment result notification due to network or system problems, the inquiryPayment API ensures you get the final payment result.

Processing logic

When using the inquiryPayment API, you need to take the following things into consideration:

  • The inquiryPayment API should be called in the form of polling until the paymentResult.resultStatus parameter of Sor F is obtained, or until the asynchronous payment notification is received. For how the notification and the inquiryPayment API collaborate to help you get the final payment result, see Collaboration between the notifyPayment and inquiryPayment APIs.
  • Alipay+ returns the following two kinds of results:
    • result: specifies the acknowledgment result of your inquiry payment request
    • paymentResult: specifies the payment result

Follow the instructions below to handle the results:

result.resultStatus

paymentResult.resultStatus

Payment status

Actions

S

S

Payment succeeds

Update the status from your server side.

S

F

If paymentResult.resultCode value is ORDER_IS_CLOSED, the order is closed or cancelled; otherwise, the payment fails.

The merchant can reinitiate a payment request.

S

U

Payment is in processing.

It is recommended to call the inquiryPayment API in the form of polling: keep querying for 10 minutes with an incremental frequency, after your server side gets the response of the pay API.

F

F

The payment request fails or the order does not exist.

  • For the cases where the payment request fails, take actions according to the error message in result.resultCode or contact connect_support@service.alipay.com.
  • For the cases where the order does not exist, the reasons might be:
  • The order number is wrong. Use the correct order number to perform an inquiry.
  • Order is not created in the Alipay+ system. Keep inquiry. It is recommended to call the inquiryPayment API in the form of polling: keep querying for 10 minutes with an incremental frequency, after your server side gets the response of the pay API.
  • If keep receiving the same result, call the cancelPayment API.

U

U

Unknown exception

It is recommended to call the inquiryPayment API in the form of polling: keep querying for 10 minutes with an incremental frequency, after your server side gets the response of the pay API.

If keep receiving the result that indicates the status is U, call the cancelPayment API.

No result received

Unknown

It is recommended to call the inquiryPayment API in the form of polling: keep querying for 10 minutes with an incremental frequency, after your server side gets the response of the pay API.

If still no result returns, call the cancelPayment API.

Note:

  • The maximum result inquiry polling time must be at least 10 minutes longer than the Alipay+'s payment expiration time.
  • If the transaction needs to be terminated before getting the final payment result, the cancelPayment API is required to be called to cancel the transaction. For more information about how to cancel a transaction, see Cancel a payment.

Sample

The following sample shows the request and response when you call the inquiryPayment API.

  • Request from the ACQP to Alipay+

The ACQP can send the request with either of the two parameters paymentRequestId and paymentId:

copy
{
 "paymentRequestId":"pay_1089760038715669_10277574507566920200101234567897890"
}

or:

copy
{
  "paymentId": "20200101234567890130000"
}
  • Response from Alipay+ to the ACQP

The ACQP receives a response that indicates a successful payment result:

copy
{
  "acquirerId": "1111088000000000002",
  "pspId": "1022172000000000001",
  "result": {
    "resultCode": "SUCCESS",
    "resultStatus": "S",
    "resultMessage": "success"
  },
  "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",
  "transactions":[
                    {
                      "transactionResult":{
                         "resultCode":"SUCCESS",
                         "resultStatus":"S",
                         "resultMessage":"success"
                      },
                      "transactionId":"1111111111111111111",
                      "transactionType":"REFUND",
                      "transactionStatus":"SUCCESS",
                        "transactionRequestId":"pay_1089760038715669_102775745075670",
                      "transactionAmount":{
                          "value":"500",
                          "currency":"USD"
                      },
                      "transactionTime":"2019-06-01T12:01:01+08:30"
                     }
   ]
}

Note: The sample above includes the list of refund transactions that are linked to the queried payment order. The transactions parameter is returned by Alipay+ if the value of the paymentResult.resultStatus parameter is S and at least one refund transaction is linked to the payment order.

More information

For more information about how to use the inquiryPayment API (such as the field description), see inquiryPayment.