Reconciling Money at the Edges
Fines, tolls and deposits are where a rental business quietly leaks money. Notes on modelling the messy parts of Drigo.
The demo of a rental app is easy: pick a car, pay, drive. The business is everything that happens at the edges — the Salik toll charged three days later, the parking fine that arrives as a screenshot, the deposit you owe back minus the scratch you don't.
The unglamorous core
Most of Drigo's real complexity isn't the booking flow. It's treating every downstream charge as a first-class, auditable thing:
- A raw fine with an official amount and evidence.
- A billable debt with a service fee on top.
- A reconciliation that ties the two together so nothing is charged twice and nothing is missed.
Money should be boring
The goal with anything financial is that it becomes boring — deterministic, idempotent, easy to explain to a customer who's annoyed:
insert into user_debts (rental_id, source, principal, fee, total)
values (@rentalId, 'traffic_fine', @principal, @fee, @principal + @fee)
on conflict (rental_id, source, external_ref) do nothing;
That on conflict … do nothing is the entire philosophy in one line: charge once, or not at all.
What I learned
If you can't reconcile it, you can't scale it.
Operations don't break at the happy path. They break at the exceptions, and the only way to grow a fleet without growing the team is to make the exceptions cheap to handle. That's the software I'm most proud of — the parts a customer never sees.