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

notifyRefund

POST /undefined

Alipay uses notifyRefund to send the refund result to the merchant when the refund processing reaches a final state of success or failure. Merchants promote merchant-side transactions based on the refund result.

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

notifyType String  REQUIRED

The type of the refund status notification. The valid value is:

  • REFUND_RESULT: Indicates that the notification is about the refund result.

result Result object REQUIRED

The details about the refund result, such as refund status, result code, and result message.

Show child parameters

refundStatus String  REQUIRED

Indicates the refund result. Valid values are:

  • SUCCESS: Indicates that the refund succeeded. 
  • FAIL: Indicates that the refund failed. 

refundRequestId String  REQUIRED

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

More information about this field

  • Maximum length: 64 characters

refundId String  REQUIRED

The unique ID that is assigned by Alipay to identify a refund. A one-to-one correspondence between paymentId and paymentRequestId exists.

More information about this field

  • Maximum length: 64 characters

refundAmount Amount object REQUIRED

The refund amount that is initiated by the merchant.

Show child parameters

refundTime Datetime  

The date and time when the refund reaches a final state of success or failure.

Note: This field is returned when the refund succeeds (the value of result.resultStatus is S).

grossSettlementAmount Amount object 

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 object 

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

Show child parameters

Response parameters

result Result object REQUIRED

A fixed value, which is sent to Alipay to acknowledge that the notification is received.

Show child parameters
API Explorer

Request

Request Body

Response

Response Body

Result process logic

Send the following message with fixed values to Alipay after receiving the notification, to acknowledge that the notification from Alipay is received:

Sample Code

If no such message is returned to Alipay due to operation issues or network issues, Alipay will resend the notification until the required message is returned by the merchant. Resending of the notification will be performed within 24 hours after the first notification is sent. The notification will be resent up to eight times, with an interval of 0s, 2min, 10min, 10min, 1h, 2h, 6h, and 15h.

Result/Error codes

CodeValueMessageFurther action
SUCCESSSSuccess

The refund is successful, no further action is needed.

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.  

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. 

CURRENCY_NOT_SUPPORTFThe currency is not supported.

Contact Alipay Technical Support for detailed reasons. 

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 Antom Dashboard.

Check whether the private key used to sign a request matches the public key of Antom Dashboard. 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 Antom Dashboard.

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_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.

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.

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 transaction is closed and cannot be paid again.

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

REFUND_IN_PROCESSUThe refund is being processed.

Wait for the asynchronous notification or call the inquiryRefund interface to query the final refund status. Do not retry the refund request. 

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.