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

inquiryRefund

POST /v1/payments/inquiryRefund

Use this API to inquire about the refund status of a previously submitted refund 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

refundRequestId String  

The unique ID assigned by a merchant to identify a refund request. refundRequestId and refundId cannot both be null. Special characters are not supported. If both refundRequestId and refundId are specified, refundId takes precedence.

More information:

  • Maximum length: 64 characters

refundId String  

The unique ID assigned by Alipay to identify a refund. refundRequestId and refundId cannot both be null. A one-to-one correspondence between refundId and refundRequestId exists. If both refundRequestId and refundId are specified, refundId takes precedence.

More information:

  • Maximum length: 64 characters

Response parameters

result Result  REQUIRED

Information about the request call result.

Note: This field does not indicate the refund result. This field only indicates whether the inquiryRefund interface is called successfully. 

Show child parameters

refundId String  

The unique ID assigned by Alipay to identify a refund. A one-to-one correspondence between refundId and refundRequestId exists.

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

More information:

  • Maximum length: 64 characters

refundRequestId String  

The unique ID assigned by the merchant to identify a refund request.

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

More information:

  • Maximum length: 64 characters

refundAmount Amount  

The refund amount that is initiated by the merchant.

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

Show child parameters

refundTime Datetime  

The date and time when the refund reaches a final state of success on the Alipay side. 

Note: This field is returned when the refund succeeds (the value of refundStatus is SUCCESS).

More information:

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

refundStatus String  

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

  • SUCCESS: Indicates the refund succeeded. 
  • PROCESSING: Indicates the refund is under processing. 
  • FAIL: Indicates the refund failed.

Notes: 

  • This field is returned when the API is called successfully (the value of result.resultStatus is S).
  • This field only identifies the refund status on the Alipay side and does not include the Alipay+ Mobile Payment Provider (Alipay+ payment methods) side. 

More information:

  • Maximum length: 16 characters

grossSettlementAmount Amount  

The refund settlement amount, which equals the refund 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 the transaction. 

Show child parameters

settlementQuote Quote  

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

Show child parameters
API Explorer
Sample CodesRun in Sandbox

Request

URL
Request Body

Response

Case
Payment successul
Response Body

More Information

To decide when to use refundRequestId or refundId, follow these rules:

  • If a successful result is returned after calling the refund API, use refundId or refundRequestId to inquire about the original refund result.
  • If an unknown exception or timeout occurs after calling the refund API, use only refundRequestId to inquire about the original refund result.

Result process logic

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

  • If the value of result.resultStatus is S, the refund result inquiry is successful.
  • If the value of result.resultStatus is F, the refund inquiry failed.
  • If the value of result.resultStatus is U, the request result is unknown. Use the same request parameters to retry the inquiry request. 

Result/Error codes

CodeValueMessageFurther action
SUCCESSSSuccess

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

ACCESS_DENIEDFAccess is denied.

Contact Alipay Technical Support for detailed reasons. 

INVALID_APIFThe called API is invalid or not active.

Contact Alipay Technical Support to resolve the issue.  

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. 

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. 

Refund result codes

CodeValueMessageFurther action
SUCCESSSSuccess

The refund 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_MERCHANT_STATUSFThe merchant status is abnormal because restrictions exist.

Contact Alipay Technical Support for detailed reasons. 

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_BALANCE_NOT_ENOUGHFThe merchant balance is insufficient.

Call the interface again after the merchant has sufficient balance. The refundRequestId field needs to be changed when you try again. 

MULTIPLE_REFUNDS_NOT_SUPPORTEDFMultiple refunds are not supported because restrictions exist in the contract.

Check whether multiple refunds exist. Do not call the refund interface anymore. For each refund, only call the interface once

NO_INTERFACE_DEFFAPI is not defined.

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

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 refund again. 

ORDER_NOT_EXISTFThe order does not exist.

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

ORDER_STATUS_INVALIDFThe order status is invalid. The transaction is under process or the transaction is failed.

Check the order status and take corresponding actions. Wait if the transaction is under process. Do not initiate the refund if the transaction failed. 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. 

REFUND_AMOUNT_EXCEEDFThe total refund amount exceeds the payment amount.

Confirm whether the total refund amount exceeds the payment amount. Create a new refund by using an amount less than or equal to the payment amount, or contact Alipay Technical Support. 

REFUND_WINDOW_EXCEEDFThe refund date exceeds the refundable period that is agreed in the contract.

Confirm whether the refund date exceeds the refundable period. Check the refundable period in the contract or contact Alipay Technical Support for the specific refundable period.

REPEAT_REQ_INCONSISTENTFThe amount or currency is different from the previous request.

Ensure all the fields in the requests are the same or use a new paymentRequestId to initiate the refund again. 

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. 

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.