# Seat-based charges

> Charge for active users, licenses or seats without reporting usage by hand.

Source: https://app.relvoerp.com/docs/product/en/seat-based-charges/

A seat-based charge bills a unit price for a quantity that Relvo **resolves on its own** at invoicing time, from the additions and removals recorded during the period. It is the right fit for active users, licenses, seats or workspaces: nobody has to remember to update the quantity every month.

## The three pieces

| Piece | What it is | Where it lives |
| --- | --- | --- |
| Seat metric | The kind of seat being counted: *Admin*, *Editor*, *Viewer* | Defined **inside a contract** |
| Seat event | An addition or a removal, with its effective date | Entered via API, manually or by CSV |
| Seat-based charge | The unit price and its cadence | One more charge in a phase |

> **Key rule: The seat metric belongs to the contract**
>
> Unlike a usage billable metric, which is a reusable catalog object, a seat metric is defined inside a contract and its code is unique there. Acme's seats are never counted together with another customer's.

## Seat events

Each event declares a change type, a count and an **effective date**: the day the change starts to apply commercially, which need not be the day it was recorded.

| Type | Meaning | Count |
| --- | --- | --- |
| `added` | Seats were added | Positive |
| `removed` | Seats were removed | Positive |
| `set` | From the effective date there are **exactly** this many | Zero or positive |

`set` is useful when your system knows the current total of seats but not the detail of additions and removals: you send the snapshot and Relvo does not need to rebuild it by summing movements. A `set` also corrects a history of deltas that got out of order, without cancelling events one by one.

Events are immutable and carry an idempotency key: resending the same addition does not duplicate seats. If an event was a mistake, it is **cancelled**; it is not edited.

## How the quantity is resolved

The available strategy is **snapshot at period end** (`snapshot_end`):

```
seats = (additions effective ≤ period end)
      − (removals effective ≤ period end)
```

There is no period-start filter: the contract's entire history up to the cutoff date is counted. A seat added in March still counts in August without being re-declared.

The cutoff date depends on when the charge is billed. **In arrears**, it is the period's last day. **In advance**, it is the period's **first** day: the invoice is issued before the period is consumed, so it bills the seats in force when the period starts, and an addition or removal during the period reaches the next period's invoice. The same day is used every time a draft is recalculated, so a recompute never changes the advance seat count.

When there are `set` events, the count starts from the latest effective `set`:

```
seats = (count of the latest set effective ≤ period end)
      + (additions after that set) − (removals after that set)
```

Events are ordered by effective date and, within the same day, by `timestamp`. Without any `set`, the result is exactly the previous formula.

| Situation | Result |
| --- | --- |
| Addition effective **before** a `set` (even if recorded later) | Already included in the `set`: it does not add |
| Two `set` events | The one with the most recent effective date wins |
| A `set` is cancelled | The previous `set` (or zero) applies again, plus the movements after it |
| `set` to zero | Releases all seats; the charge's minimum quantity still applies |

> **Caution: The snapshot is billed, not the average**
>
> A seat that existed for twenty days and was removed before period end is **not billed** in that period under this strategy. If your contract needs to bill seats by time held, that is not a seat-based charge: it is usage, and it is modeled with a [billable metric](https://app.relvoerp.com/docs/product/en/usage-billing.md).

## Charge configuration

| Option | Rule |
| --- | --- |
| Pricing model | Always standard: unit price × resolved seats |
| Cadence | Any recurring interval. **Never** a one-time charge |
| In advance / in arrears | In advance by default |
| Minimum quantity | Integer ≥ 1, optional. That floor is billed even if there are fewer seats |
| Proration | Optional, **incompatible with billing in advance** |

> **Caution: Proration and in-advance billing do not mix**
>
> Prorating means billing a share of a period that has already elapsed; billing in advance means billing a period that has not happened yet. Relvo rejects the combination when the charge is created, instead of letting it produce an ambiguous amount on the first invoice.

**Example: Acme, Admin licenses**

Charge: USD 20 per *Admin* seat, monthly, in advance, minimum 5.

| Effective date | Event | Running total |
| --- | --- | ---: |
| Mar 1 | +3 Admin | 3 |
| Apr 12 | +4 Admin | 7 |
| May 20 | −2 Admin | 5 |
| May 28 | +1 Admin | 6 |

May is billed in advance with the seats in force on May 1: 7 × USD 20 = **USD 140.00**. The May 20 and May 28 changes reach June: 6 × USD 20 = USD 120.00.

In March there were 3 seats, below the minimum of 5: 5 × USD 20 = USD 100.00 is billed.

## When not to use seats

- **The customer pays for actual usage, not for available seats** → usage billable metric.
- **The quantity is fixed and negotiated in the contract** → fixed charge with an authorized quantity, no metric.
- **Additions and removals must be billed prorated by the day** → usage with time-based aggregation.

## API

Seat metrics are created and listed at `/api/v1/public/catalog/seat-metrics`. Movements are sent in batches to `POST /api/v1/public/seat-events`, 1 to 500 per call, with the `seat_events:write` scope. Ingestion is synchronous and responds `200`.

| Field | Description |
| --- | --- |
| `contract_id`, `seat_metric_id` | Contract and seat metric |
| `change_type` | `added`, `removed` or `set` |
| `count` | Count as an integer string: positive for `added`/`removed`, zero or positive for `set` |
| `effective_date` | Date from which the change applies |
| `timestamp` | Moment of the movement. More than 24 hours in the future is rejected |
| `idempotency_key` | Unique key for the movement. There is no `Idempotency-Key` header |

The response separates `ingested_idempotency_keys`, `duplicate_idempotency_keys` and `validation_failed`.

- [Charges and pricing](https://app.relvoerp.com/docs/product/en/pricing.md): Fixed, usage and one-time charges.
- [Usage and billable metrics](https://app.relvoerp.com/docs/product/en/usage-billing.md): When what you bill is usage, not seats.
- [Contracts and phases](https://app.relvoerp.com/docs/product/en/contracts.md): Where the seat metric lives.
