Private Lending Platform — Funding Installment Plans with Investor Capital

From 2022 to 2023 I architected and led the build of a lending platform for a private investment firm, through my company, Momentaj. Investors put capital into wallets on the platform. The platform uses it to fund purchases that customers pay off in installments, and pays each investor back with interest as the installments fall due.

At a glance

  • My role: Architect & Tech Lead, through Momentaj
  • Years: 2022–2023
  • Client: a private investment firm
  • What it is: a platform that funds installment invoices with investors’ capital and tracks the money from deposit to payout
  • Users: investors and the firm’s administrators
  • Currencies: two, each with its own wallet
  • Status: delivered and put into production

The challenge

A customer buys on an installment plan: a down payment now, and the rest on a schedule. The seller wants the full amount now. An investor is willing to put up the difference in return for interest. The platform sits between them and holds other people’s money, so it has to get four things right:

  • Matching. New invoices keep arriving from the seller’s own system. Each one needs an investor with enough free balance in the right currency, chosen by clear rules.
  • Interest. Every investor has to be able to see how each payment was worked out, and rounding can’t create or lose a cent.
  • No double posting. The automation runs every few minutes. A job that runs twice must not post the same payment twice.
  • Visibility. Investors need to see where their money is, what it has earned and what is due back to them, without having to ask.

What we built

  • Investor wallets. Each investor has one wallet per currency. It shows the free balance, the amount currently invested and the interest earned. Administrators record deposits made by cheque, cash or transfer. An investor can put the account on hold, so that no new invoices are assigned to it, and can move earned interest back into the balance to be invested again.
  • Invoice intake. A scheduled job pulls new installment orders from the seller’s system through its API, starting from where the last successful run stopped. Each order becomes an invoice with its down payment and its payment schedule. Administrators can also enter an invoice by hand.
  • Investor matching. For each new invoice, the platform looks for active investors whose wallet in that currency covers the amount, and picks the one with the highest priority, which administrators set. Administrators can also assign an invoice by hand, and investors can browse open invoices and take one themselves.
  • The interest engine. The financed amount is the invoice total less the down payment. It is split into equal parts of principal, one for each installment. The investor’s interest is worked out on the declining balance, for the number of days between installments, at a rate set on that investor’s wallet. Any rounding remainder goes onto the last installment, so the parts always add up to the amount financed. The difference between the interest charged on the invoice and the interest paid to the investor is recorded as the platform’s income.
  • The ledger. Every movement of money is a transaction: deposits, investments, repayments, payouts and fees. Funding an invoice and each repayment are posted as a mirrored pair, one entry against the investor and one against the seller. Each entry carries a key built from its investor, seller, invoice and payment, and the database enforces that the key is unique, so a repeated job can’t post the same payment twice.
  • Repayments. A scheduled job confirms each repayment when its date arrives, posts it to the ledger and credits the investor’s wallet with principal and interest.
  • Cash-outs. An investor asks for a payout from a wallet. The platform checks the request against the free balance, counting requests that are still open, and administrators complete it.
  • Statements and dashboards. Investors get a monthly statement for each currency with a running balance, a list of the repayments due in the coming weeks, and the interest earned over the last month. Administrators see deposits, payouts, funded amounts, investor profit and platform income over the last week, month and year, and can run a report on any investor or seller.
  • Automation. The scheduled jobs run on a small task framework we wrote for the platform. Each task is set up in configuration with a start time and an interval. Every run is logged with its start, its end and its counts of successes and failures, and the log tells the next run where to resume.
  • Access and audit. Access is role-based, with separate areas for administrators and investors. Changes to investors, invoices and transactions are kept as history, and API requests are logged.
  • The web app. Administrators and investors work in a web app built in Svelte. Its API client is generated from the API’s OpenAPI description, and its routes are generated from the pages themselves, each of which declares the roles that may open it. It also carries the FAQ, legal pages and news, which administrators edit.

My role

I was the architect and tech lead, through Momentaj. I wrote the technical proposal the build started from, designed the domain model and the transaction ledger at its centre, and led the developers who built it.

Outcome

  • In production, with investors funding installment plans through the platform
  • One ledger for deposits, investments, repayments, payouts and fees, in two currencies
  • Intake, matching and repayment automated, from a new invoice to the investor’s wallet

Stack

C# · .NET 6 / ASP.NET Core · MongoDB · JWT · OpenAPI · FluentValidation · AutoMapper · TypeScript · Svelte · Vite · Bootstrap · Tabler · GitHub Actions