Alipay, China's leading third-party online payment solutionAlipay, China's leading third-party online payment solution

inquiryPayment

POST /v1/payments/inquiryPayment

Use this API to inquire about the transaction status and other information about a previously submitted payment request.

Structure

A message consists of a header and body. The following sections are focused on the body structure. For the header structure, see: 


Note: Set the data type of each field (except array) as String. This means that you must use double quotation marks (" ") to enclose the field value. Examples:

  • If the data type of a field is Integer and its value is 20, set it as "20". 
  • If the data type of a field is Boolean and its value is true, set it as "true". 

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. If both paymentRequestId and paymentId are specified, paymentId takes precedence.

More information about this field

  • 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 about this field

  • Maximum length: 64 characters

Response parameters

result Result object REQUIRED

Information about the request calling result. 

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 payment result. Valid values are: 

  • SUCCESS: Indicates that the payment succeeds. 
  • FAIL: Indicates that the payment is failed. 
  • PROCESSING: Indicates that the payment is under processing. 
  • CANCELLED: Indicates that the payment is canceled.
  • PENDING: Indicates that the payment is completed. Wait for the final payment result. 

Note: This field is returned when the API is called successfully (the value of result.resultStatus is S).

paymentResultCode String  

The result code for different payment statuses. Possible payment result codes are listed in the Payment result codes table on this page.

Note: This field is returned when the API is called successfully (the value of result.resultStatus is S).

More information about this field

  • Maximum length: 64 characters

paymentResultMessage String  

The result message that explains the payment result code.

Note: This field is returned when the API is called successfully (the value of result.resultStatus is S).

More information about this field

  • Maximum length: 256 characters

paymentRequestId String  

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

Note: This field is returned when the API is called successfully (the value of result.resultStatus is S).

More information about this field

  • Maximum length: 64 characters

paymentId String  

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

Note: This field is returned when the API is called successfully (the value of result.resultStatus is S).

More information about this field

  • Maximum length: 64 characters

paymentAmount Amount object REQUIRED

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

Show child parameters

paymentCreateTime Datetime  

The date and time when the payment is created. 

Note: This field is returned when the API is called successfully (the value of result.resultStatus is S).

More information about this field

  • The value follows the ISO 8601 standard format. For example, "2019-11-27T12:01:01+08:00".

paymentTime Datetime  

The date and time when the payment reaches a final state of success.

Note: This field is returned only when the payment reaches a final state of success (the value of paymentStatus is SUCCESS). 

More information about this field

  • The value follows the ISO 8601 standard format. For example, "2019-11-27T12:01:01+08:00".

pspCustomerInfo PspCustomerInfo object 

The customer information of Alipay+ MPP.

Note: This field is returned when the Alipay+ MPP can provide the related information.

Show child parameters

transactions Array<Transaction> object 

Information about the subsequent action against a transaction.

Note: This field is returned when a refund against the transaction exists.

More information about this field

  • Maximum size: Unlimited
Show child parameters

customsDeclarationAmount Amount object 

The total amount for customs declaration.

Note: This field is returned only when the payment succeeds and the wallet is AlipayCN.

Show child parameters

grossSettlementAmount Amount object 

The value of this field equals to transaction amount multiplied by the value of settlementQuote. This field is returned when the currency exchange is predetermined and the exchange rate is locked at the time of transaction. 

Show child parameters

settlementQuote Quote object 

The exchange rate between the settlement currency and payment currency. This field is returned when grossSettlementAmount is returned. 

Show child parameters
API Explorer
Sample CodesRun in Sandbox

Request

URL
Request Body

Response

Case
A successful payment
Response Body

More information 

This section provides additional information about key 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. This value is used as the start time of the subsequent cancellable and refundable time. For example, if the refundable time is 6 months, the final time to accept the refund is paymentTime plus 6 months.
  • To decide when to use paymentRequestId or paymentId, follow these rules:
    • If the pay API calling returns successfully, use paymentId or paymentRequestId to inquire about the payment result.
    • If the pay API calling returns unknown exceptions or timeouts, use paymentRequestId to inquire about the payment result.
    • If the cancel API calling returns unknown exceptions or times out, use paymentId or paymentRequestId of the original payment to inquire about the cancel result.

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, the inquiryPayment API is called successfully. You can get the payment result from the paymentStatus field of the API response.
  • If the value of result.resultStatus is F, the inquiryPayment API call is failed. You cannot get the payment result from the API response.
  • If the value of result.resultStatus is U, the status of the inquiryPayment API call is unknown. Use the same request parameters to retry the inquiryPayment API. 

Result/Error codes

CodeValueMessageFurther action
SUCCESSSSuccess

The interface is called successfully. Obtain the order status by paymentStatus.

ACCESS_DENIEDFAccess is denied.

Contact Alipay Technical Support for detailed reasons. 

API_INVALIDFThe API name or API call format is used incorrectly.

Check whether the API name, HTTP method, or request format is correct when sending the request. 

INVALID_CONTRACTFThe parameter values in the contract do not match those in the current transaction.

Check whether the parameter values in the contract match those in the current transaction. If the values match, contact Alipay Technical Support to troubleshoot the issue. 

INVALID_SIGNATUREFThe signature is not validated. The private key used to sign a request does not match the public key of Alipay Developer Center.

Check whether the private key used to sign a request matches the public key of Alipay Developer Center. The following signature references are useful:

KEY_NOT_FOUNDFThe private key or public key of Alipay or the merchant is not found.

Check whether the private key or public key exists. If not, upload the private key in Alipay Developer Center. 

MEDIA_TYPE_NOT_ACCEPTABLEFThe server does not implement the media type that is acceptable to the client.

Check whether the media type is correct and use a media type that is accepted by Alipay. 

MERCHANT_NOT_REGISTEREDFThe merchant is not registered.

Please register the merchant by using the registration interface. Contact Alipay Technical Support if failed to call the registration interface. 

METHOD_NOT_SUPPORTEDFThe server does not implement the requested HTTP method. Only the POST method is supported.

Ensure the HTTP method is POST. 

NO_INTERFACE_DEFFAPI is not defined.

Check whether the URL is correct. Please refer to the endpoint in the API documentation. 

ORDER_NOT_EXISTFThe order does not exist.

Check whether paymentId is correct. If correct, contact Alipay Technical Support for specific reasons. 

PARAM_ILLEGALFThe required parameters are not passed, or illegal parameters exist. For example, a non-numeric input, an invalid date, or the length and type of the parameter are wrong.

Check and verify whether the required request fields (including the header fields and body fields) of the current API are correctly passed and valid. 

PROCESS_FAILFA general business failure occurred.

Do not retry. Human intervention is usually needed. It is recommended that you contact Alipay Technical Support to troubleshoot the issue. 

SYSTEM_ERRORFA system error occurred.

Do not retry, and contact Alipay Technical Support for more details. 

REQUEST_TRAFFIC_EXCEED_LIMITUThe request traffic exceeds the limit.

Call the interface again to resolve the issue. If not resolved, contact Alipay Technical Support. 

UNKNOWN_EXCEPTIONUAn API call has failed, which is caused by unknown reasons.

Call the interface again to resolve the issue. If not resolved, contact Alipay Technical Support. 

Payment result codes

CodeValueMessageFurther action
SUCCESSSSuccess

The payment is successful, no further action is needed. 

ACCESS_DENIEDFAccess is denied.

Contact Alipay Technical Support for detailed reasons. 

API_INVALIDFThe API name or API call format is used incorrectly.

Check whether the API name, HTTP method, or request format is correct when sending the request. 

CURRENCY_NOT_SUPPORTFThe currency is not supported.

Contact Alipay Technical Support for detailed reasons. 

INVALID_ACCESS_TOKENFThe access token is expired, revoked, or does not exist.

Check whether the accessToken is expired, revoked, or does not exist. Re-sign the contract and re-initiate the authorization signing process. 

INVALID_CONTRACTFThe parameter values in the contract do not match those in the current transaction.

Check whether the parameter values in the contract match those in the current transaction. If the values match, contact Alipay Technical Support to troubleshoot the issue. 

INVALID_MERCHANT_STATUSFThe merchant status is abnormal because restrictions exist.

Contact Alipay Technical Support for detailed reasons. 

INVALID_SIGNATUREFThe signature is not validated. The private key used to sign a request does not match the public key of Alipay Developer Center.

Check whether the private key used to sign a request matches the public key of Alipay Developer Center. The following signature references are useful:

KEY_NOT_FOUNDFThe private key or public key of Alipay or the merchant is not found.

Check whether the private key or public key exists. If not, upload the private key in Alipay Developer Center. 

MERCHANT_KYB_NOT_QUALIFIEDFThe payment failed because of the merchant's KYB status. The merchant is either not KYB compliant, or the KYB status is not qualified for this transaction.

Contact Alipay Technical Support for detailed reasons. 

MERCHANT_NOT_REGISTEREDFThe merchant is not registered.

Please register the merchant by using the registration interface. Contact Alipay Technical Support if failed to call the registration interface. 

NO_INTERFACE_DEFFAPI is not defined.

Check whether the URL is correct. Please refer to the endpoint in the API documentation. 

NO_PAY_OPTIONSFThe currency is not supported for the transaction.

Check whether the currency is supported by the wallet, or check whether the wallet and currency are consistent with the contract. Contact Alipay Technical Support for detailed reasons. 

ORDER_IS_CLOSEDFThe request you initiated has the same paymentRequestId as that of the existed transaction, which is closed.

Use a new paymentRequestId to initiate the payment again. 

PARAM_ILLEGALFThe required parameters are not passed, or illegal parameters exist. For example, a non-numeric input, an invalid date, or the length and type of the parameter are wrong.

Check and verify whether the required request fields (including the header fields and body fields) of the current API are correctly passed and valid. 

PAYMENT_AMOUNT_EXCEED_LIMITFThe payment amount is greater than the maximum amount allowed by the contract or wallet.

Check whether the payment amount exceeds the limit or use a lower amount and try again. Contact Alipay technical support to know the specific limitation.  

PAYMENT_COUNT_EXCEED_LIMITFThe maximum number of payments exceeds the limit that is specified by the wallet.

Contact Alipay Technical Support to know the specific limitation.  

PAYMENT_NOT_QUALIFIEDFThe merchant is not qualified to pay because the merchant is not registered, does not have a contract for Auto Debit payment, or is forbidden to make a payment.

Contact Alipay Technical Support for detailed reasons. 

PROCESS_FAILFA general business failure occurred.

Do not retry. Human intervention is usually needed. It is recommended that you contact Alipay Technical Support to troubleshoot the issue. 

RISK_REJECTFThe request is rejected because of the risk control.

Prompt the user that the request is rejected because the risk control failed.  

SYSTEM_ERRORFA system error occurred.

Do not retry, and contact Alipay Technical Support for more details. 

USER_AMOUNT_EXCEED_LIMITFThe payment amount exceeds the user payment limit.

Create a new payment by using an amount less than or equal to the account's available balance, or contact Alipay Technical Support. 

USER_BALANCE_NOT_ENOUGHFThe payment cannot be completed because the user balance in the corresponding payment method is not enough.

Please top up the account or choose other payment methods. 

USER_KYC_NOT_QUALIFIEDFThe payment 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).

Complete the KYC verification first. 

USER_PAYMENT_VERIFICATION_FAILEDFThe user is restricted from payment on the wallet side.

Contact Alipay Technical Support to know the specific reasons. 

USER_STATUS_ABNORMALFThe user status is abnormal on the wallet side.

Contact Alipay Technical Support to know the specific reasons. 

PAYMENT_IN_PROCESSUThe payment is being processed.

For Cashier Payment, the request you initiated has the same paymentRequestId as that of the existed transaction, which might be a successful or in-process transaction. Check whether redirectActionForm.redirectUrl is returned in the response. If returned, redirect the user to the address specified by rediectUrl to complete the payment. If not, the payment might already be completed. See Result process logic for details. For Auto Debit, the payment is being processed. Wait for the asynchronous notification or call the inquiryPayment interface to query the final payment status. 

UNKNOWN_EXCEPTIONUAn API call has failed, which is caused by unknown reasons.

For Cashier Payment, call the pay interface again with a new paymentRequestId to resolve the issue. If not resolved, contact Alipay Technical Support.

For Auto Debit, call the pay interface again or call the inquiryPayment interface to query the final payment status. If the issue is not resolved, contact Alipay Technical Support.

Transaction result codes

CodeValueMessageFurther action
SUCCESSSSuccess

The interface is called successfully. Obtain the refund status by refundStatus

ACCESS_DENIEDFAccess is denied.

Contact Alipay Technical Support for detailed reasons. 

API_INVALIDFThe API name or API call format is used incorrectly.

Check whether the API name, HTTP method, or request format is correct when sending the request. 

CLIENT_INVALIDFThe client ID is invalid. Alipay has restrictions on client ID.

Check whether the client ID is correct, or contact Alipay Technical Support for detailed reasons. 

INVALID_SIGNATUREFThe signature is not validated. The private key used to sign a request does not match the public key of Alipay Developer Center.

Check whether the private key used to sign a request matches the public key of Alipay Developer Center. The following signature references are useful:

KEY_NOT_FOUNDFThe private key or public key of Alipay or the merchant is not found.

Check whether the private key or public key exists. If not, upload the private key in Alipay Developer Center. 

MEDIA_TYPE_NOT_ACCEPTABLEFThe server does not implement the media type that is acceptable to the client.

Check whether the media type is correct and use a media type that is accepted by Alipay. 

METHOD_NOT_SUPPORTEDFThe server does not implement the requested HTTP method. Only the POST method is supported.

Ensure the HTTP method is POST. 

NO_INTERFACE_DEFFAPI is not defined.

Check whether the URL is correct. Please refer to the endpoint in the API documentation. 

ORDER_NOT_EXISTFThe order does not exist.

Call the interface again after 15 seconds. If no results are returned after three retries, the order has not been placed. 

PARAM_ILLEGALFThe required parameters are not passed, or illegal parameters exist. For example, a non-numeric input, an invalid date, or the length and type of the parameter are wrong.

Check and verify whether the required request fields (including the header fields and body fields) of the current API are correctly passed and valid. 

PROCESS_FAILFA general business failure occurred.

Do not retry. Human intervention is usually needed. It is recommended that you contact Alipay Technical Support to troubleshoot the issue. 

SYSTEM_ERRORFA system error occurred.

Do not retry, and contact Alipay Technical Support for more details. 

REQUEST_TRAFFIC_EXCEED_LIMITUThe request traffic exceeds the limit.

Call the interface again to resolve the issue. If not resolved, contact Alipay Technical Support. 

UNKNOWN_EXCEPTIONUAn API call has failed, which is caused by unknown reasons.

Call the interface again to resolve the issue. If not resolved, contact Alipay Technical Support.