Idempotency
Safe retries with Idempotency-Key on create and cancel.
Idempotency
Every request that creates or moves money accepts an Idempotency-Key header. Send a unique value (a UUID is fine) per logical operation. If a request is retried with the same key, the original response is replayed instead of the operation running twice.
POST /v1/transfers is the exception: it does not use this header. Its body reference_id makes retries safe. See Transfers.
Use this on every other create call. Network timeouts do not tell you whether the request succeeded, and retrying without a key can create duplicate payment links.
Rules
| Rule | Detail |
|---|---|
| Scope | Per API key |
| Retention | 24 hours |
| Replay header | Idempotent-Replayed: true on replayed responses |
| Same key, different body | 422 (idempotency_key_reused) |
| Original still running | 409 (idempotency_request_in_progress) — retry after a short delay |
| 5xx responses | Not stored — retrying runs the request again |
Example
curl -X POST https://stggateway-sandbox.momen.co/v1/payment-links \-H "Authorization: Bearer sk_test_YOUR_KEY" \-H "Content-Type: application/json" \-H "Idempotency-Key: 8f14e45f-ceea-467a-9575-8f14e45fceea" \-d '{ "amount": 150000, "title": "Invoice #1042"}'reference_id is not used for idempotency. Use Idempotency-Key for that.