
The affiliate program is built in
Most products add a referral program once they have customers, and most of that work is the same every time: links, attribution, commissions, refunds and payouts. The starter ships it, wired to billing from the first paid invoice.
Signed-in users apply from the affiliate page, and an admin approves them in the admin panel. An approved affiliate gets a code and a link. A visit through that link sets a first-party cookie that counts for 60 days; the first affiliate link wins, and nobody can refer themselves.
Commissions come only from paid invoices, written by billing's invoice listeners: 20% of each invoice, net of tax, for 12 months. A commission starts pending, turns approved once the 30-day refund window has passed, and is marked paid when an admin records the payout. A refund or a lost chargeback reverses it.
Each month has a statement, one row per affiliate and currency, with a CSV export. Payouts are recorded by bank transfer, PayPal or Wise, and the terms (the rate, the months, the cookie, the refund window and the payout minimums) sit in one file, packages/contracts/src/affiliates.ts.
You might also like



