HLD-319·Payments & Ledger
Hard · 1,500 ptsGlobal Card Payment Authorization & Idempotent Retry Engine
Design Stripe’s `Idempotency-Key` payment intent state machine ensuring client network retries NEVER double-charge a card even under database failover.
Max p99
≤ 115 ms
Availability
≥ 99.5%
Budget
≤ $8,600
Functional Requirements
- FR-1POST /v1/payment_intents — Atomically acquires idempotency_key lock, executes state transition, and caches response.
- FR-2GET /v1/payment_intents/{intent_id} — Returns authoritative authorization/capture status.
- FR-3POST /v1/payment_intents/{idempotency_key}/reverse — Supports idempotent reversal/refund or campaign pause updates while keeping cached balances and deduplication keys consistent.
- FR-4Zero duplicate charges on concurrent retries and zero lost authorizations on primary DB crash (RPO = 0).
Workload Profile
Baseline Checkout Load34,000 Status Read RPS / 7,500 Charge Write RPS
Cyber Monday Peak88,000 Read RPS / 24,000 Concurrent Charge RPS
Active Working Set26 GB 24-hour idempotency keys & active payment intents
Consistency GateStrict serializable idempotency CAS + RPO = 0 quorum durability
Consistency Model
Strict serializable `idempotency_key` lease/CAS + synchronous/quorum durability; zero double-charges.
Solutions Locked
Sign in and either achieve AC or complete 3 official submissions on this question to inspect community diagrams and writeups.
Loading solutions...
Submission History (0)Select to replay
No submissions yet
Click Submit in the top bar to evaluate against all 7 judge cases and save each run here.
Design Write-up
0 boxes · 0 edges
0 words