---
referrals: 3
kind: program
payer: domain:vendor.example
code: vendor_cosell
category: marketplace
status: open
at: 2026-10-30T00:00:00Z
net_of: tax, marketplace_fee
---
# Example vendor marketplace co-sell

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

In plain words: when a partner's private offer closes on a marketplace, the partner earns 11% of what is left after the marketplace's cut, when the marketplace pays out. The rate applies for 12 months.

Change first: `payer`, `code`, the rate and the window. Fire the rule on the marketplace's payout, not on the order, so nothing is computed before the cash arrives.

## Rules

### cosell_share

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

## Attribution

- model: last_touch
- window_days_by_kind.marketplace_offer: 120
- window_days_by_kind.co_sell: 120
- allowed_kinds: marketplace_offer, co_sell

## Settlement

- holdback_days: 60
- clawback_days: 60
- cycle: quarterly
- payout_asset: USD
- rails: ach, marketplace

## Example

Made-up lines. A partner's offer closes, and the marketplace pays out 100,000.00 less its 3,000.00 cut. A tenth is refunded a month later.

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":"partner_co","partner":"domain:partnerco.example"}
{"type":"event","at":"2027-03-01T00:00:00Z","kind":"payment","source":"marketplace:disb_1","customer":"cu_5e6f7a81b2c3d4e5","amount":"100000.00","net":"97000.00","asset":"USD","deductions":[{"kind":"marketplace_fee","amount":"3000.00"}],"token":"rf1.vendor_cosell.partner_co.offer1.tr5400.dhf.n.-"}
{"type":"event","at":"2027-04-01T00:00:00Z","kind":"refund","source":"marketplace:refund_1","customer":"cu_5e6f7a81b2c3d4e5","amount":"10000.00","net":"9700.00","asset":"USD","reverses":"ev_7e25edbd3e107bf08c0533dd"}
```

## 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-03-01 | partner_co | 11% of 97000.00 | 10670.00 |  |
| refund, 2027-04-01 | partner_co | Reverses what was computed on payment, 2027-03-01 | -1067.00 |  |

| Payee | Asset | Earned | Reversed | Net | Held | Payable |
|---|---|---|---|---|---|---|
| partner_co | USD | 10670.00 | -1067.00 | 9603.00 | 0.00 | 9603.00 |


## Why these settings

Writing the marketplace's cut as a `deduction` lets anyone recompute `net`, and firing on the payout means the holdback runs from cash, not from a signature.
