# Charges and pricing

> How Relvo turns commercial terms and measured quantities into a billable amount.

Source: https://app.relvoerp.com/docs/product/en/pricing/

A **charge** is the smallest unit of billing in Relvo: it defines what is charged, with which pricing model and at what cadence. A contract does not have "a price": it has a list of charges, and each one is evaluated separately every period.

## The three charge types

| Type | When it is charged | Depends on usage | Example |
| --- | --- | --- | --- |
| **Fixed charge** | Every period, while the phase is active | No | Platform USD 1,000 / month |
| **Usage charge** | Every period, on the measured quantity | Yes | AI conversations at USD 0.10 |
| **One-time charge** | Once | No | Implementation USD 5,000 |

A seat-based charge is a special case of a fixed charge: the quantity is not entered by hand but resolved from a **seat metric**. See [Seat-based charges](https://app.relvoerp.com/docs/product/en/seat-based-charges.md).

## Pricing models

Relvo offers six models. **Not every charge type supports all six**:

| Model | Usage charges | Fixed charges | What it does |
| --- | :---: | :---: | --- |
| `standard` | ✅ | ✅ | Unit price times quantity |
| `graduated` | ✅ | ✅ | Each tier charges its own price, only for the units that fall within it |
| `volume` | ✅ | ✅ | The tier reached sets a single price that applies to the **entire** quantity |
| `package` | ✅ | — | Charges per full package of N units |
| `percentage` | ✅ | — | A percentage of each event's value |
| `graduated_percentage` | ✅ | — | Tiered percentage on the accumulated value |

> **Key rule: Fixed charges support only three models**
>
> A fixed charge can use `standard`, `graduated` or `volume`. `package`, `percentage` and `graduated_percentage` require usage events with an associated value, which a fixed charge does not have. If you need to charge a percentage of GMV, that is a usage charge, not a fixed charge.

### Standard

The simplest model: a unit price applied to each billable unit.

```
amount = unit_price × max(quantity − free_units, 0)
```

Free units are subtracted **before** the price is applied, not after. 1,200 units with 200 free at a price of 0.05 charge 1,000 × 0.05 = 50, not 1,200 × 0.05 with a discount on top.

### Graduated (tiered)

Each tier has its own unit price and, optionally, a flat amount (`flat_amount`) that is charged only if the tier received at least one unit. Units are distributed across tiers, and each portion is charged at its own price.

```
amount = Σ tiers ( units_in_tier × tier_price + tier_flat_amount )
```

**Example: 8,420 conversations with tiers**

| Tier | From | To | Unit price | Units | Subtotal |
| --- | --- | --- | --- | --- | --- |
| 1 | 0 | 1,000 | USD 0.00 | 1,000 | USD 0.00 |
| 2 | 1,001 | 5,000 | USD 0.10 | 4,000 | USD 400.00 |
| 3 | 5,001 | ∞ | USD 0.07 | 3,420 | USD 239.40 |
| | | | | **8,420** | **USD 639.40** |

### Volume

The total quantity determines **one** tier, and that tier's price applies to every unit. It is the "buy more and everything gets cheaper" model.

```
tier = the tier that contains the total quantity
amount = billable_units × tier_price + tier_flat_amount
```

**Example: The same quantity, with volume instead of graduated**

With the same three tiers, all 8,420 conversations fall into tier 3:

```
8,420 × USD 0.07 = USD 589.40
```

Compared with USD 639.40 under `graduated`. **The same tiers produce different amounts depending on the model.** Choosing one or the other is a commercial decision, not a configuration detail.

### Package

An amount is charged for each package of N units. A started package is charged in full.

```
amount = package_amount × ceil( billable_units / package_size )
```

If the charge defines an overage price (`overage_unit_amount`), the behavior changes: one base package is charged and the excess is charged per unit.

```
amount = package_amount + max( billable_units − package_size, 0 ) × overage_price
```

### Percentage and graduated percentage

These charge a percentage of each event's **value**, not its quantity. They are used for commissions on GMV, processed transactions or traded volume.

```
amount_per_event = event_value × rate / 100 + flat_amount_per_event
```

They support three additional controls:

| Property | Effect |
| --- | --- |
| `free_units_per_events` | The first N events of the period are not charged |
| `free_units_per_total_aggregation` | The first band of accumulated value is not charged |
| `per_transaction_min_amount` / `per_transaction_max_amount` | Floor and ceiling applied **to each event**, not to the period total |

> **Key rule: Percentage needs a calculation base**
>
> A metric with `LATEST` aggregation returns a point-in-time value—the last observed data point—not a base on which to calculate a percentage. Relvo blocks the combination instead of calculating a meaningless amount. See [Usage and billable metrics](https://app.relvoerp.com/docs/product/en/usage-billing.md).

## Proration

When a phase starts or ends mid-period, a charge marked as proratable charges the fraction of the period that was actually in effect. A non-proratable charge bills the full amount even when the window is partial. It is a property of the charge, not of the contract: in the same period you can have the platform prorated and an annual license charged in full.

## In advance and in arrears

Each charge declares whether it is billed **in advance** (`pay_in_advance`) or **in arrears**. It is a per-charge property, not a property of the whole contract:

- **In arrears** — billed when the period closes, once usage is known. This is the norm for usage charges.
- **In advance** — billed when the period opens. It only makes sense for amounts known beforehand.

A typical monthly contract combines both: platform in advance, usage in arrears, both on the same invoice.

## Calculation order

Discounts, minimums and caps are not applied in arbitrary order. Relvo always evaluates:

```
1. Usage aggregation
2. USAGE discounts          → reduce the quantity
3. Pricing model            → adjusted quantity to amount
4. AMOUNT and % discounts   → reduce the subtotal
5. Minimums                 → true-up if the subtotal fell below the floor
6. Caps                     → trimmed if the subtotal exceeded the ceiling
7. Taxes                    → on the already adjusted subtotal
```

The detail of each step, with numerical examples, is in [Discounts, minimums and caps](https://app.relvoerp.com/docs/product/en/commitments-discounts.md).

## API

Prices are managed at `/api/v1/public/prices` (scopes `charging:read` and `charging:write`): `GET` and `POST` on the collection, and `GET`, `PATCH` and `DELETE` on `/prices/{price_id}`. `PATCH` and `DELETE` require `If-Match`. `POST /prices/formula/preview` evaluates a formula without saving it.

Each price declares its type in `type` (`fixed`, `usage` or `seat`) and its model in `pricing.model`. `fixed` and `seat` prices always use `standard`. All amounts travel as decimal strings.

```json
{
  "type": "usage",
  "currency": "USD",
  "interval": "monthly",
  "status": "active",
  "billable_metric_id": "…",
  "pricing": {
    "model": "graduated",
    "tiers": [
      { "from": 0, "up_to": 1000, "unit_amount": "0.10", "flat_amount": "0" },
      { "from": 1000, "up_to": null, "unit_amount": "0.05", "flat_amount": "0" }
    ]
  }
}
```

A `{from, up_to}` tier covers quantities `from < q ≤ up_to`. The first tier starts at `0` (or at `free_units`), each tier starts where the previous one ended, and only the last one can be left open (`up_to: null`). The list accepts the filters `type`, `status`, `query` and `updated_since`, and returns `{items, next_cursor}`.

- [Discounts, minimums and caps](https://app.relvoerp.com/docs/product/en/commitments-discounts.md): How adjustments stack and what base tax is calculated on.
- [Usage and billable metrics](https://app.relvoerp.com/docs/product/en/usage-billing.md): Where the quantity consumed by the pricing model comes from.
- [Billing periods and cadence](https://app.relvoerp.com/docs/product/en/billing-schedules.md): When each charge is evaluated and which period it belongs to.
- [Contracts and phases](https://app.relvoerp.com/docs/product/en/contracts.md): How charges are grouped and how they change over time.
