Idempotent requests
Token Charge supports idempotency so you can retry a charge after a timeout or connection error without charging the card twice.
Send a unique Idempotency-Key on every logical charge attempt (one key per intended bill, not one key per HTTP try). If the first HTTP call times out, repeat the same JSON body with the same key. Coda returns the original outcome instead of creating a second charge.
Init, Inquiry, and webhooks are not covered by this header.
How a safe retry works
Retrying after a timeout
Idempotency-Key header
JWT (iat and exp)
Request body (every field, including orderId and items)
—
JWT idempotencyKey claim
—
The JWT is valid for at most 300 seconds, so sign a new JWT for each retry. Keep everything else the same. If you change the body, Coda treats the request as different.
The response header idempotency-status tells you whether Coda executed the request (executed) or returned the stored result of an earlier request with the same key.
A retry with the same key returns the same txnId as the first request. The card is charged only once.
Generate the key
You generate the key. Coda uses it only to recognise retries of that attempt.
Use a UUID v4 (or another high-entropy random string)
Reuse a key across billing cycles, users, or amounts
Create a new key for every new logical charge
Use email, shopper id, PAN, or other personal data as the key
Persist the key with the attempt until you have a durable result (HTTP response, complete notification, or Inquiry)
Derive the key only from orderId if you might reuse that orderId after 24 hours
Scope: one Idempotency-Key maps to one Token Charge attempt for your account. Treat collisions as a bug in key generation.
Last updated
Was this helpful?