Alipay+ DocsAlipay+ Docs
APIs & SDKs

refundACQP → Alipay+

POST /aps/api/v1/payments/refund

The Acquiring Partner (ACQP) uses the refund API to initiate a refund of a successful payment. 

The refund can be full or partial. A transaction can have multiple refunds as long as the total refund amount is less than or equal to the original transaction amount. If being out of the refund window, the refund request will be declined. The refund window is usually within one calendar year. Use the same refundRequestId parameter to retry a refund in case of timeout or when the returned resultStatus is U. The refundRequestId parameter is designed to be idempotent. 

Note: In the following sections, Mobile Payment Provider (MPP) is also known as PSP. For example, pspId refers to the ID that identifies an MPP.


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 request ID of the payment to be refunded, assigned by the ACQP to identify the original payment order.

Note: Required if the value of the paymentId parameter is empty. 

More information:

  • Maximum length: 64 characters

paymentId String  

The ID of the payment to be canceled, assigned by Alipay+ to identify the original payment order.

Note: Required if the value of the paymentRequestId parameter is empty. 

More information:

  • Maximum length: 64 characters

refundRequestId String  REQUIRED

The unique ID that is assigned by the ACQP to identify a refund request. 

More information:

  • This field is an API idempotency field.For refund requests which are initiated with the same refundRequestId, Alipay+ regards the requests as repeated and processes the requests only once. If the values for the other parameters in repeated requests are different, Alipay+ returns the REPEAT_REQ_INCONSISTENT result code.
  • Maximum length: 64 characters

refundAmount Amount object REQUIRED

The refund amount that is paid by Alipay+ for this refund.

Note: The value of the refundAmount.currency parameter must be the same as the value of the paymentAmount.currency parameter of the original payment order.  

Show child parameters

refundReason String  

The reasons for the refund.

Note: You can specify the reason for the refund that the user provided to the merchant. 

More information:

  • Maximum length: 256 characters

Response parameters

result Result object REQUIRED

The refund result. If this API is successfully called, the refund succeeds. See Result processing logic for details. 

Show child parameters

acquirerId String  

The unique ID that is assigned by Alipay+ to identify an ACQP.

Note: Returned if the refund succeeds (the value of the result.resultCode parameter is SUCCESS). 

More information:

  • Maximum length: 64 characters

pspId String  

The unique ID that is assigned by Alipay+ to identify an MPP.

Note: Returned if the refund succeeds (the value of the result.resultCode parameter is SUCCESS). 

More information:

  • Maximum length: 64 characters

refundId String  

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

Note: Returned if the refund succeeds (the value of the result.resultCode parameter is SUCCESS). 

More information:

  • Maximum length: 64 characters

refundTime Datetime  

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

Note: Returned if the refund succeeds (the value of the result.resultCode parameter is SUCCESS). 

More information:

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

refundAmount Amount object 

The refund amount that is paid by Alipay+ for this refund. 

Note: Returned if the refund succeeds (the value of the result.resultCode parameter is SUCCESS). 

Show child parameters

settlementAmount Amount object 

The gross amount that Alipay+ settles to the ACQP for this refund. If the settlement currency is different from the currency specified by paymentAmount, the value is calculated based on paymentAmount and settlementQuote.

Note: Returned if the refund succeeds (the value of the result.resultCode parameter is SUCCESS). 

Show child parameters

settlementQuote Quote object 

The exchange rate between the settlement currency and the payment currency.

Note: Returned by Alipay+ if the refund succeeds and the value of the settlementAmount.currency parameter is different from the value of the paymentAmount.currency parameter. 

Show child parameters
API Explorer
Sample CodesRun in Sandbox

Request

URL
Request Body

Response

Response Body

More information

Refund amount and payment amount:

The value of the refundAmount.currency parameter must be the same as the value of the paymentAmount.currency parameter of the original payment. 

Partial refunds:

  • If multiple refunds exist for a particular payment, the total refund amount must not exceed the value of paymentAmount of the original payment.
  • For some currencies, such as the Indonesian rupiah (IDR), partial refunds are not allowed. For partial refunds, PARAM_ILLEGAL is returned. 

Result processing logic

For different results returned by Alipay+, take actions as below:

result.resultStatus

result.resultCode

Refund status

Actions

S

SUCCESS

Suceeded

Update the status from the merchant side.

F

...

Failed

Take actions according to the error message in the result.resultMessage parameter.

U

...

Unknown

Use the same parameters to retry the refund request. It is recommended to keep trying for at least 1 hour. If you keep receiving the same result indicating the unknown status, contact connect_support@service.alipay.com.

No result received after trying several times

Unknown

Contact connect_support@service.alipay.com.

Result/Error codes

CodeValueMessageFurther action
SUCCESSSSuccess

Update the status from merchant side.

ACCESS_DENIEDFAccess is denied.

It is recommended that you contact connect_support@service.alipay.com to troubleshoot the issue.

CURRENCY_NOT_SUPPORTFThe refund currency is not the same as the currency of the original payment.

Try the refund in the currency of the original payment, which is the value of the paymentAmount.currency parameter in the pay API.

INVALID_CLIENTFThe client is invalid.

It is recommended that you contact connect_support@service.alipay.com to troubleshoot the issue.

INVALID_ORDER_STATUSFThe order status is invalid for this operation.

Check the status of the original payment by using the inquiryPayment API or the notifyPayment. Only successful payments can be refunded. If the order status is success, contact connect_support@service.alipay.com to troubleshoot the issue.

INVALID_SIGNATUREFThe signature is invalid.

Check whether the public key, signed message, and signature algorithm are as expected.

KEY_NOT_FOUNDFThe key is not found.

It is recommended that you contact connect_support@service.alipay.com to troubleshoot the issue.

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

Use a media type that is accepted by Alipay+.

METHOD_NOT_SUPPORTEDFThe server does not implement the requested HTTPS method.

Ensure the HTTP method is POST.

NO_INTERFACE_DEFFAPI is not defined.

Check whether the request URL is correct. Ensure that the endpoint of the called API is correct.

ORDER_NOT_EXISTFThe order doesn't exist.

The original payment does not exist. Check the payment status manually. If the payment does exist, contact connect_support@service.alipay.com to troubleshoot the issue.

PARAM_ILLEGALFIllegal parameters. For example, non-numeric input, invalid date.

Check whether the request parameters, including the header parameters and body parameters, are correct and valid. For more information about the parameters of each API, see the Structure section of the specific API reference topic.

PROCESS_FAILFA general business failure occurred. Do not retry.

It is recommended that you contact connect_support@service.alipay.com to troubleshoot the issue.

REFUND_AMOUNT_EXCEEDFThe total refund amount exceeds the payment amount.

Instruct the user to retry the refund with an amount that is not greater than the original payment amount.

REFUND_AMOUNT_INVALIDFRefund amount is invalid.

Instruct the user to retry the refund with an amount that is high enough. For example, if the refund currency is JPY and the settlement currency is USD, the refund amount cannot be 1 JPY because the amount in USD would be rounded to 0. 

REFUND_WINDOW_EXCEEDFExceed Refund window.

N/A

REPEAT_REQ_INCONSISTENTFRepeated requests are inconsistent.

Ensure the fields in the requests are the same.

USER_AMOUNT_EXCEEDFThe user balance exceeds the balance limit.

It is recommended that you contact connect_support@service.alipay.com to troubleshoot the issue.

REQUEST_TRAFFIC_EXCEED_LIMITUThe request traffic exceeds the limit.

Reduce the frequency of API calls.

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

Try to recall the API.