Buy Now Pay Later (BNPL) System
Credit at Checkout, Installments, Refunds and a Ledger That Balances
Design a pay-in-4 lender that decides on credit during checkout, pays the merchant up front, collects the installments, handles returns and failed payments, and records every cent in a double-entry ledger.
Overview
Buy now, pay later (BNPL) splits a purchase into installments at checkout. The US Consumer Financial Protection Bureau (CFPB) describes the typical product in its 2022 market report: a $50 to $1,000 purchase split into four equal, interest-free installments, the first paid as a down payment at checkout and the other three every two weeks over six weeks. The lender pays the merchant up front and earns a merchant discount fee; if the customer does not pay, the lender carries the loss.
That makes the system a small consumer lender that works at checkout speed. It must approve or decline in about a second, pay many merchants, collect millions of small payments on schedule, handle returns (the CFPB found 13.7% of loans involved a return or dispute in 2021) and keep a record that auditors and regulators can trust.
The CFPB's figures for the five large lenders it surveyed (Affirm, Afterpay, Klarna, PayPal and Zip) show the scale and the thin margins: 180 million loans and $24.2 billion in 2021, a 73% approval rate, merchant fee revenue of 2.49% of volume against credit loss provisions of 1.30%, leaving unit margins of about 1%. Small mistakes in underwriting or collections erase that margin.
Questions to ask first
- Which products? — Pay in 4 only: 25% at checkout, then three payments two weeks apart, no interest
- How is the customer checked? — Fraud signals, our own repayment history, and optionally a soft credit inquiry
- When is the merchant paid? — Next business day, the price minus the fee
- How does the customer pay? — Autopay from a debit or credit card on file
- Late fees? — None in this design; failed charges are retried, and new loans are blocked
- What must be auditable? — Every money movement, as balanced ledger entries
What you will be able to do
- Explain who holds the money and the risk at each point of a pay-in-4 loan, with the CFPB's market figures.
- Design a checkout decision that answers in about a second: fraud first, then an exposure limit, then the down payment.
- Generate exact schedules and apply partial refunds to them correctly.
- Collect installments idempotently, with retries and a charge-off policy.
- Keep every movement in a double-entry ledger that always balances.
Key concepts
- Pay in 4
- Merchant discount fee
- Real-time underwriting
- Soft credit inquiry
- Low and grow limits
- Installment schedule
- Idempotent charges
- Re-presentment
- Refund allocation
- Double-entry ledger
Functional requirements
- Approve or decline a pay-in-4 loan during checkout
- Charge the down payment at checkout and create the schedule
- Pay each merchant the order amount minus the fee, next business day
- Charge each installment on its due date from the card on file
- Retry failed charges, notify the customer and block new loans while overdue
- Apply merchant refunds and resolved disputes to the loan
- Show customers their loans, schedules and payments
- Record every money movement in a double-entry ledger
Non-functional requirements
- Checkout decision under 1 second at p99, including the down payment authorization (a target we chose)
- Every charge and payout exactly once, even with retries and timeouts
- The ledger balances at all times: debits equal credits per entry
- Loan and ledger records never updated in place; corrections are new entries
- If the decision service is down, decline (and let the shopper pay another way) rather than approve blindly
Interview questions
- How do you make a credit decision during checkout?
- How do you handle a return after two of four payments?
- Why a double-entry ledger instead of a balance column?
- How do you avoid double charges when collecting installments?
- What happens when a customer stops paying?
- How is the merchant paid, and how do refunds affect it?
- Where does fraud end and credit risk begin?
Sign up free to read the full topic
More System Design topics
Start free on Cariara · Coding problems · System design studio