DOCUMENTRFC-012
RFC — Idempotent order creation
A proposal to make POST /orders safe to retry under network failure.
Clients retry POST /orders on timeouts, occasionally creating duplicate orders. We
need creation to be safe to retry without double-charging.
SECTION 01 · Hierarchy
Why duplicates happen
MECE
RFC — Idempotent order creation2 / 6
ADedup by cart hash
Reject if an identical cart exists recently.
- False positives on real re-orders
REJECTED
BIdempotency key
Client sends a key; server stores the first result.
- Exactly-once semantics
- Standard pattern
CHOSEN
RFC — Idempotent order creation3 / 6
Proposed design
03 · Architecture
SECTION 03 · Architecture
Idempotency layer
ARCH
RFC — Idempotent order creation4 / 6
SECTION 04 · Flowchart
First call vs. retry
FLOW
RFC — Idempotent order creation5 / 6
| Task | Status | Priority |
|---|
| Agree the Idempotency-Key header contract with clients | todo | high |
| Pick the store TTL (24h?) and eviction policy | todo | med |
RFC — Idempotent order creation6 / 6