Design a Loan System with Borrower Repayments and Periodic Investor Payouts

Quick Overview

System design question about a loan system in which borrowers make repayments and the investors who own the loans are paid on a schedule. It tests loan and ownership modeling, repayment allocation, exact ledger accounting, idempotent payout runs, cent-level splitting among investors, and handling of payments reversed after a payout.

Design a Loan System with Borrower Repayments and Periodic Investor Payouts

Company: Valon

Role: Software Engineer

Category: System Design

Difficulty: medium

Interview Round: Onsite

Design the backend of a loan system. Borrowers hold loans and make repayments on them, and the system periodically pays out to the investors who own the loans. ```hint Follow one payment Trace a single borrower repayment from the moment it arrives until part of it reaches an investor, and name the record that changes at each step. ``` ```hint Money can come back A bank payment can bounce after you have already recorded it as received. Decide what that means if the investors' share of it has already been paid out. ``` ```hint The payout is a batch job The periodic payout runs over many loans and investors at once. Think about what happens if it crashes halfway through or is started twice. ``` ### Constraints and Clarifications - The prompt names two flows: borrowers repaying their loans, and periodic payouts to investors. Treat loan origination, underwriting and collections as out of scope unless the interviewer brings them in. - Scale, payment methods, payout frequency and how loan ownership is split among investors are not given. Ask for them or state your assumptions. - Every amount is money: it must be exact, and every cent collected must be traceable to where it went. ### Clarifying Questions - How are investors tied to loans: does each loan belong to one investor, or do several investors hold fractional shares of a loan? Can ownership change over time? - How often are investors paid, and what does a payout include: collected principal and interest only, or fees as well, and net of any fee the system's operator keeps? - How is a repayment applied to a loan: in what order are fees, interest and principal paid, and what happens to partial payments, overpayments and early payoff? - If a borrower misses a payment, do the investors simply receive less for that period, or must the system pay them the scheduled amount anyway? - How do borrowers pay (one-off bank transfer, card, recurring autopay), and how long after acceptance can a payment still fail or be reversed? - How many loans and borrowers are there, and how concentrated are payments around due dates? ### What a Strong Answer Covers - A data model for borrowers, loans, repayment schedules, payments, investors and loan ownership - Applying each repayment to a loan, including partial, late, early and excess payments - Exact, auditable money accounting, with balances that reconcile against the bank - A payout run that computes each investor's share, splits cents deterministically, and pays each investor exactly once despite crashes and retries - Handling of failed and reversed payments, both before and after the investors were paid - APIs for borrowers, investors and operations, and how the design absorbs due-date peaks ### Follow-up Questions - A borrower's payment is reversed after the investors already received their share. How does the system recover, and how do the books stay correct? - Three investors each own a third of a loan, and a payment does not split evenly in cents. Who gets the extra cent, and how do you make that choice reproducible? - The payout job crashes after sending half of its transfers. How does the rerun avoid paying anyone twice or skipping anyone? - An investor sells their share of a loan to another investor halfway through a payout period. Who is paid what for that period?

Overview: System design question about a loan system in which borrowers make repayments and the investors who own the loans are paid on a schedule. It tests loan and ownership modeling, repayment allocation, exact ledger accounting, idempotent payout runs, cent-level splitting among investors, and handling of payments reversed after a payout.

|Home/System Design/Valon
Valon logo
Valon
Apr 22, 2026
mediumSoftware EngineerOnsiteSystem Design
0
0

Design the backend of a loan system. Borrowers hold loans and make repayments on them, and the system periodically pays out to the investors who own the loans.

Constraints and Clarifications

  • The prompt names two flows: borrowers repaying their loans, and periodic payouts to investors. Treat loan origination, underwriting and collections as out of scope unless the interviewer brings them in.
  • Scale, payment methods, payout frequency and how loan ownership is split among investors are not given. Ask for them or state your assumptions.
  • Every amount is money: it must be exact, and every cent collected must be traceable to where it went.

Clarifying Questions Guidance

  • How are investors tied to loans: does each loan belong to one investor, or do several investors hold fractional shares of a loan? Can ownership change over time?
  • How often are investors paid, and what does a payout include: collected principal and interest only, or fees as well, and net of any fee the system's operator keeps?
  • How is a repayment applied to a loan: in what order are fees, interest and principal paid, and what happens to partial payments, overpayments and early payoff?
  • If a borrower misses a payment, do the investors simply receive less for that period, or must the system pay them the scheduled amount anyway?
  • How do borrowers pay (one-off bank transfer, card, recurring autopay), and how long after acceptance can a payment still fail or be reversed?
  • How many loans and borrowers are there, and how concentrated are payments around due dates?

What a Strong Answer Covers Guidance

  • A data model for borrowers, loans, repayment schedules, payments, investors and loan ownership
  • Applying each repayment to a loan, including partial, late, early and excess payments
  • Exact, auditable money accounting, with balances that reconcile against the bank
  • A payout run that computes each investor's share, splits cents deterministically, and pays each investor exactly once despite crashes and retries
  • Handling of failed and reversed payments, both before and after the investors were paid
  • APIs for borrowers, investors and operations, and how the design absorbs due-date peaks

Follow-up Questions Guidance

  • A borrower's payment is reversed after the investors already received their share. How does the system recover, and how do the books stay correct?
  • Three investors each own a third of a loan, and a payment does not split evenly in cents. Who gets the extra cent, and how do you make that choice reproducible?
  • The payout job crashes after sending half of its transfers. How does the rerun avoid paying anyone twice or skipping anyone?
  • An investor sells their share of a loan to another investor halfway through a payout period. Who is paid what for that period?

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...