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

Inquire about refund status

To obtain the refund result, you can either wait for the refund response or actively call the inquiryRefund API to inquire about the refund result. Usually, when you encounter one of the following cases, call the inquiryRefund API to get the refund result:

  • No clear refund result is obtained because of a time-out.
  • When the user consults about the refund result.

Request

If the domain name is open-na.alipay.com, the request URLs for the inquiryRefund API are as follows:

  • Sandbox environment: https://open-na-global.alipay.com/ams/sandbox/api/v1/payments/inquiryRefund
  • Production environment: https://open-na-global.alipay.com/ams/api/v1/payments/inquiryRefund

You can use refundId or refundRequestId to initiate the inquiryRefund request. If the refund times out and refundId cannot be obtained, use the refundRequestId field to send the inquiryRefund request. If refundId is obtained, it is recommended to use the refundId field. If both refundId and refundRequestId are specified, refundId takes precedence. The following example shows an inquiryRefund request with the refundId field specified.

copy
{     "refundId": "2021080419401080130018866020092XXXX" }

Response

The following example shows a response to an inquiryRefund request. The refund result is presented in the refundStatus field.

copy
{
    "refundAmount": {
        "currency": "HKD",
        "value": "10000"
    },
    "refundId": "2021080419401080130018866020092XXXX",
    "refundRequestId": "amsdemorefund_zhangsan_zs_20210804_165236_XXX",
    "refundStatus": "SUCCESS",
    "refundTime": "2021-08-04T01:52:37-07:00",
    "result": {
        "resultCode": "SUCCESS",
        "resultMessage": "success.",
        "resultStatus": "S"
    }
}

The result field only indicates the call status of this inquiry request. It does not indicate the refund status. The following values might be returned:

  • S: indicates that the inquiryRefund API call was successful and the payment status can be obtained from the value of refundStatus.
  • F: indicates that the inquiryPayment API call failed, which might be caused by a system error or invalid parameters.
  • U: indicates that the call status of the inquiryPayment API is unknown. Use the same request parameters to retry the inquiry request.

The refund result is indicated by the refundStatus field. This field is only returned when the value of result.resultStatus is S or the refund record can be found. The value of this field can be:

  • SUCCESS: This value indicates the refund was successful.
  • PROCESSING: This value indicates that the refund is still processing. When this value is returned, you can retry the refund API.