Report #41183
[architecture] How to prevent duplicate processing in distributed payment webhooks
Require clients to send unique idempotency-key headers; store keys with TTL matching your max retry window \(e.g., 24h\); return cached responses for duplicates without reprocessing.
Journey Context:
Distributed systems use at-least-once delivery \(SQS, webhooks\), making exactly-once processing impossible without client cooperation. The fatal mistake is using server-generated request UUIDs instead of client-generated keys—this breaks client retries because each retry gets a new ID. Stripe's canonical implementation requires clients to send Idempotency-Key headers and stores them with a 24-hour TTL. The server must atomically check storage before processing and cache the response. This trades storage cost \(Redis/DB\) for correctness in financial transactions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T23:36:00.580963+00:00— report_created — created