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

Refund

After a payment is completed, you can issue a refund via the refund API or Alipay Global Merchant Portal if your buyer demands a refund.

Before issuing a refund, you must be familiar with the following information:

  • Commission fee: Whether the commission fee is returned is subject to the contract.
  • Refund exchange rate: For cross-currency settlement which applies when the transaction currency differs from the settlement currency, the Alipay exchange rate on the day after the refund is issued is applied.
  • Partial refund: Whether a partial refund is allowed depends on the payment method that the buyer used for a payment. For details, see Refund capabilities of payment methods.
  • Minimum refundable amount: The minimum refundable amount depends on the payment method that the buyer used for a payment. For details, see Refund capabilities of payment methods.
  • Refund period: The refund period depends on the payment method that the buyer used for a payment. For details, see Refund capabilities of payment methods.

Refund using API

You can use APIs to initiate a refund and obtain refund results. The following figure illustrates the workflow of the refund process:

001.png

Figure 1. Refund workflow

Initiate a refund

The following requirements about a refund request must be satisfied when you use the refund API. Otherwise, the corresponding error codes are to be returned by Alipay:

Item

Requirement

Error code

Refund currency

The value of the parameter refundAmount.currency in the refund request needs to be consistent with the value of the parameter paymentAmount.currency used for initiating a payment.

CURRENCY_NOT_SUPPORT

Refund amount

The value of the parameter refundAmount.value in the refund request needs to be no less than the minimum refund amount (which is usually the same as the minimum payment amount) and no greater than the refundable amount of a payment.

REFUND_AMOUNT_EXCEED

Payment status

The refund is allowed only when the value of the paymentStatus parameter is SUCCESS.

ORDER_STATUS_INVALID

Refund period

The refund is allowed only when the refund is issued within the refund window of the corresponding payment method.

REFUND_WINDOW_EXCEED

To-be-settled balance of the merchant's account

Alipay deducts funds from the to-be-settled balance of the merchant's account for a refund. The refund fails if the balance is insufficient. If the contract specifies that the commission fee is not returned, the full refund of the first payment fails. Therefore, it is recommended that you keep a sufficient balance in your account before you test in a production environment.

MERCHANT_BALANCE_NOT_ENOUGH

Table 1. Requirements about a refund request

The key parameters contained in refund requests are listed as follows (For details, see the refund API):

Parameter

Description

refundRequestId

The unique identifier that you assign to a payment.

paymentId

The unique identifier that Alipay assigns to the original payment to be refunded.

refundAmount

The refund amount must be no less than the minimum refund amount (which is usually the same as the minimum payment amount) and no greater than the refundable amount of a payment.

refundNotifyUrl

The URL for receiving asynchronous refund notifications.

Table 2. Key parameters of refund requests

Obtain the refund result

After you call the refund API, Alipay synchronously returns the refund result:

  • If the value of result.resultStatus in the response is S, the refund is successful.
  • If the value of result.resultStatus is F, the refund failed. See Error codes of the refund API for troubleshooting.
  • If the response is not received due to network issues or the value of result.resultStatus is U, you can call the inquiryRefund API to inquire about the refund status. The refund status is indicated by the refundStatus parameter in the response. The following table shows the possible values of the refundStatus parameter:

refundStatus

Description

SUCCESS

The refund is successful.

PROCESSING

The refund is being processed (which also occurs when the error code is MERCHANT_BALANCE_NOT_ENOUGH).

FAIL

The refund fails.

Table 2. Explanation of refundStatus

Inquire about the refund records

You can view the refund records of a transaction by using the inquiryRefund API. If a transaction has been refunded, the parameter transactions shows the refund records of the transaction.

Refund in Alipay Merchant Portal

You can issue a refund on Alipay Merchant Portal. For more information about how to issue a refund and view the refund result, see Refund transactions on Alipay Merchant Portal.