# Money

Every amount is an object with integer cents. Gross and net are different numbers; never add them together.

Source: https://app.betterfans.link/docs/concepts/money

Money is where reports go wrong. BetterFans Link returns it in one shape everywhere so that you never add floats or mix gross with net.

## The Money object

```json
{ "amount": 1250, "currency": "USD" }
```

| Field      | Type    | Description              |
| ---------- | ------- | ------------------------ |
| `amount`   | integer | Cents. `1250` is $12.50. |
| `currency` | string  | Always `USD`.            |

Keep amounts in cents while you add and compare. Divide by 100 only when you display a number.

```ts
const format = (m: { amount: number; currency: string }) =>
  new Intl.NumberFormat("en-US", { style: "currency", currency: m.currency }).format(m.amount / 100);

format({ amount: 1250, currency: "USD" }); // "$12.50"
```

## Gross, net and fee

Most money comes in pairs.

| Field   | What it is                                                                                           |
| ------- | ---------------------------------------------------------------------------------------------------- |
| `gross` | What the fan paid.                                                                                   |
| `net`   | What the creator earns after the OnlyFans fee. It is about 80% of gross.                             |
| `fee`   | The OnlyFans fee, on a single [transaction](https://app.betterfans.link/docs/api/money#transaction). |

Report gross or net and say which one. Never add a gross number to a net number, and never add gross and net together to get a total. When a report says "revenue" without qualification, use net for what the creator takes home and gross for what fans spent.

## Where the numbers come from

Revenue and spend come from the account's [transactions](https://app.betterfans.link/docs/api/money#list-transactions). The same sales feed every total. Only sales count: refunds and chargebacks are not in v1, so totals are gross sales, not what remains after refunds.

* A fan's `spend.total` is lifetime gross with that creator, and `spend.net` is the net of the same sales. [Get fan](https://app.betterfans.link/docs/api/fans#get-fan) splits it by type: subscriptions, tips, paid messages, posts and other.
* [Revenue summary](https://app.betterfans.link/docs/api/money#revenue-summary) totals a period, splits it by transaction type and as a time series, and gives the previous period for comparison.
* A mass message, post or tracking link reports the revenue it earned as a `gross` and `net` pair.

## Totals you must not add

Some numbers already contain others. Adding them counts the same sale twice.

* A mass message's `revenue` is the total for every copy sent. The copies also show up as single paid messages in each fan's chat. Report one or the other, never the sum.
* A revenue summary's `byType` and `series` split the same total two ways. Add within one of them, never across both.
* A fan's `spend` is part of the account's revenue. Do not add fan spend to account revenue.
* `previousPeriod` is for comparison only.

## Paid messages

A paid message (PPV) has a `price`. For messages the creator sent, `purchased` says whether the fan bought it. A message with `price` set to `null` is not known to be paid. The sale itself is a [transaction](https://app.betterfans.link/docs/api/money#transaction) of type `message`. Its `messageId` is not filled yet and is always `null` for now, so match a sale to a message by fan and time.
