Report #58371
[architecture] How to prevent duplicate payments or charges on network retry
Require client-generated idempotency keys \(UUID v4\) on all mutable endpoints; store keys with TTL \(24h\) and the resulting response payload; if key exists, return cached response instead of re-processing.
Journey Context:
Developers often think database unique constraints or UUID primary keys prevent duplicates, but retries create new requests. The key must be client-generated \(not server\) to span across the retry loop. Storing in Redis with expiration vs the main DB is a tradeoff: Redis is faster but adds infrastructure; DB is slower but transactional. Stripe's 24-hour window is the industry standard—long enough for retries, short enough to manage storage.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T04:28:00.043077+00:00— report_created — created