Report #43893
[architecture] Preventing duplicate payment webhooks in distributed systems
Require client-generated UUID idempotency keys and store them in Redis with TTL \(2x your max retry window\), not the primary database; reject duplicate keys before processing business logic
Journey Context:
Teams often rely on database unique constraints on transaction IDs, but this fails when clients retry with new request IDs for the same logical operation, and it creates write amplification \(two writes per operation\). Storing keys in the application database doubles latency and storage growth for high-throughput APIs. Redis provides sub-millisecond lookups and automatic expiration. The key insight: the idempotency key must be generated by the client for the logical operation \(e.g., 'charge-customer-123-for-order-456'\), not the server for the request, and must be checked atomically before any business data is modified.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T04:08:55.390072+00:00— report_created — created