Use idempotency to safely retry a POST payment request when your client is unsure whether the first attempt completed. SmartRetry uses theDocumentation Index
Fetch the complete documentation index at: https://www.smartretry.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Idempotency-Key request header to detect duplicate retries and replay the original result instead of creating a second operation.
Supported endpoints
Idempotency currently applies only toPOST endpoints under /v1/payments/*, including payment, recurring, and future-transaction POST operations.
POSTrequests: supportedGETrequests: ignoredPUTrequests: ignored
Request header
Send anIdempotency-Key header with any POST request you may need to retry.
| Header | Type | Required | Rules |
|---|---|---|---|
Idempotency-Key | string | No | Maximum 255 characters. Allowed characters: letters, numbers, underscore, and hyphen. |
How it works
- Send a POST request with an
Idempotency-Key. - If the request completes with a non-
5xxresponse, SmartRetry stores the original HTTP status and response body for 24 hours. - If you retry with the same key and the same request body during that window, SmartRetry returns the original status and body instead of creating a second operation.
- If you retry with the same key but a different request body, SmartRetry returns
409 Conflict.
Replay preserves the original HTTP status. A repeated request can replay a prior
200, 400, 403, 404, or other cached non-5xx response. 5xx responses are not cached.Response headers
When a keyed POST request is stored or replayed from cache, SmartRetry returns these headers:| Header | Type | Description |
|---|---|---|
Idempotency-Key | string | The key that scoped the request. |
Idempotency-Replayed | string | false on the first cached response, true when SmartRetry replays a stored response. |
Idempotency-Expires | string | ISO 8601 timestamp showing when the cached response expires. |
Errors
| Status | Reason code | When it happens |
|---|---|---|
400 | INVALID_IDEMPOTENCY_KEY | The header is too long or contains unsupported characters. |
409 | IDEMPOTENCY_CONFLICT | The same key was reused with a different request body. |
503 | RESOURCE_LOCKED | Another request with the same key is still in flight and SmartRetry could not obtain the cached result before the wait timeout. |
Example
Best practices
- Generate a fresh
Idempotency-Keyfor every new POST operation. - Reuse the same key only when retrying the exact same request after a timeout, disconnect, or ambiguous client failure.
- Keep
merchant_transaction_idas your own business reference for reconciliation, not as the retry mechanism. - Log the
Idempotency-Keywith your outbound request and SmartRetry response to simplify incident tracing.