Skip to main content
Network calls fail in ways you can’t tell apart from the client: a request may time out after the server created a payment but before you got the response. Retrying blindly would create a second charge. Idempotency keys make a retry safe — the server recognises the repeat and returns the original response instead of executing the request again.

How it works

Send an Idempotency-Key header on any POST request:
  • The first request with that key runs normally; its response (status + body) is stored.
  • Any retry with the same key short-circuits and returns that stored response verbatim — same status code, same body — without re-executing. No second payment, no second subscription.
The key is optional — omit it and the endpoint behaves exactly as before. We strongly recommend sending one on every state-changing POST (payments, subscriptions, setup-intents, checkout sessions, refunds…).

Choosing a key

  • Generate a unique value per logical operation — a UUID v4 is ideal.
  • Reuse the same key when you retry that operation, and a new key for a genuinely new operation.
  • Max length 255 characters.

Scope & lifetime

Responses to a repeat

Server errors (5xx) are not cached: the key is released so you can safely retry the operation. Client outcomes (2xx and 4xx) are cached and replayed.

Idempotency-Key vs. externalRef

These are different tools — don’t conflate them:
  • Idempotency-Key (header) — a per-request token whose only job is to deduplicate a retried HTTP call. Unique per attempt, expires in 24 h.
  • externalRef (body field on POST /v3/payments) — your business reference (an order id) for reconciliation and lookup. It can legitimately appear on several payments (e.g. a retried order after a decline) and is not used for deduplication.
Use Idempotency-Key to make retries safe; use externalRef to tie a payment back to your own records.