The affiliate program — the frozen terms, and how every rupee is counted
Who this guide is for: PARTNER-SIDE businesses — an affiliate, or a business considering enrolling — and anyone who needs to see precisely how affiliate earnings are derived. Enrollment and claim actions are administrator actions.
The commercial terms are frozen — they are not invented here, and the running product does not get to reinterpret them.
The frozen terms, verbatim from the approved commercial decision record
(docs/delivery/zcode-commercial-and-content-implementation-2026-10-09.md,
the affiliate lines of the terms block, cross-consistent with section 3 of
docs/reviews/2026-10-09-commercial-and-management-decision-packet.md):
Affiliate: recurring 20% of eligible collected ex-GST software revenue. … One share per collection: no stacked affiliate, reseller and wholesale commissions. Exclude GST, Meta, unpaid/refunded/reversed sums. Calendar-month statements, T+15 settlement, no minimum payout. Trace late refund adjustments without editing final statements … preserve paid access/data/earned share on cancellation/partner exit.
Enrollment itself is ₹0: "Partner enrollment/platform fee ₹0; platform owner separately provisions authority."
About the numbers. Every business, plan, payment, refund and credit note in the runs behind this guide is synthetic. The plan price (₹1,499 → taxable ₹1,499.00 + 18% GST = ₹1,768.82 gross), the payment transport that "collects" it, and every affiliate code are test fixtures. No live payment occurred, no gateway was involved, and no real money moved.
Enrolling (administrator action)
- Enrollment takes nothing in its request body — anything sent is
refused (
400 AFFILIATE_ENROLL_BODY_INVALID); there is nothing to forge. - A member seat is refused (403); only an administrator enrolls.
- The answer gives you your affiliate id, a 10-character referral
code (ambiguous characters excluded), status "active", and your
referral link
https://…/?ref={code}. - Enrolling again returns the same identity and the same code — never a second enrollment.
A business that has not enrolled sees the honest empty program: no affiliate, no referrals, zero totals — and the stacking policy stated in plain words: "One share per collection: affiliate earnings never stack with managed-reseller or wholesale shares."
Being referred: claiming a code
A referred business's administrator claims the affiliate's code. The refusals first:
| Situation | Answer |
|---|---|
| Unknown code | 404 AFFILIATE_CODE_UNKNOWN |
| Malformed code | 400 |
| Member seat (not admin) | 403 |
| Your own affiliate code | 422 AFFILIATE_SELF_REFERRAL |
| Already attributed to another affiliate | 409 AFFILIATE_ALREADY_ATTRIBUTED |
| The affiliate's enrollment is disabled | 409 AFFILIATE_CODE_INACTIVE |
Attribution is permanent and one-per-business: replaying the same code returns the same referral; a different affiliate's code is refused. Even two affiliates' codes claimed simultaneously leave exactly one binding — one claim wins, the other gets the 409.
How earnings are derived — the frozen math, proven row by row
The example: a plan priced ₹1,499 excl. GST, collected as ₹1,768.82 inclusive. The GST-inclusive gross is not commissionable.
- Eligible revenue = collected ex-GST taxable only. First collection: eligible ₹1,499.00; earnings 20% = ₹299.80; the referral's status flips to "earning" with the first-collection date set.
- Unpaid businesses stay "referred". A business that was quoted but never collected shows earnings ₹0 — attribution alone earns nothing.
- Recurring: a second collected month accrues on the same binding — the example's two months totalled eligible ₹2,998.00, earnings ₹599.60. (The product has no automatic renewal; each period is a deliberate choice.)
- Refund continuity, row-accurate against the original collection: - A half service credit (₹884.41 incl. GST → ₹749.51 ex-GST) reduces the original row to eligible ₹749.49 / earnings ₹149.89 — the original collection date stays visible. - A later cash refund that settles that credit causes no second clawback: the row stays ₹749.49 / ₹149.89. A refunded amount is subtracted exactly once. - A full payment reversal zeroes the payment exactly once (replay-safe even under two simultaneous status syncs): the row turns "reversed", eligible ₹0, earnings ₹0 — recorded, not erased. - Partial credit then full reversal ends at exactly ₹0.
One share per collection — proven in both directions
- A collection that already carries a managed-reseller share never also earns an affiliate share: the reseller's statement keeps its single share, the business can still be attributed to an affiliate — and the affiliate's row for it shows eligible ₹0 / earnings ₹0.
- Conversely, an affiliate-attributed independent collection never acquires a reseller share.
Isolation, immutability, and disabling
- An affiliate sees only its own referrals — a second, foreign affiliate read zero rows while the first read its one referral; the database itself enforces this (row-level security).
- The ledger is immutable: UPDATE and DELETE on the enrollment and binding tables are refused outright by the database; a forged insert for another business is refused too.
- Disabling an enrollment (an owner-gated action) keeps every earned share (₹299.80 preserved, not clawed back), marks existing rows "inactive", and refuses new claims (AFFILIATE_CODE_INACTIVE).
The enrollment card through the real screen — supplementary proof
A supplementary browser run drove the real partner screen and proved the enrollment journey above as a user lives it:
- Opening the card raises no extra verification prompt — the card view is a member-scope read (this is the honest recorded behavior; see the evidence section below).
- The card first shows the honest not-enrolled state.
- Clicking Enroll raises the real verification prompt — the privileged action, not the read, is what demands the factor.
- After the factor, the enrollment succeeds exactly once.
- The referral code appears and persists: refreshing the card re-reads the same code, character for character.
- The earnings summary renders with it.

The screenshot is a byte-exact capture of the supplementary passing run (SHA256 and provenance in assets/ASSETS-MANIFEST.json). It is supplementary evidence — the SHA-bound journey 4 remains FAILED at its entry expectation and defect FULL3747-B-02 stays open. A small related UI fix (
46fb35c8) lives on the browser lane's branch, not on this guide branch's base. All data is synthetic.
What this guide does NOT claim (kept honest)
- No statement generation, T+15 settlement execution, or bank payout was exercised here — those are separate surfaces; the frozen record's settlement clauses are quoted, not run.
- No live plan prices: ₹1,499 is the synthetic fixture price, not a price list.
- The card journey claimed here is the supplementary SUP-J4 run only; the SHA-bound journey 4 remains FAILED at entry (defect FULL3747-B-02 open), and no claim or earnings math is re-proven through the screen — those stand on the API-level suite below.
Evidence record (kept for honesty). The FULL3747-PG lane executed the mounted affiliate suite against a real ordinary-role (FORCE RLS) throwaway PostgreSQL 16 cluster over real loopback HTTP, on the combined candidate:
- Suite 5 —
bf010-affiliate-program.test.ts: 14/14 passed (2026-10-24T23:21:43Z → 23:21:59Z, exit 0), verbatim receipttools/zcode-integration3723/runtime/FULL3747-PG/logs/05-bf010.tapin the PG lane worktreeC:/CT-ZC-FULL3747(git-ignored). - A second independent fresh-PG cycle was green again (
c2-05-bf010.tap14/14; lane ledger "CYCLES 1+2 COMPLETE AND GREEN", 2026-10-24T23:44:30Z,C:/CT-ZCODE-FULL3747/lane-pg-ledger.json). - Browser journey 4 — honest status: FAILED at its entry expectation,
with the substance separately proven. The SHA-bound journey expected
the partner screen's entry to raise the privileged authenticator
prompt; the mounted candidate deliberately serves the partner read at
member-scope (an API probe without the factor header answered 200), so no
entry prompt appears and the journey stopped at its factor step. A
supplementary run (SUP-J4, recorded as supplementary evidence,
not the SHA-bound spec) then drove the same real screen through the
product's actual flow — the factor prompt raised by the Enroll
action — and passed end-to-end. The underlying design question is
reported as defect FULL3747-B-02 (decision needed: gate the
partner/affiliate reads admin-only, or revise the two SHA-bound journeys
to enter the factor at the action). Ledger:
C:/CT-ZCODE-FULL3747/lane-browser-ledger.json.
Standing: combined-candidate, local evidence; the affiliate routes are
mounted in the candidate's app.ts. Chief acceptance and publication are
OPEN. The run also proved pre-mount honesty: without the router, the same
read answered a plain 404 — the program is never half-exposed. No live or
Main-built deployment is claimed.