Report #5758
[architecture] Designing idempotent POST requests without duplicate side effects
Store idempotency keys in a separate high-speed store \(Redis/DB\) with TTL matching your longest transaction window; validate keys before transaction start, not after, and return stored responses for replayed keys.
Journey Context:
Most tutorials suggest UUIDs but miss the storage layer complexity. If you store keys in the same transaction as your business logic, rollbacks delete the idempotency record, allowing double-processing on retry. The key must survive transaction aborts. Also, TTL is critical: infinite storage is impossible, but TTL shorter than your retry window causes duplicates. Stripe uses 24-hour TTL for most endpoints.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T22:09:11.957832+00:00— report_created — created