Design a Digital Wallet (Venmo, Cash App)

Quick Overview

A system design question about building a digital wallet that holds balances, moves money between users, and transfers funds to and from external bank accounts. It tests ledger design, idempotent payment APIs, transfers across database shards, and reconciliation of slow, unreliable bank settlements.

Design a Digital Wallet (Venmo, Cash App)

Role: Software Engineer

Category: System Design

Difficulty: hard

Interview Round: Other

Design a digital wallet similar to Venmo or Cash App. Users keep a balance in the app, send money to each other, and move money between the wallet and their external bank accounts. The system must support: 1. Internal transfers: users can send money instantly to other users of the wallet. 2. Funding and withdrawal: users can load money from a linked bank account or cash out to it. 3. Balance inquiry: users can view their current available funds. 4. Transaction feed: users can view a chronological feed of their past activity and social transactions. State the non-functional requirements you would design for, then walk through the data model, the API and the high-level design. After that, go deeper on three areas: how you prevent database deadlocks when concurrent P2P transfers lock wallet rows, how a transfer stays correct when the sender's and receiver's wallets live on different database shards, and how the system reaches a correct final state when the bank's confirmation webhook for a deposit never arrives. ```hint Source of truth for a balance If a bug corrupts one wallet's balance, what record would let you prove what the balance should be? A single mutable balance column cannot answer that. ``` ```hint Retries and duplicates A phone loses signal right after the user taps Pay, and the app retries. Work out what makes the retry recognizable as the same payment, and where that check has to live so it survives a cache failover. The same question applies to every queue consumer that may see a message twice. ``` ```hint Two shards, no shared transaction One database transaction cannot span two shards. Ask what you can commit atomically on the sender's shard alone, and how the rest of the transfer gets finished or undone later. ``` ### Constraints & Assumptions - 100M+ users, with peaks of 10,000+ transfers per second. - Bank transfers take 1-3 business days to clear, and the bank reports the outcome asynchronously by webhook. ### Clarifying Questions to Ask - Must the receiver see the money the moment the sender taps Pay, or is a short delay acceptable as long as the sender is debited immediately? - Can a user spend a bank deposit before the bank confirms it? - Is each transfer in a single currency, or do wallets in different currencies need conversion? - Who can see a transaction in the feed: only the two parties, or their friends as well? - How far behind the ledger may the feed and the notifications fall? ### What a Strong Answer Covers - Which operations need strong consistency and which can be eventually consistent, with scale and latency targets stated. - A ledger from which every balance can be rebuilt and audited, and how a cached balance is kept in step with it. - Idempotency from the client request through every asynchronous consumer, including where the durable duplicate check lives. - The locking strategy and deadlock avoidance, and how a transfer between two shards commits, retries and compensates on failure. - External funding and withdrawal as a tracked lifecycle, with reconciliation for lost webhooks and failed bank transfers. ### Follow-up Questions - A charity wallet receives thousands of transfers per second during a fundraiser. How do you keep its row from becoming a lock hotspot? - How would you detect money-laundering patterns such as many small accounts funneling money into one account? - How would you let a user pay a merchant when the phone has no network connection? - A bank deposit that already showed as complete is returned by the bank days later, after the user spent the money. How does the ledger handle it?

Overview: A system design question about building a digital wallet that holds balances, moves money between users, and transfers funds to and from external bank accounts. It tests ledger design, idempotent payment APIs, transfers across database shards, and reconciliation of slow, unreliable bank settlements.

PracHub logo
General
Nov 24, 2026
hardSoftware EngineerOtherSystem Design
0
0

Design a digital wallet similar to Venmo or Cash App. Users keep a balance in the app, send money to each other, and move money between the wallet and their external bank accounts.

The system must support:

  1. Internal transfers: users can send money instantly to other users of the wallet.
  2. Funding and withdrawal: users can load money from a linked bank account or cash out to it.
  3. Balance inquiry: users can view their current available funds.
  4. Transaction feed: users can view a chronological feed of their past activity and social transactions.

State the non-functional requirements you would design for, then walk through the data model, the API and the high-level design. After that, go deeper on three areas: how you prevent database deadlocks when concurrent P2P transfers lock wallet rows, how a transfer stays correct when the sender's and receiver's wallets live on different database shards, and how the system reaches a correct final state when the bank's confirmation webhook for a deposit never arrives.

Constraints & Assumptions

  • 100M+ users, with peaks of 10,000+ transfers per second.
  • Bank transfers take 1-3 business days to clear, and the bank reports the outcome asynchronously by webhook.

Clarifying Questions to Ask Guidance

  • Must the receiver see the money the moment the sender taps Pay, or is a short delay acceptable as long as the sender is debited immediately?
  • Can a user spend a bank deposit before the bank confirms it?
  • Is each transfer in a single currency, or do wallets in different currencies need conversion?
  • Who can see a transaction in the feed: only the two parties, or their friends as well?
  • How far behind the ledger may the feed and the notifications fall?

What a Strong Answer Covers Guidance

  • Which operations need strong consistency and which can be eventually consistent, with scale and latency targets stated.
  • A ledger from which every balance can be rebuilt and audited, and how a cached balance is kept in step with it.
  • Idempotency from the client request through every asynchronous consumer, including where the durable duplicate check lives.
  • The locking strategy and deadlock avoidance, and how a transfer between two shards commits, retries and compensates on failure.
  • External funding and withdrawal as a tracked lifecycle, with reconciliation for lost webhooks and failed bank transfers.

Follow-up Questions Guidance

  • A charity wallet receives thousands of transfers per second during a fundraiser. How do you keep its row from becoming a lock hotspot?
  • How would you detect money-laundering patterns such as many small accounts funneling money into one account?
  • How would you let a user pay a merchant when the phone has no network connection?
  • A bank deposit that already showed as complete is returned by the bank days later, after the user spent the money. How does the ledger handle it?