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 idempotent 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 using the same idempotent field to guarantee that no more than one charge is created.

Idempotent fields

The following table lists the idempotent fields of specific APIs.

API name

Idempotent field

Rule

syncStore

requestId

This field is an idempotent field.

For the syncStore requests that are initiated with the same requestId value, D-Store must return the same result.

syncProduct

requestId

This field is an idempotent field.

For the syncProduct requests that are initiated with the same requestId value, D-Store must return the same result.

createOrder

requestOrderId

This field is an idempotent field.

For the createOrder requests that are initiated with the same requestOrderId value, POS providers must return the same result.

notifyOrderChange

requestId

This field is an idempotent field.

For the notifyOrderChange requests that are initiated with the same requestId value, D-Store must return the same result.

pushOrderChange

requestId

This field is an idempotent field.

For the pushOrderChange requests that are initiated with the same requestId value, POS providers must return the same result.