Report #70579
[architecture] Handling duplicate API requests safely \(payment webhooks, form submissions\)
Generate a UUID client-side and send as Idempotency-Key header; server stores key→response mapping \(TTL 24h\); on duplicate key, return cached 200/409 without re-executing business logic
Journey Context:
Network timeouts cause clients to retry POSTs, leading to double-charges or duplicate records; server-generated IDs require coordination; client-generated UUIDs allow safe retries without locks; must distinguish between 'key exists with different payload' \(409\) vs 'same payload' \(200\); storage must be transactional \(INSERT ON CONFLICT\) to avoid race conditions; TTL prevents unbounded growth
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T01:03:08.405800+00:00— report_created — created