Uploaded November 2026 | Updated November 2026, 2 days ago
You send fifty dollars on PayPal. The screen hangs, so you tap Send again. Did your friend just get a hundred? PayPal handled 6.8 billion payments last quarter, and every one has to move exactly once. In a System Design Interview you get exactly this question: "Design PayPal Payment System."
Most candidates say "keep a balance column, subtract from the sender, add to the receiver". If the server crashes between those two updates, the money vanishes, and with only a balance nobody can prove where it went.
- Fix 1: a double-entry ledger. Every payment writes two lines, a debit and a credit. The ledger always nets to zero, and a balance is just the sum of an account's entries
- Fix 2: atomic and append-only. Both lines commit in one transaction, or neither does. Posted entries are never edited: a refund is a new entry in the opposite direction
- Fix 3: the idempotency key. One unique key per payment, the same key on every retry, saved in the same transaction as the ledger lines. Your second tap just gets the first result. PayPal's own API works like this with PayPal-Request-Id
- Fix 4: stop the double spend. Two payments of $50 hit a $60 wallet in the same millisecond. Lock the wallet row, check the balance, then write. The second payment sees $10 and fails
- Fix 5: held money. PayPal can hold a payment for up to 21 days to cover disputes, so each wallet gets two accounts, available and held, and a release is one more ledger entry
- The follow-up: a withdrawal to the bank times out. Did the money leave? You don't know. Never mark it failed, never send a fresh request. Keep it pending, retry with the same key, ask the bank for the status, and match your ledger against the bank's file every day. A mismatch gets a correcting entry, never an edit
Say this in the round and you stand out: a double-entry ledger, atomic and append-only, one idempotency key per payment, a lock on each wallet, held money as its own account, and daily reconciliation.
This is a standard interview design, not a claim about PayPal's real architecture.
Comment and tell me: has a payment of yours ever said failed, while the money still left?
kgptalkie.com
#shorts #SystemDesign #SystemDesignInterview #PayPal #PaymentSystem #DoubleEntry #Idempotency #Ledger #BackendInterview #InterviewPrep #SoftwareEngineering #KGPTalkie
You send fifty dollars on PayPal. The screen hangs, so you tap Send again. Did your friend just get a hundred? PayPal handled 6.8 billion payments last quarter, and every one has to move exactly once. In a System Design Interview you get exactly this question: "Design PayPal Payment System."
Most candidates say "keep a balance column, subtract from the sender, add to the receiver". If the server crashes between those two updates, the money vanishes, and with only a balance nobody can prove where it went.
- Fix 1: a double-entry ledger. Every payment writes two lines, a debit and a credit. The ledger always nets to zero, and a balance is just the sum of an account's entries
- Fix 2: atomic and append-only. Both lines commit in one transaction, or neither does. Posted entries are never edited: a refund is a new entry in the opposite direction
- Fix 3: the idempotency key. One unique key per payment, the same key on every retry, saved in the same transaction as the ledger lines. Your second tap just gets the first result. PayPal's own API works like this with PayPal-Request-Id
- Fix 4: stop the double spend. Two payments of $50 hit a $60 wallet in the same millisecond. Lock the wallet row, check the balance, then write. The second payment sees $10 and fails
- Fix 5: held money. PayPal can hold a payment for up to 21 days to cover disputes, so each wallet gets two accounts, available and held, and a release is one more ledger entry
- The follow-up: a withdrawal to the bank times out. Did the money leave? You don't know. Never mark it failed, never send a fresh request. Keep it pending, retry with the same key, ask the bank for the status, and match your ledger against the bank's file every day. A mismatch gets a correcting entry, never an edit
Say this in the round and you stand out: a double-entry ledger, atomic and append-only, one idempotency key per payment, a lock on each wallet, held money as its own account, and daily reconciliation.
This is a standard interview design, not a claim about PayPal's real architecture.
Comment and tell me: has a payment of yours ever said failed, while the money still left?
kgptalkie.com
#shorts #SystemDesign #SystemDesignInterview #PayPal #PaymentSystem #DoubleEntry #Idempotency #Ledger #BackendInterview #InterviewPrep #SoftwareEngineering #KGPTalkie










