Report #71122
[architecture] How to ensure exactly-once processing for payments or inventory in distributed systems
Generate client-side UUID idempotency keys, store processed keys with TTL \(24h\+\), return cached response for duplicates with 409 Conflict or 200 OK
Journey Context:
Teams often rely on database unique constraints alone, which fails when clients retry after network timeouts \(duplicate submissions\). Server-generated keys fail on retries because the client doesn't know the key from the first attempt. The key must be generated client-side \(UUID v4\) and passed in the header \(e.g., Idempotency-Key\). Storage must have TTL to prevent unbounded growth, but TTL must exceed the client's max retry window. Stripe uses 24 hours.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T01:57:32.627769+00:00— report_created — created