Idempotency-Key header solves this: with it, retrying the same request is always safe.
How it works
Send a unique identifier per operation in theIdempotency-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.