inquiryRefund

Use the inquiryRefund API to query for information about 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 about this field:

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

  • Maximum length: 64 characters

Response parameters

result Result object REQUIRED

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

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 null when the refund record cannot be found, or result.resultStatus is F or U

More information about this field:

  • Maximum length: 64 characters

refundRequestId String  

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

Note: This field is null when the refund record cannot be found, or result.resultStatus is F or U

More information about this field:

  • Maximum length: 64 characters

refundAmount Amount object 

The refund amount that is initiated by the merchant.

Note: This field is null when the refund record cannot be found, or result.resultStatus is F or U

Show child parameters

refundTime Datetime  

The date and time when the refund reaches a final state of success on the Alipay side, not the Alipay+ Mobile Payment Partner (Alipay+ MPP) side. 

Note: This field is null when the refund record cannot be found, or result.resultStatus is F or U

More information about this field:

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

refundStatus String  

Indicates the final status of the Alipay refund, not the Alipay+ Mobile Payment Partner (Alipay+ MPP) side. Valid values are:  

  • SUCCESS: Indicates the refund is successful. 
  • PROCESSING: Indicates the refund is still under process. 

Note: This field is null when the refund record cannot be found, or result.resultStatus is F or U

More information about this field:

  • Maximum length: 16 characters
API Explorer

Request

Method
POST
Endpoint
/v1/payments/inquiryRefund
Header
Accept: application/json
URL
https://<domain_name>/ams/api/<endpoint>
Domain name
North America: https://open-na.alipay.com
Asia: https://open-sea.alipay.com
Europe: https://open-eu.alipay.com
Request Body

Response

Response Body

More Information

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

  • refundTime:

The time when Alipay successfully executes the refund. This is when the refund reaches a final state of success on the Alipay side, and does not include the Alipay+ Mobile Payment Partner (Alipay+ MPP) side.

  • refundStatus:

This field only identifies the refund status on the Alipay side and does not include the Alipay+ MPP side.  

  • refundId:

The unique refund processing ID. For polling the same refund, this field must be unique. For polling different refunds, this field must be different. This field can be used for the refund inquiry.

  • refundRequestId or refundtId:
    • If a successful result is returned after calling the refund interface, the merchant can use refundId or refundRequestId to query the original refund result.
    • If an unknown exception or timeout is returned after calling the refund interface, the merchant can only use refundRequestId to query the original refund result.
    • If the merchant uses both refundId and refundRequestId tocall this interface, Alipay will only use refundId to do the query, and ignore the refundRequestId in the request.
    • If the merchant uses a correct refundId or refundRequestId tocall this interface, while that refund does not belong to the merchant, an error of ORDER_NOT_EXIST is returned.

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, then the refund result inquiry is successful.
  • If the value of result.resultStatus is F, then the refund inquiry failed.
  • If the value of result.resultStatus is U, then the request result is unknown. Use the same request parameters to retry the inquiry request. 

Error codes

Error codes are usually classified into the following categories:

  • Common error codes: common for all online and in-store payment APIs.  
  • API-specific error codes: listed in the following table.   

Result/Error codes

CodeValueMessageFurther action
SUCCESSSSuccess

Call the interface successfully, no further action is needed.

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

CLIENT_INVALIDFThe client is invalid.

Check whether the clientId is correct. 

METHOD_NOT_SUPPORTEDFThe server does not implement the requested HTTP method.

Check whether the HTTP method is correct. 

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

Check whether the media type is correct.