How a payment gate works in code, and who can override it
No project starts until the advance is covered. How the deal engine enforces that, what counts as covered, and the one door through the rule.
Valentir Engineering Desk
The rule most agencies state and few enforce is that nothing is built until the first payment has arrived. We wrote it into the software that runs the studio. This note describes how it works, including the one door through it.
A deal is a state machine#
From the moment a proposal goes to a client until the advance is in the bank, one record, the deal, can be in one of eleven stages: drafting, sent, negotiation, accepted, agreement pending, payment pending, payment claimed and paid on the way, and declined, expired or cancelled at the end. Every move goes through one function. It takes the current state, who is acting and the event, and returns either where the deal goes next or a refusal with a reason in plain words. It touches no database and no clock, so each rule can be tested on its own.
The admin's deal panel and the client portal read the same function, which is how the portal knows what to show as the client's next step.
Who can do what#
The client can accept a proposal by signing it, decline it, and say that they have paid. Saying they have paid moves the deal to "payment to verify" and nothing else. The client cannot mark their own payment as received: the moves that mean "money arrived" belong to the system and to staff, and a test checks that a client cannot trigger them.
What counts as covered#
Money reaches a deal in four ways: a payment gateway webhook, a client's bank reference once Finance confirms it, money found in the bank statement, and a payment a colleague records on the deal. Each puts the money on the advance's invoice first. The confirmation step then reads that invoice, never an amount passed in by the caller, and it is safe to run any number of times, so a redelivered webhook or a second click on Confirm changes nothing.
Three things count towards the advance: the money received, any tax the client deducted at source (TDS), and a small shortfall the team has chosen to accept as bank charges. A part payment keeps the deal waiting and shows the balance. An overpayment is kept as a credit.
When the advance is covered the deal becomes paid and the project starts, once. The start time is claimed with a single conditional update, so two payments arriving together cannot both start it. Until then the project exists but is marked as proposed, which no delivery list shows.
The one door#
An owner or an admin can start a project without the full advance. The function refuses unless they write a reason. When they do, the project starts, the activity log records that it started without the full advance, and the client can still pay the balance afterwards. Nobody else can use it.
So the accurate version of the rule is not "it cannot be broken". It is that it can only be opened by an owner or an admin, with a reason on record. We prefer that to a rule with no exception, because a rule with none gets worked around outside the software.
Why put it in code#
A policy depends on whoever is asked, on the day they are asked. A rule in the software turns an exception into a visible act with a name and a reason attached.
What this does not prove#
The rule is checked by tests (the deal flow has 49 test cases as of 01-11-2026), not by a long history of live deals: the studio was founded in 2026 and we make no claim about how many deals have gone through it. The gate also protects our side only. It does not make a client pay, and it says nothing about when later payments fall due. Those fall due on events in the price list, which one post explains.
Valentir Technologies LLP is a software studio in Noida. If you are planning a system with approvals and money in it, custom software is the practice that builds it.
Get our notes by email
We email our notes when we publish something worth your time.
Search on Google and want more notes like this in your results? Add Valentir as a preferred source on Google.
If you want to argue with any of this, that is what hello@valentir.in is for.
