System design interview guide
PayPal System Design Interview: Moving Money Exactly Once Without Ever Losing a Cent
Short answer
PayPal system design puts a wallet, peer-to-peer transfers and checkout on one money movement core. That core is a double-entry ledger whose append-only rows always sum to zero. Every write carries a client request ID, so a retry never moves money twice. Flows across services run as sagas with compensating entries. Fraud is scored in real time before the debit commits.
Two courses by the author of this page:
770 lessons · 18 free to read
₹1,111 in India · $35 elsewhere, once
Get System DesignYou own this course
219 lessons · 10 free to read
₹1,333 in India · $35 elsewhere, once
Get Generative AI and Agentic AIYou own this course
Save your progress and get the interview checklist PDF
PayPal reports over 400 million active accounts and moves well past a trillion dollars of payment volume a year across roughly 200 markets and 100 plus currencies. Its data access layer, HERA, handles hundreds of billions of SQL queries per day across thousands of database instances. The hard part is not the query count. It is that every one of those dollars has to be accounted for to the cent, a payment can never be silently duplicated or dropped, and a debit and its matching credit have to land together even when a server dies halfway through.
PayPal is a consumer wallet, a peer-to-peer transfer network, and a checkout processor stacked on top of one money movement core. The center of the design is a double-entry ledger where every transaction writes balanced debit and credit entries that always sum to zero, and ledger rows are append-only so history can never be rewritten. Money movement demands strong consistency and ACID transactions rather than eventual consistency, because a lost or duplicated balance update is real money gone. Every write is made idempotent with a client-supplied request id so retries after a timeout do not move money twice. Flows that touch several services, for example debiting a wallet, running risk, and settling to a bank, are coordinated with sagas and compensating entries instead of a single global lock. Around the ledger sit real-time fraud and risk scoring in the authorization path, holds and authorization versus capture semantics, refunds, chargebacks and reversals, multi-currency balances with foreign exchange, and continuous reconciliation against banks and card networks. The interview is really about correctness under partial failure at high volume, not raw throughput.
Where it shows up
Asked at PayPal, Stripe, Block, Adyen, Amazon, and most fintech and large e-commerce companies. Any team that moves money tends to reach for a wallet or ledger design in senior interviews.
Spec sheetPayPal
- 01Active accounts
- ~400M+ (published)
- 02Payment transactions per year
- ~25B (estimate)
- 03Peak write TPS on the ledger
- ~3-5K TPS (estimate)
- 04Database query volume
- 100s of billions/day (published)
worked through below, with the maths
in this guide
Design PayPal, part by part
8 parts open to everyone · 3 with a free account · 3 with the course
You can read 8 of 14 parts. A free account opens the deep dive; the course opens all of it.
- Requirementsopen
- Scale estimatesopen
- High-level architectureopen
- How a PayPal payment flows, step by stepopen
- Core componentsopen
- Data modelfree account
- Deep dives (7)free account
- Trade-offs to discussfree account
- What the interviewer asks nextwith the course
- The interview scorecardwith the course
- Mock interview on this questionwith the course
- How PayPal actually does itopen
- Frequently asked questionsopen
- Interview readiness checkopen
The hard parts of this design are taught step by step in the System Design course: Idempotency Keys, Saga Pattern and Design a Payment System.
Why this question is asked
Interviewers like this problem because it forces a candidate off the usual social-feed reflexes. You cannot hand-wave with eventual consistency and cache invalidation when the data is somebody's bank balance. It tests whether you understand ACID transactions, idempotency, and exactly-once processing at a deep level, whether you can reason about partial failure across services without inventing a magic distributed transaction, and whether you know the accounting model, double-entry bookkeeping, that keeps the money honest. It also probes judgment: knowing when strong consistency is non-negotiable and when a slower asynchronous path, like settlement or reporting, is acceptable.
This page is the free part.
The course goes deeper on the PayPal design
₹1,111 in India$35 everywhere elseonce, for the whole course
The System Design course covers the PayPal design across a run of lessons, not one page. These 4 alone are about 115 minutes of step-by-step reading, 1 of them with code you run in the browser, all with a quiz.
- Idempotency Keys
Safely retry failed API requests without causing duplicate side effects.
- Distributed Transactions
Coordinating atomic operations across multiple nodes, the hardest problem in databases.
- Saga Pattern
Long-lived transactions without distributed locking, orchestration vs choreography for microservices.
- ACID Properties
Database transaction guarantees that keep your data correct.
all part of
System Design Masterclass
770 lessons · about 290 hours · 18 free to read
₹1,111in India, by UPI
$35everywhere else, by card or PayPal
You own this course
Continue with Idempotency Keyspay once,
yours for life
The payment system design series
Every payment system rests on the same few ideas: an idempotency key so a retry never charges twice, a double-entry ledger so no money appears or vanishes, and daily reconciliation against the bank. These guides show those ideas inside real products.
- Design a payment systemStart here: the core pattern every guide below uses
- Design StripeCard payments API, idempotency keys, webhooks
- Design RazorpayPayment gateway for India: UPI, cards, settlement
- Design UPIIndia's central payment switch run by NPCI
- Design PayPal(this page)Wallet, ledger and sagas across services
- Design PaytmUPI app and wallet, the DEEMED state
- Design PhonePeUPI at national scale, sharded MySQL
- Design a digital walletBalances, holds and captures
- Design a banking systemCore banking: ledger, available balance, NEFT/IMPS/RTGS
- Design CREDBill payments driven by order state machines
- Design fraud detectionScoring a payment in milliseconds
Live from the course bench
Before you design PayPal, try the questions it rests on.
Real interview questions, live diagrams and measured lab results, pulled at random from the lessons. A new set every time you come back.
Requirements
Always clarify these in the first 5 minutes of the interview. Do not start drawing boxes until both lists are agreed.
Functional requirements
- Let a user hold a balance, add funds from a linked bank or card, and withdraw to a bank
- Send money peer to peer between two PayPal accounts, including cross-currency
- Process checkout payments where a buyer pays a merchant, with authorization then capture
- Support refunds, partial refunds, reversals, and dispute or chargeback handling
- Maintain an accurate, auditable ledger where every movement is double-entry and balances reconcile
- Score every transaction for fraud and risk in real time and approve, decline, or hold
- Hold funds when required by risk or policy and release them when conditions are met
- Support multiple currencies per account with foreign exchange conversion at transfer time
- Produce statements, transaction history, and reconciliation reports for users and finance
Non-functional requirements
- Strong consistency and ACID guarantees for all balance and ledger writes, no lost or duplicated money
- Exactly-once effect for every money movement even when clients and networks retry
- High availability for the read and authorization path, targeting four to five nines
- Durability of committed transactions with no data loss, backed by write-ahead logging and replication
- Low latency on the authorization decision, including risk scoring, on the order of a few hundred milliseconds
- Full audit trail and immutability of ledger entries for compliance and dispute resolution
- PCI DSS scope minimization and encryption of sensitive card and bank data
- Horizontal scalability by sharding accounts and transactions while keeping per-account consistency
Back-of-envelope scale estimates
Show your math. Pulling numbers from thin air signals you have not thought about the load.
Active accounts
~400M+ (published)
PayPal's public filings report on the order of 400 million plus active accounts worldwide. This is the population whose balances the ledger must track.
Payment transactions per year
~25B (estimate)
Public reporting has cited roughly 20 to 25 billion payment transactions annually. At 25B per year that averages about 25e9 / 31.5e6 seconds, close to 800 transactions per second sustained. Derived.
Peak write TPS on the ledger
~3-5K TPS (estimate)
Peak shopping days run several times the average. Taking the ~800 TPS average and a 4x to 6x peak multiplier gives roughly 3,000 to 5,000 money-movement writes per second. Each is at least two ledger rows, so 6K to 10K row inserts per second. Estimate.
Database query volume
100s of billions/day (published)
PayPal's HERA blog states the access layer serves hundreds of billions of SQL queries per day across thousands of database instances. Most are reads: balance checks, history, risk feature lookups.
Ledger storage growth
~10-20 TB/year (estimate)
At ~25B transactions per year and two or more append-only entries each, roughly 50B to 75B rows per year. At a few hundred bytes per row that is on the order of 10 to 20 TB of raw ledger data annually before indexes. Derived.
Read to write ratio
~100:1 or higher (estimate)
Balance displays, transaction history, risk feature reads, and reconciliation queries vastly outnumber money moves. Hundreds of billions of queries against a few billion writes per day implies a read-heavy ratio well above 100 to 1. Estimate.
High-level architecture
A request enters through an edge and API gateway that terminates TLS, authenticates the caller, and rate limits. Payment write requests carry a client-generated idempotency key. The gateway routes to the relevant domain service: wallet and balance, payments and checkout, or transfers. The service first checks the idempotency store keyed on that request id. If the key was already processed, it returns the stored result without touching money. If not, it opens an ACID transaction against the ledger. Money movement is modeled as double-entry: the operation writes a debit against one account and a credit against another in the same transaction so the two either both commit or both roll back, and the sum of every posting stays zero. Before the debit commits, the authorization path calls the risk and fraud service, which pulls features like velocity, device, and history and returns a score in real time; a high score declines or routes the transaction to a hold. Flows that span services, such as pulling funds from a bank, converting currency, and crediting a merchant, are run as a saga: each step is a local ACID transaction and a failure triggers compensating entries rather than an attempt to lock everything at once. Committed ledger writes are protected by write-ahead logging and synchronously replicated within a region, with asynchronous replication across regions for disaster recovery. Downstream, asynchronous consumers read a change stream off the ledger to update materialized balances, feed reconciliation against bank and card-network files, drive notifications, and populate analytics. Reads for balances and history are served from replicas and caches through the HERA data access layer.
In a real interview, sketch this on the whiteboard before diving into any single box.
How a PayPal payment flows, step by step
One money movement through the design above, from the API call to the reconciliation file.
- 1
The request arrives with an idempotency key
The gateway terminates TLS, authenticates the caller and rate limits. Every payment write carries a client-generated idempotency key.
- 2
Check the key first
The service looks the key up. If it was already processed, the stored result goes back and no money moves.
- 3
Score the risk
Before the debit commits, the risk service scores velocity, device and history in real time. A high score declines the payment or puts it on hold.
- 4
Debit and credit in one transaction
One ACID transaction writes a debit to one account and a credit to another. Both commit or both roll back, and the postings sum to zero.
- 5
Run multi-service flows as a saga
Pulling from a bank, converting currency and crediting a merchant are separate local transactions. A failure triggers compensating entries, not a global lock.
- 6
Make the commit durable
Committed ledger writes are protected by write-ahead logging and replicated synchronously in the region, and asynchronously across regions.
- 7
Fan out from the change stream
Consumers read the ledger's change stream to update balances, feed reconciliation against bank and card files, send notifications and fill analytics.
Core components
Walk through each service. The interviewer wants to hear what each one owns, not just the names.
API gateway and idempotency layer
Fronts every client, handles auth, TLS, and rate limiting, and enforces idempotency on money-moving POSTs using a client-supplied request id, which PayPal exposes as the PayPal-Request-Id header. It records each key with its outcome so a retried request returns the original response instead of moving money again.
Double-entry ledger service
The system of record for money. Every movement writes balanced debit and credit postings inside one ACID transaction, and rows are append-only so history is immutable. Account balances are derived from postings, often kept as a maintained running balance for fast reads while the postings remain the source of truth.
Wallet and account service
Owns account state, funding instruments, and per-currency balances. It exposes balance reads and initiates money movements against the ledger, and it enforces business rules like available versus pending funds when holds are in place.
Risk and fraud scoring service
Sits in the authorization path and scores each transaction in real time using machine-learning models over hundreds of signals such as device, geolocation, velocity, and behavioral history. It returns approve, decline, or review in a tight latency budget, and it also runs asynchronous models for slower investigations.
Payments and orchestration service
Coordinates multi-step flows: authorization versus capture for checkout, transfers that cross services or currencies, refunds, and reversals. It runs these as sagas, invoking each local transaction and issuing compensating actions when a later step fails.
Settlement and reconciliation engine
Handles the movement of real money to and from banks and card networks, which is asynchronous and batch-oriented. It matches internal ledger entries against external network and bank statements, flags breaks, and is where chargebacks and disputes are booked back into the ledger.
HERA data access layer
PayPal's data access gateway between applications and databases. It multiplexes connections, splits reads from writes, routes to the correct shard, and provides transparent failover and surge protection so the ledger stays available under load.
Data model
accounts. One row per account and currency. A user with USD and EUR balances has two account rows. Status covers active, frozen, or closed. Balances are not stored authoritatively…
Every table for PayPal, its keys, and which store fits it and why.
Deep dives
Double-entry ledger and why balances are derived. The ledger is the heart of the system and it borrows directly from accounting. Every money movement writes at least two postings, a debit and a matching credit, inside a…
7 deep dives on the parts that break at scale: Double-entry ledger and why balances are derived; Idempotency and exactly-once money movement; Strong consistency versus eventual, and where each belongs.
Trade-offs to discuss
Strong ACID consistency versus eventual consistency for balances. Money cannot be lost or double-spent, so account writes use ACID transactions and isolation even though that caps per-account write throughput. Eventual consistency is…
6 decisions an interviewer expects you to defend, each with the alternative and why it loses here.
What the interviewer asks next
A transfer debits an account on one shard and credits an account on another. How do you keep the money correct without a distributed transaction?
4 follow-up questions with model answers, the interview scorecard for this question, and a mock interview on Design PayPal with the AI tutor.
How PayPal actually does it
PayPal's real systems back most of this. HERA, its High Efficiency Reliable Access data gateway, sits between applications and databases, serving hundreds of billions of SQL queries per day across thousands of database instances through hundreds of pools, with connection multiplexing, read/write splitting, sharding, CoDel-based surge queues, and transparent failover; it was open-sourced and rewritten from C++ to Go. PayPal moved to sharded, horizontally scaled databases around 2015 using algorithmic hash-based shard placement while holding strong consistency and high availability as hard constraints. Idempotency is a documented part of the public REST API through the PayPal-Request-Id header, recommended as a UUID. On the risk side, PayPal has written about deploying large-scale fraud detection machine-learning models with CI/CD and a shadow platform that evaluates models against live traffic before they make real decisions. The stack is historically Java and Spring heavy and has moved steadily toward microservices and messaging.
Sources
- Scaling Database Access for 100s of Billions of Queries per Day: Introducing HERA (PayPal Technology Blog)
- Application Design Considerations for Sharding High Volume Databases (PayPal Technology Blog)
- Deploying Large-scale Fraud Detection Machine Learning Models at PayPal (PayPal Technology Blog)
- Idempotency (PayPal REST API Reference)
- Scaling DB Access for Billions of Queries Per Day @ PayPal (InfoQ presentation)
Lessons to study before this interview
If any of these topics are fuzzy, the interviewer will catch it. Each lesson is 15 to 60 minutes with diagrams, code, and a quiz.
Idempotency Keys
intermediate / api design protocols
Distributed Transactions
advanced / distributed systems core
Saga Pattern
advanced / distributed systems core
ACID Properties
foundation / core fundamentals
Write-Ahead Logging
advanced / consistency models
Snapshot Isolation
advanced / consistency models
Active-Active Failover
advanced / reliability resilience
System design interviews at companies in the US, UK, Canada and Singapore
41 walkthroughs of real systems at well-known companies, each built from that company's own engineering blog, talks or filings, with the numbers cited.
Banking, payments and trading
- Monzo system design (UK)
- Wise system design (UK)
- Stripe system design
- PayPal system design (this page)
- Robinhood system design
- Coinbase system design
Commerce and delivery
Rides and maps
- Grab system design (Singapore)
- Uber system design
Feeds, social and messaging
Streaming and media
AI labs and big tech
Developer and collaboration tools
Frequently asked questions
interview readiness
Are you ready for Design PayPal?
Three questions from this guide. Answer them without scrolling up, the way you would have to in the room.
Go deeper
This guide is built on these 6 lessons. Each one teaches one piece of the PayPal design above, step by step.
- Idempotency KeysSystem Design · api design protocols · 18 min
- Distributed TransactionsSystem Design · distributed systems core · 42 min
- Saga PatternSystem Design · distributed systems core · 30 min
- ACID PropertiesSystem Design · core fundamentals · 25 min
- Write-Ahead LoggingSystem Design · consistency models · 17 min
- Snapshot IsolationSystem Design · consistency models · 25 min
Practice with 770 system design lessons
Lifetime access for ₹1,111 in India or $35 elsewhere. Interactive diagrams, quizzes, and 20 capstone projects to practise on.
This one question is not enough for the interview.
Get all 200 questions in the System Design and Distributed Systems pack
Each question has why it is asked, a full answer, what the interviewer listens for, the follow-ups, the common mistakes and a diagram (268 diagrams in all). A PDF you keep, junior to staff level.
Pay by UPI, cards or netbanking through Razorpay. Pay by card or PayPal, in US dollars. Download at once from My packs.
NEWSystem Design Hands-On
Included in the System Design course: real systems, built live
Postgres Sharding: Complete Hands-On (PgBouncer + Citus). 2 h 36 min and 20 chapters: one PostgreSQL loaded until it breaks, then four shards behind a router you write, PgBouncer and Citus, with the 139-page slide deck. The first 15 minutes are free to watch.


