Franchising and commissions module
Functional analysis, development and implementation
- Empréstimo Sábio
- Completed
- Five active agents, hundreds of processes a week
In short
A custom module for a franchised credit-intermediary network: it calculates the commissions at every level of the network, follows each process through to payment, and keeps the history of every figure.
- Functional analysis first. The business rules were defined and agreed with the client before the first line of code.
- An independent API. Today it feeds a WordPress dashboard; in future it can feed a mobile app or other systems.
- Commission management. Franchisings, teams and collaborators, each with their own rates, calculated and followed through to payment.
- Auditable. Any figure can be explained months later: which rate applied and who changed what.
Functional analysis: the rules defined before the code
Commission isn't one number. It's a stack of numbers. A collaborator's rate sits inside a franchising's rate. A team leader takes a cut of what their team produces. And a payout is promised at one moment, but only becomes due when the process reaches a status the business defines – sometimes months later.
With a few offices, a spreadsheet is enough. With the fifth franchising, the third rate revision and the first dispute over a commission still unpaid, it stops being enough: nobody can say which rate applied to a deal, or which of the won deals have actually been paid.
So the project started with functional analysis: working out, together with the client, how the business really works and which rules the system would have to follow. That work helped the client see clearly which business rules they wanted implemented – who gets what, when a commission becomes due, what happens when rates change – and left them written down and agreed before any code existed.
It was also decisive for scope management: what belonged to each phase was defined, and what stayed out was visible from the start. And for change management: when a new need came up, it was already clear where it fitted and what it affected, instead of reopening the discussion from zero.
The architecture was drawn and planned long before the first line of code was written. That is why the system could be implemented so cleanly, and why changes can be incorporated so easily.
An independent API: a base that plugs into any application
The commission calculation and the business rules live in an API of their own, with a database of their own, separate from the website. Today it is used in a WordPress dashboard, because the network already had its public site and franchisee portal on that platform, with processes managed in the same panel as the content, and redoing them was not on the table. But nothing in the API depends on WordPress.
That means the same API can, in future, feed a mobile app, a new application or external systems, without redoing the commission calculation or the audit rules.
It is six cooperating modules rather than a monolith: the API and the database, the React app, the plugin that mounts it in WordPress, and the theme and blocks of the existing site.
WordPress theme
pre-existing
Gutenberg blocks
host the plugin
WordPress plugin
loads the app
React app
mounted in the client's site
REST proxy
auth and routing
below this line, nothing depends on the CMS
PHP API
commission maths and audit rules
MySQL
versioned history, uniqueness enforced by the database
Each part can be tested and replaced on its own. The plugin and the app only ever see the API output, and the API is the only module that talks to the database.
Commission management for a whole network
Four connected areas, shipped in phases against the client's already-live site.
- Network and roles. Franchising registration, an onboarding landing page and a dashboard per franchising. Roles – Admin, Master, Team Leader, Collaborator – with their own permissions. Monthly goals per collaborator and per franchising.
- Commissions. A master table and a table for each franchising, each configurable on its own. Rates per collaborator and per bank, and a cut for the team leader. The figure shows up already calculated on every process, with no manual lookup.
- Processes and payment. Each process has a bank, an internal status and fields specific to each status. The commission is fixed automatically when the process reaches a status that entitles it to payment, and a paid/pending flag, with its own history, shows what has been settled.
- Reporting and oversight. Filters by franchising, collaborator and period, with Excel export. Processes in progress versus booked amounts, month-by-month financing evolution, volume by credit type and partner bank, a ranking of collaborators against their goal, and an immediate view of everything still to be settled.
Auditable: every figure has a history
Any commission can be explained months later: which rate applied, to whom, and who changed what. Four decisions make that possible.
The figure is fixed when payment falls due
The commission is calculated and fixed the instant a process enters a status that entitles it to payment – the company, master, team-leader and collaborator cuts, with the exact rates and the people involved.
A rate change next month never rewrites what was promised on a deal already committed. This is what makes it possible to answer, months later, the question "what rate applied to this process?"
No figure is guessed
The rate that applies is looked up in the collaborator first, then in the franchising, and stops there. If the franchising rate is missing, or is 0%, it is never filled in from the master table: the commission does not apply.
A configuration gap shows up as a visible N/A, never as an invented number. A system that guesses produces wrong payouts that nobody catches.
Every change is recorded
The rate tables keep every earlier version. The paid/pending status has a lighter record: who changed it, to what, and when. Each piece of information gets the kind of history that suits it, without needless noise.
The rules are guaranteed by the database itself
For each rate only one version can be active; the old ones are kept as history. This rule is enforced by the database, not by code that can forget to check it – and one day does.
Delivered in phases, with no downtime
The system was delivered in phases on top of the live site, with no downtime, and has been in use since the third phase. Every database change ships as a step of its own, dated and safe to reapply – never a hand edit, never a rebuild. The full history of the structure can be reviewed one step at a time.
That discipline, together with an architecture planned from the start, is what allows changes to be incorporated without upheaval.
What the network can do today
- See the exact commission a process will generate, before it is settled.
- Open any past deal and see the rate that actually applied to it.
- Manage a franchising's whole commission table independently of every other franchising.
- Answer "what is still owed" in one view, not a spreadsheet reconciliation.
- Track pipeline versus booked volume by franchising, collaborator and period.
- Rank collaborators against their monthly goal automatically.
- Export any filtered view to Excel for finance or leadership.
- Enable or disable a bank's product line without touching historical processes.
Who this is for
The shape is this: selling through franchised offices, brokers or agents; rates that vary by office, person, product or partner and change over time; needing to answer months later what rate applied to a specific deal; payouts that happen in stages and eventually require someone to ask whether a given one was actually paid.
Adjacent sectors where the same shape turns up: mortgage brokerages, insurance MGAs, real-estate franchise brands, equipment and solar dealer networks, and tiered referral and affiliate programmes.



