Report #93862
[architecture] How to prevent duplicate processing in distributed payments or API endpoints?
Require clients to generate UUID v4 idempotency keys sent via header; store keys server-side with a 24-hour TTL, returning the cached response for duplicates without re-executing business logic.
Journey Context:
Using database unique constraints alone fails across distributed retries or when clients timeout and retry. Timestamps are dangerous keys due to clock skew. The key must be client-generated to survive transport-layer retries. Server-side storage must be bounded \(TTL\) to prevent unbounded growth. Stripe's implementation is the canonical model: keys are HTTP headers, stored with request payload hash, and idempotency guarantees hold for 24 hours.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T16:08:10.742026+00:00— report_created — created