Idempotent checkout and payment recovery
Models duplicate submissions and uncertain payment outcomes without treating a timeout as a decline. Original worked design example; adapt responsibilities, thresholds and assumptions to your system.
Rendering…
What this template contains
- Diagram type
- Sequence diagram
- Source
- 27 lines
Make it your own.
sequenceDiagram
participant C as Customer
participant A as Checkout API
participant D as Order store
participant P as Payment provider
C->>A: Submit order with idempotency key
A->>D: Insert pending order if key is new
alt Key already completed
D-->>A: Existing order and payment status
A-->>C: Return original confirmation
else Key is still pending
D-->>A: Existing pending operation
A-->>C: Pending, query status without reauthorizing
else New request
A->>P: Authorize amount using same key
alt Authorization confirmed
P-->>A: Authorization reference
A->>D: Commit confirmed order
A-->>C: Order confirmed
else Response timeout
A->>D: Mark payment outcome unknown
A-->>C: Pending reconciliation
A->>P: Query authorization by key
P-->>A: Definitive status
A->>D: Reconcile without charging twice
end
end