---
referrals: 3
kind: program
payer: domain:acme.example
code: acme_sub
category: mixed
status: open
at: 2026-10-30T00:00:00Z
net_of: tax
crit: split
---
# Acme referrer with a parent

Rates, amounts and names in this file are placeholders, not recommendations or market rates. Each party sets its own terms.

In plain words: a named referrer earns 11% of net payments. Its agency takes a part of that, one level deep and no further. Sam's agency takes 9% out of Sam's amount. Tess's agency gets 3% on top, paid by the payer.

Change first: `payer`, `code`, the rate and each `split`. Pay only for customers a referrer brought, and never for bringing in other referrers.

## Rules

### revenue_share

- on: payment
- basis: percent
- rate: 11%
- of: net
- recurring.months: 12

## Attribution

- model: last_touch
- window_days: 30
- allowed_kinds: link, code

## Settlement

- holdback_days: 30
- clawback_days: 60
- cycle: monthly
- payout_asset: USD
- rails: ach

## Example

Made-up lines. Sam and Tess each bring a customer who pays 1,000.00. The checker warns about `split` on purpose, to keep it to one level.

To run it, save this file as `REFERRALS.md` and these lines as `referrals.jsonl`, then run `node referrals.mjs run REFERRALS.md referrals.jsonl --as-of 2027-02-01T00:00:00Z`.

As of: 2027-02-01T00:00:00Z

```jsonl
{"type":"agreement","code":"sam","partner":"domain:sam.example","split":[{"payee":"domain:agency.example","share":"9%","mode":"carve"}]}
{"type":"agreement","code":"tess","partner":"domain:tess.example","split":[{"payee":"domain:agency.example","share":"3%","mode":"on_top"}]}
{"type":"event","at":"2026-11-10T00:00:00Z","kind":"payment","source":"billing:inv_1101","customer":"cu_b4c5d6e7f8091a2c","amount":"1000.00","net":"1000.00","asset":"USD","token":"rf1.acme_sub.sam.l1.to05c0.dhw.n.-"}
{"type":"event","at":"2026-11-11T00:00:00Z","kind":"payment","source":"billing:inv_1102","customer":"cu_c5d6e7f8091a2b3d","amount":"1000.00","net":"1000.00","asset":"USD","token":"rf1.acme_sub.tess.l2.to2000.dhw.n.-"}
```

## Worked result

Computed by `run_ledger` as of 2027-02-01T00:00:00Z, on the made-up lines above. Computed amounts are arithmetic on the records and terms you sent. They do not say what anyone owes. Your contract decides that.

| Event | Who | Working | Computed | Note |
|---|---|---|---|---|
| payment, 2026-11-10 | sam | 11% of 1000.00, pot 110.00 x 91% split | 100.10 |  |
| payment, 2026-11-10 | agency.example | 11% of 1000.00, pot 110.00 x 9% split | 9.90 |  |
| payment, 2026-11-11 | tess | 11% of 1000.00 | 110.00 |  |
| payment, 2026-11-11 | agency.example | 11% of 1000.00, pot 110.00 x 3% split | 3.30 |  |

| Payee | Asset | Earned | Reversed | Net | Held | Payable |
|---|---|---|---|---|---|---|
| tess | USD | 110.00 | 0.00 | 110.00 | 0.00 | 110.00 |
| sam | USD | 100.10 | 0.00 | 100.10 | 0.00 | 100.10 |
| agency.example | USD | 13.20 | 0.00 | 13.20 | 0.00 | 13.20 |


## Why these settings

`carve` keeps the payer's cost the same, `on_top` makes the extra cost plain, and the format stops at one level on purpose.
