Skip to main content
Timeouts and network failures leave a dangerous question: was the payment created or not? Retrying blindly can produce two charges for the same order. The Idempotency-Key header solves this: with it, retrying the same request is always safe.

How it works

Send a unique identifier per operation in the Idempotency-Key header of the creation endpoint:
The key’s scope is your project — keys from different projects never collide. Use up to 256 characters; a UUID or your order ID are good choices.

With the Node.js SDK

The SDK sends a key automatically (a UUID per call) and, thanks to it, performs a safe retry on timeout, network failure, 429, and 5xx:

Best practices

  • Generate a new key per business operation (per order, per charge attempt) — never reuse a fixed key.
  • When retrying after a timeout, use the same key as the original attempt.
  • The replay window is 1 hour — after that, the same key creates a new transaction.
  • Idempotency complements (does not replace) the payment method’s deduplication rules. Don’t use a fixed key for all orders.

Next steps

Errors

See which responses call for a retry and which call for a fix.

Create a charge

Send the Idempotency-Key header when creating the transaction.