inquiryPayment

POST /v1/payments/inquiryPayment

Use the inquiryPayment API to query for information about a previously submitted payment request or accept the asynchronous processing result for a payment.

Request parameters

paymentRequestId String  

The unique ID that is assigned by a merchant to identify a payment request. paymentRequestId and paymentId cannot both be null. Special characters are not supported. If both paymentRequestId and paymentId are specified, paymentId takes precedence.

More information:

  • Maximum length: 64 characters

paymentId String  

The unique ID that is assigned by Alipay to identify a payment. paymentRequestId and paymentId cannot both be null. A one-to-one correspondence between paymentId and paymentRequestId exists. If both paymentRequestId and paymentId are specified, paymentId takes precedence.

More information:

  • Maximum length: 64 characters

Response parameters

result Result  

The request result contains information such as status and error codes.

Note: This field doesn't indicate the payment result. This field only indicates whether the inquiryPayment interface is called successfully.

Show child parameters

paymentStatus String  

Indicates the final status of Alipay payment. Valid values are:  

  • SUCCESS: Indicates the transaction is successful. 
  • FAIL: Indicates the transaction is failed. 
  • PROCESSING: Indicates the transaction is under processing. 
  • CANCELLED: Indicates the transaction is canceled.

paymentResultCode String  

Payment result code

More information:

  • Maximum length: 64 characters

paymentResultMessage String  

Payment result message

More information:

  • Maximum length: 64 characters

paymentRequestId String  

The unique ID that is assigned by a merchant to identify a payment request

More information:

  • Maximum length: 64 characters

paymentId String  

The unique ID that is assigned by Alipay to identify a payment

More information:

  • Maximum length: 64 characters

paymentAmount Amount  REQUIRED

The payment amount that the merchant requests to receive in the order currency.

Show child parameters

authExpiryTime Datetime  

Authorization expiration time, which follows the ISO 8601 standard.

paymentCreateTime Datetime  

The date and time when the payment is created, which follows the ISO 8601 standard.

paymentTime Datetime  

The date and time when the payment reaches a final state of success or failure, which follows the ISO 8601 standard.

pspCustomerInfo PspCustomerInfo  

PMP customer information.

Note: PMP, payment method provider, is an organization that processes payment services and other value-added services on behalf of the payer.

Show child parameters

redirectActionForm RedirectActionForm  

Provides information about the redirection action.

Show child parameters

transactions Array<Transaction>  

Information about the transaction

Show child parameters

grossSettlementAmount Amount  

The total settlement amount, which equals to the transaction amount multiplied by the value of settlementQuote.

Note: This field is empty when the settlement currency is the same as the transaction currency.

Show child parameters

settlementQuote Quote  

The exchange rate between the settlement currency and transaction currency at the time of the transaction, which is provided only in the locked-in rate case. 

Note: This field is empty when the settlement currency is the same as the transaction currency.

Show child parameters
API Explorer

Request

URL
Request Body

Response

Case
A successful payment
Response Body

More information 

This section provides additional information about other parameters. See the following list for details:

  • paymentTime:
    The successful execution time of this payment by Alipay, that is, the date and time when the payment reaches a final state of success or failure. This value is used as the start time of the subsequent revocable and refundable time. For example, if the refundable time is 6 months, the final time to accept the refund is paymentTime plus 6 months.
  • paymentId:
    The unique payment processing ID. For polling the same payment, this field must be unique; for polling different payments, this field must be different. This value can be used for further actions like inquiry, cancellation, or refund.
  • paymentRequestId or paymentId:
    To decide when to use paymentRequestId or paymentId, follow these rules:
    • If the pay interface calling returns successfully, the merchant can use the paymentId or paymentRequestId to query the original payment.
    • If the pay interface calling returns an unknown exception or times out, the merchant can only use paymentRequestId to query the payment result.
    • If the cancel interface calling returns an unknown exception or times out, the merchant can use either paymentId or paymentRequestId of the original payment to query the cancel result.
    • If the refund interface calling returns an unknown exception or times out, the merchant can use either paymentId or paymentRequestId of the original payment to query the refund result. But using refundRequestId is not supported.

Result process logic

For different request results, different actions are to be performed. See the following list for details:

  • If the value of result.resultStatus is S, payment result inquiry succeeds.
  • If the value of result.resultStatus is F, payment inquiry fails.
  • If the value of result.resultStatus is U, then the request result is unknown. Use the same request parameters to retry the inquiry request. 

Result/Error codes

CodeValueMessage
SUCCESSSSuccess
ORDER_NOT_EXISTFThe order does not exist.
PROCESS_FAILFA general business failure occurred. Do not retry.
PARAM_ILLEGALFIllegal parameters exist. For example, a non-numeric input, or an invalid date.
KEY_NOT_FOUNDFThe key is not found.
ACCESS_DENIEDFAccess denied
REQUEST_TRAFFIC_EXCEED_LIMITUThe request traffic exceeds the limit.
API_INVALIDFAPI is invalid or not active.
CLIENT_INVALIDFThe client is invalid.
INVALID_SIGNATUREFThe signature is invalid.
METHOD_NOT_SUPPORTEDFThe server does not implement the requested HTTP method.
MEDIA_TYPE_NOT_ACCEPTABLEFThe server does not implement the media type that is acceptable to the client.
UNKNOWN_EXCEPTIONUAn API call failed due to unknown reasons.
USER_KYC_NOT_QUALIFIEDFPayment failed because of the user's KYC status. The user is either not KYC compliant, or the KYC status is not qualified for this transaction (for example, limitations on the payment amount or product information).