Using the X-Idempotency-Key header
Pass an X-Idempotency-Key header on
POST /payments/payment-intent and
POST /payments/refund. The key is any string
you choose that uniquely identifies the operation on your side — an order id,
a refund request id, or a UUID you store alongside the operation.
How keys behave
- Same key, same request — returns the previously created object. The
response is a normal
200, so your retry logic can treat it exactly like a first-time success. - Same key, different request body — rejected. The key is bound to the parameters of the first request; you cannot reuse it to create a different payment intent or refund.
- Scope — keys are scoped to your legal entity and to the endpoint. The
same key string used on
POST /payments/payment-intentand onPOST /payments/refundrefers to two different operations.