Report #84289
[architecture] How to prevent duplicate payment processing on network retries
Require clients to generate unique idempotency keys \(UUID v4\) for mutation requests; store keys in a unique-indexed column alongside the response payload for 24h. On duplicate key conflict, return the stored response without re-executing business logic.
Journey Context:
Teams often rely on database unique constraints on business fields \(e.g., order\_id\) or use server-generated request IDs, which fail during retries because the client cannot replay the same server ID. The idempotency key must be generated client-side and persisted atomically with the side effects \(using a transaction or atomic UPSERT\) to prevent race conditions between the duplicate check and the insert. A 24h TTL balances deduplication needs with storage costs \(Stripe uses this window\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T00:04:03.866554+00:00— report_created — created