Skip to main content

Idempotency

Create operations (for example: transactions, refunds, and chargebacks) support idempotency. Idempotency lets you safely retry a request without accidentally performing the same operation twice.

How it works​

To make an idempotent request, include an Idempotency-Key header. The value should be a unique identifier for the resource you are creating (for example, a UUID).

  • If the Idempotency-Key is set and there is a non-expired key (<= 24 hours), we return the resource previously created with this key.
  • If the Idempotency-Key is set and there is an expired key (> 24 hours), we create a new resource and store the key with the request.
  • If the Idempotency-Key is set and there is no existing record with the same key, we create a new resource and store the key with the request.
  • If the Idempotency-Key is not set, we create a new resource without idempotency protection. In this case, you are responsible for ensuring duplicate requests are not sent for the same resource.

Recommendation​

Always use idempotency for operations you may retry due to network issues, timeouts, or 5xx responses.