Back to sketch

SYSTEM DESIGN SKETCHBOOK / PRACTICE SHEET / NO. 47

Design a wire transfer API with a ledger

Expert · 50 min · Payments & ledgers

Business customers of a banking platform hold balances, move money instantly between accounts on the platform, and send outgoing wires to other banks. Treasury and auditors need to account for every cent, and customers want to know exactly where a wire is.

Requirements

  • Create a transfer (internal account to account, or an outgoing wire to an external bank) with an idempotency key; a retried request never moves money twice.
  • Record every money movement as balanced double-entry postings and expose both the ledger balance and the available balance.
  • Place a hold on funds when an outgoing wire is created; settle it when the rail confirms, release it if the wire is rejected.
  • Expose transfer status (pending, submitted, completed, returned, failed) and a statement of postings per account.
  • Reconcile daily against the partner bank's statements.

Constraints and assumptions

  • 5 million accounts; 300 transfer requests per second at peak, mostly internal.
  • 50,000 outgoing wires per day, submitted to a partner bank in batches before fixed cutoff times; confirmation takes minutes to hours, and a wire can be returned days later.
  • An account's available balance must never go below zero unless it has an approved overdraft limit.
  • One large corporate account can make 50 transfers per second.
  • History is immutable and kept for 7 years.

Out of scope for the first sketch

Sanctions and fraud screening internals (assume a screening call that answers approve, deny or review) · Foreign exchange · Customer onboarding and identity checks · Interest and fees

Draw your design

Rough math and notes

Done on paper? Compare with the worked approaches