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

Idempotency

If a request timeout error occurs when you call an API, you might attempt to resend the request. In this case, you can configure the specified idempotency fields in the request to help avoid unwanted duplication in case of failures and retries.    

An API call is idempotent if it has the same result no matter how many times the API call is applied. For example, idempotency can guarantee that the payment is charged only once if the same API payment call is retried multiple times in the case of a timeout error. You can retry the request via using the same idempotency field to guarantee that no more than one charge is created.

Idempotency fields

The following table lists the idempotency fields of specific OpenAPIs.  

API name

Idempotency field

Rule

initAuthentication

authenticationRequestId

Merchant uses the authenticationRequestId field for idempotency control. For initAuthentication requests that are initiated with the same value of authenticationRequestId and reach a final status (S or F), the same result is to be returned for the request.

registerCustomerWithProduct

applyRequestId

Merchant uses the applyRequestId field for idempotency control. For registerCustomerWithProduct requests that are initiated with the same value of applyRequestId and reach a final status (S or F), the same result is to be returned for the request.

modifyAuthentication

authenticationRequestId

Merchant uses the authenticationRequestId field for idempotency control. For modifyAuthentication requests that are initiated with the same value of authenticationRequestId and reach a final status (S or F), the same result is to be returned for the request.

modifyCustomer

requestId

Merchant uses the requestId field for idempotency control. For modifyCustomer requests that are initiated with the same value of requestId and reach a final status (S or F), the same result is to be returned for the request.

addPaymentMethod

requestId

Merchant uses the requestId field for idempotency control. For addPaymentMethod requests that are initiated with the same value of requestId and reach a final status (S or F), the same result is to be returned for the request.

removePaymentMethod

requestId

Merchant uses the requestId field for idempotency control. For removePaymentMethod requests that are initiated with the same value of requestId and reach a final status (S or F), the same result is to be returned for the request.

applyTopup

requestId

Merchant uses the requestId field for idempotency control. For applyTopup requests that are initiated with the same value of requestId and reach a final status (S or F), the same result is to be returned for the request.

Note: This API checks the consistency of some key request parameters such as requestId, topupAmount, and topupMethodId if applicable. If any of the key values is different from that of the previous request, the error REPEAT_REQ_INCONSISTENT is to be returned.