Idempotency
Network failures happen. Idempotency keys make any POST safe to retry — if you replay the same request with the same key, you get the exact same response without creating duplicate records.
How to use
bash
curl -X POST https://api.minnha.pay/api/v1/sessions \
-H "X-Api-Key: mp_test_..." \
-H "Idempotency-Key: 6f1b…-c4a3" \
-H "Content-Type: application/json" \
-d '{"amount": 199.50, "currency": "SAR"}'The Node SDK exposes this per-request:
ts
await minnha.sessions.create(
{ amount: 199.5, currency: "SAR" },
{ idempotencyKey: orderId } // e.g. UUID, or "ord_123"
);What counts as "same"?
- Same key + same body → returns the cached response.
- Same key + different body → returns
409 Conflict. - Different key → creates a new record.
Use your own business identifiers (order ID, attempt counter) as the key. UUIDs work but are harder to debug because they hide intent.
Scope & TTL
Idempotency keys live for 24 hours per merchant. After that the key is forgotten and a replay creates a new record.