How it works
Every payment-creating request (payments, transfers, payouts, deposits, quotes) requires an Idempotency-Key header. Generate a unique key per logical operation — a UUID v4 works well — and reuse the exact same key when retrying that operation. The backend, not the frontend, is the source of truth for whether a payment already succeeded.
Example
curl https://sandbox.amnenpay.com/v1/payments \
-X POST \
-H "Authorization: Bearer sk_test_51H8xExampleSandboxKeyOnly" \
-H "Idempotency-Key: idmp_8f14e45fceea167a5a36dedd4bea2543" \
-H "Content-Type: application/json" \
-d '{ "amount": 2500, "currency": "ETB", "recipient": "rcp_9x8y7z" }'Behaviour
| Scenario | Result |
|---|---|
First request | Processed normally. The result is stored against the key. |
Retry, same key + same body | The original stored response is replayed. No duplicate payment is created. |
Retry, same key + different body | Rejected with 409 conflict — a key cannot be reused for a different request. |
Key expiry | Keys are retained for 24 hours, after which they may be reused. |