---
referrals: 3
kind: program
payer: domain:vendor.example
code: vendor_resale
category: enterprise
status: open
at: 2026-10-30T00:00:00Z
net_of: discount
crit: tiered, track
---
# Example vendor reseller terms

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

In plain words: a reseller keeps its own margin, so its orders compute no amount here. Those orders still count toward its yearly total. On revenue it refers directly, it earns 7% up to 50,000.00 of that total and 11% above it.

Change first: `payer`, `code`, the tiers and the period. On a resale, write `amount` as the customer's price if you know it, `net` as your invoice to the reseller and `margin` as the difference.

## Rules

### resale_tracked

- on: purchase
- basis: track
- of: net
- counts_toward: direct_share

### direct_share

- on: payment
- basis: tiered
- of: net
- measure: revenue
- mode: marginal
- period: year

| from | rate |
|---|---|
| 0 | 7% |
| 50000 | 11% |

## Attribution

- model: last_touch
- window_days: 60
- allowed_kinds: reseller_order, link

## Settlement

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

## Example

Made-up lines. A direct payment in January sits in the first tier. A resale in February computes nothing but moves the total to 80,000.00, so the March payment falls in the second tier.

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-06-01T00:00:00Z`.

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

```jsonl
{"type":"agreement","code":"reseller","partner":"domain:reseller.example","partner_role":"reseller"}
{"type":"event","at":"2027-01-15T00:00:00Z","kind":"payment","source":"billing:inv_1001","customer":"cu_6f7a81b2c3d4e5f6","amount":"20000.00","net":"20000.00","asset":"USD","token":"rf1.vendor_resale.reseller.dir1.tredc0.dhw.n.-"}
{"type":"event","at":"2027-02-15T00:00:00Z","kind":"purchase","source":"billing:po_2001","customer":"cu_7a81b2c3d4e5f607","amount":"80000.00","net":"60000.00","margin":"20000.00","asset":"USD","deductions":[{"kind":"discount","amount":"20000.00"}],"token":"rf1.vendor_resale.reseller.ord1.tt76o0.dhe.n.-"}
{"type":"event","at":"2027-03-15T00:00:00Z","kind":"payment","source":"billing:inv_1002","customer":"cu_81b2c3d4e5f60718","amount":"10000.00","net":"10000.00","asset":"USD","token":"rf1.vendor_resale.reseller.dir2.tufmo0.dhw.n.-"}
```

## Worked result

Computed by `run_ledger` as of 2027-06-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, 2027-01-15 | reseller | 7% of 20000.00 | 1400.00 |  |
| purchase, 2027-02-15 | reseller | Tracked: counts toward a total, with no amount | 0.00 |  |
| payment, 2027-03-15 | reseller | 11% of 10000.00 | 1100.00 |  |

| Payee | Asset | Earned | Reversed | Net | Held | Payable |
|---|---|---|---|---|---|---|
| reseller | USD | 2500.00 | 0.00 | 2500.00 | 0.00 | 2500.00 |


## Why these settings

`track` credits a sale with no fake 0% rate, and `counts_toward` lets volume through a reseller count toward a target without paying twice on it.
