KatInterview

Real-Time BNPL Approval Service: Latency, Concurrency, and PII Vault

System DesignModel answer
MediumModel answerSystem Designsystem-designlatency-budgetconcurrency

Last updated

Design a buy-now-pay-later checkout backend that decides approval in real time, protects a shared credit line under concurrency, and isolates sensitive shopper data.

Build the backend of a buy-now-pay-later (BNPL) platform. A shopper who already has an approved revolving credit limit selects installments at a partner merchant's checkout. Your system must immediately approve or decline the purchase, and once approved, create an installment schedule whose future charges are collected from the shopper's saved payment instrument.

The interviewer wants a first-pass architecture and data model, then depth on three areas: the latency budget for the approval decision, correct handling of two concurrent purchases competing for the same remaining credit, and storage of sensitive personal and financial data.

Before designing, clarify:

  • Which capabilities are in scope beyond the approval decision: installment scheduling, late fees, merchant settlement, disputes, refunds?
  • Expected daily purchase volume and peak-event characteristics (for example, a holiday sale where traffic multiplies several times)?
  • Which sensitive fields must be persisted: government ID numbers, income, bank account or card numbers, address, contact details?
  • Which regions and lending regulations apply, and do they constrain where data may be stored or processed?

Part 1 — Architecture and data model: name the main components, design the core entities, and trace the flow from the shopper clicking "Pay in 4" through creation of the first future installment charge. State precisely what changes on the account at approval time versus what changes only when money is later collected.

Part 2 — Decision latency: merchants generally need a decision in well under a second. Determine what must run synchronously, what can be deferred to background processing, and how you would defend a concrete budget such as p99 under 400 ms.

Part 3 — Concurrent purchases: one shopper completes two purchases in separate tabs within the same second, and the two amounts together exceed the remaining credit. Explain exactly what prevents both from being approved.

Part 4 — Sensitive data storage: design storage so that compromising any single service does not yield usable personal or financial data, while underwriting, billing, and support workflows that legitimately need those values still function without unacceptable latency.

Your answer should call out trade-offs, capacity assumptions, failure behavior, and common implementation mistakes.

Hints

Hint 1

Separate the credit-commitment event at approval from the cash-collection event at each installment due date; only the first one changes available credit.

Hint 2

Reserve credit with a single atomic conditional update (or compare-and-swap) in the system of record instead of a read-then-write check.

Hint 3

Keep raw PII behind a dedicated vault with envelope encryption and opaque tokens elsewhere; the checkout hot path should never need raw sensitive values.