Report #96671
[architecture] How to prevent duplicate charges in distributed payment systems
Client generates unique idempotency key \(UUID\) attached to request; server stores key with TTL and skips processing if seen, returning the original response body for duplicates
Journey Context:
Many implement server-side dedup using request hashes or timestamps, which fails across retries with network timeouts. The key insight is the client must generate the key \*before\* the first attempt, not after failure. Stripe uses 24h TTL, rejects keys > 24h old, and returns 409 Conflict on duplicate keys while returning the original response body \(not just error\) to ensure idempotency of the read as well. Server-side generation or hashing the payload fails when the client retries with a slightly different timestamp or encoding.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T20:50:50.859397+00:00— report_created — created