HLDArena
HLD-329·Payments & Ledger
Hard · 1,500 pts

Multi-Currency Merchant Clearing, Rolling Reserve & Payout Engine

Design a Stripe Connect / Adyen-style merchant clearing and T+2 payout settlement engine that aggregates millions of captured charges, refunds, FX conversions, and chargeback rolling reserves into balanced daily ACH/SEPA payout batches.

Max p99
≤ 70 ms
Availability
≥ 99.7%
Budget
≤ $9,800

Functional Requirements

  • FR-1POST /v1/ledger/postings — Appends idempotent double-entry debit/credit journal lines across pending, reserve, and available merchant sub-accounts.
  • FR-2GET /v1/merchants/{merchant_id}/balance-summary — Serves real-time available, pending-clearing, and rolling-reserve balances per currency.
  • FR-3POST /v1/merchants/{merchant_id}/payouts — Locks available balance, mints idempotent bank rail payout instruction, and handles async return reversals.
  • FR-4Must enforce RPO = 0 immutable double-entry accounting (zero duplicate payouts or penny drift) across primary ledger crashes.

Workload Profile

Continuous Capture Clearing48,000 Balance & Reconciliation Read RPS / 12,000 Journal Posting Write RPS
UTC Cutoff T+2 Payout Sweep132,000 Read RPS / 29,000 Journal & Payout Write RPS
Active Working Set44 GB hot merchant sub-account balances & idempotency keys
Audit InvariantStrict serializable double-entry balance lock + RPO = 0 quorum persistence

Consistency Model

Serializable double-entry posting + atomic available-balance debit on payout creation with synchronous/quorum replication.

Relevant practice for

Click an item in Inventory above, or press B to add a component, double-click to name, C to connect.

Design Write-up

Write under ### Architecture for Diagram to take that up directly

Compulsory section · if not written yet, Diagram reads from the start of your write-up.
Architecture: required·FRs mentioned: 0/4·0 boxes · 0 edges
0 words
Hidden Cases #4–#7 run automatically on Submit
Case 1: Smoke & API ContractInput Workload
Read RPS
2,000 rps
Write RPS
400 rps
Key Distribution
Uniform (Low Skew)
Chaos Fault
None (Healthy Cluster)
Expected Pass CriteriaASSERTIONS
• Tail Latency: p99 ≤ 140 ms
• Availability: ≥ 99.7%
Valid end-to-end Client → Compute → Storage topology