---
referrals: 3
kind: program
payer: domain:acme.example
code: acme_credits
category: saas
status: open
at: 2026-10-30T00:00:00Z
---
# Acme credits for both sides

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

In plain words: on a customer's first purchase, the referrer gets 13 account credits and the new customer gets 7. Credits are not cash.

Change first: `payer`, `code` and both amounts. Say in your own terms what a credit buys and when it expires.

## Rules

### referrer_reward

- on: purchase
- basis: flat
- amount: 13.00
- asset: unit:credits
- once_per: customer

### customer_reward

- on: purchase
- basis: flat
- amount: 7.00
- asset: unit:credits
- payee: customer
- once_per: customer

## Attribution

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

## Settlement

- holdback_days: 14
- clawback_days: 30
- cycle: monthly
- payout_asset: unit:credits
- rails: credits

## Assets

| asset | scale |
|---|---|
| unit:credits | 2 |

## Example

Made-up lines. A customer buys through Alice's code, then buys again. Only the first purchase earns. A customer with no token earns no one anything.

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 2026-12-15T00:00:00Z`.

As of: 2026-12-15T00:00:00Z

```jsonl
{"type":"agreement","code":"alice","partner":"domain:alice.example"}
{"type":"event","at":"2026-11-04T12:00:00Z","kind":"purchase","source":"billing:ord_301","customer":"cu_4d5e6f708192a3b4","amount":"40.00","asset":"USD","token":"rf1.acme_credits.alice"}
{"type":"event","at":"2026-11-25T12:00:00Z","kind":"purchase","source":"billing:ord_302","customer":"cu_4d5e6f708192a3b4","amount":"40.00","asset":"USD"}
{"type":"event","at":"2026-12-10T12:00:00Z","kind":"purchase","source":"billing:ord_303","customer":"cu_5e6f708192a3b4c5","amount":"40.00","asset":"USD"}
```

## Worked result

Computed by `run_ledger` as of 2026-12-15T00: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 |
|---|---|---|---|---|
| purchase, 2026-11-04 | customer cu_4d5e6f708192a3b4 | Flat 7.00 | 7.00 | disclosure_unstated |
| purchase, 2026-11-04 | alice | Flat 13.00 | 13.00 | disclosure_unstated |
| purchase, 2026-11-25 | alice | This rule pays once, and it already has. | 0.00 | once_per |
| purchase, 2026-12-10 |  | No touch connects to this event, so nothing is computed |  |  |

`disclosure_unstated`: The token doesn't say whether this touch was disclosed. A short link proves nothing about that, and the referrer still carries the duty.

| Payee | Asset | Earned | Reversed | Net | Held | Payable |
|---|---|---|---|---|---|---|
| customer cu_4d5e6f708192a3b4 | unit:credits | 7.00 | 0.00 | 7.00 | 0.00 | 7.00 |
| alice | unit:credits | 13.00 | 0.00 | 13.00 | 0.00 | 13.00 |


## Why these settings

`payee: customer` sends the second reward to the customer's own ref and keeps it out of statements, and `once_per: customer` stops a repeat purchase from paying twice.
