The affiliate program
How people apply and promote the product, how referrals turn into commissions on paid invoices, and how admins approve affiliates and record monthly payouts.
Updated · 3 min read
The starter includes an affiliate program. People apply, an admin approves them, and they share a link. When a visitor comes through it, signs up and their organisation pays, the affiliate earns a share of each payment for a set number of months. Each month an admin opens the statement, pays affiliates outside the app and records each payout.
The terms
The example terms are 20% of each paid invoice after tax, for 12 months from the first payment, with a 60-day cookie, a 30-day refund window and a payout minimum of 50.00 in USD, EUR and GBP. Set your own in packages/contracts/src/affiliates.ts before you invite anyone.
| Term | Meaning |
|---|---|
| Commission percent | The share of each paid invoice, after tax |
| Commission months | How long a referred organisation earns commission; no limit is an option |
| Cookie days | How long a visit through a link counts |
| Refund window | How long a commission waits before it can be paid |
| Payout minimums | The smallest balance worth paying, per currency |
The affiliate page, the public partner page at /partners and the server all read the same terms, so the numbers you promise are the ones you pay. A change applies to new commissions only. Each commission keeps the rate it was earned at.
Groups and rates
Every affiliate belongs to a group. A group can set its own rate, cookie length, landing page and short-link allowance, and how people join:
| Joining | What happens |
|---|---|
| Review | An admin approves or rejects each application |
| Automatic | Applicants are approved at once |
| Invite only | Only people invited by email can join |
Each group has a join link, /affiliates?group=<slug>. Admins can also invite someone by email straight into a group; the invite works for 30 days and only for someone signed in with that address. An admin can give one affiliate their own rate. A rate change, a group move or a new own rate applies to payments after the change, and earlier commissions keep theirs.
How affiliates promote
Any signed-in user applies at /affiliates with a pitch, an optional website and payout details. Once approved they get a code and links:
/?ref=<code>, which they can point at any published page;- a campaign tag,
&via=<tag>, to see which place they shared it works best; - a short main link,
/r/<code>, and named short links,/r/<key>, to any page on the site.
The first affiliate to bring a visitor wins: a live cookie isn't replaced. Nobody earns from their own organisation. Known crawlers and link previews are redirected without counting.
Approved affiliates see a dashboard at /affiliates with 30-day trends, conversion from visit to sign-up and sign-up to paid, pending, approved and paid balances, the next payout date, a link builder, their short links and numbers per tag. They get emails when their application is decided, when they earn and when they're paid, and can switch each off. The emails need the affiliate template; see Email.
From payment to payout
- A referred organisation pays an invoice. Billing's webhook writes a
pendingcommission for that invoice. Zero-value invoices earn nothing. - A refund shrinks the commission in proportion; a full refund or a lost chargeback reverses it. A refund after payout is recorded but nothing is clawed back.
- When the refund window ends, the commission becomes
approved. - Each month, an admin opens the statement in Admin → Affiliates. It lists what each affiliate is owed per currency and whether they've reached the minimum. The minimum is advice; you can pay a smaller balance.
- You pay the affiliate outside the app, by bank, PayPal or Wise, and record the payout. The amount must match what's owed. The covered commissions turn
paid.
The statement exports as CSV, one line per commission.
Running the program
Admin → Affiliates has tabs for the overview, applications, affiliates, groups, invites, commissions, the statement and payouts. The overview shows daily visits, referred sign-ups, referred revenue and commissions, the top five affiliates, waiting applications and open flags.
Flags help you spot abuse. Nothing is rejected automatically:
| Flag | Raised when |
|---|---|
| Email match | The referred user's email matches the affiliate's mailbox or company domain |
| Same address | The referred user and the affiliate signed in from the same network address |
| Refund rate | At least 3 commissions and 30% or more refunded or disputed |
You can dismiss a flag, or reverse the referral so its unpaid commissions are voided and later payments earn nothing. A paused affiliate's link stops counting and new invoices earn nothing; what they already earned still gets paid.
To let a script or agent read reports, set AFFILIATES_READ_TOKEN (at least 32 characters) and send it as Authorization: Bearer <token>. It reads the program reports, such as affiliates, applications and statements, and never payout details. See Agents and the API.
Something unclear or missing? Ask us and we'll answer, then fix the page.


