# Billing periods and cadence

> When Relvo evaluates a contract, which period each charge belongs to and why period identity is deterministic.

Source: https://app.relvoerp.com/docs/product/en/billing-schedules/

Two separate questions determine when a contract is billed:

1. **How often?** → the **interval**, which is a property of each charge.
2. **Starting from which date?** → the **anchor**, which is a property of the contract.

Keeping them separate is what lets a single contract have a monthly platform fee and an annual license without the periods falling out of alignment.

## Intervals

Each charge declares its billing interval:

| Interval | Frequency |
| --- | --- |
| `ONE_TIME` | Once, with no recurrence |
| `WEEKLY` | Weekly |
| `MONTHLY` | Monthly |
| `QUARTERLY` | Quarterly |
| `SEMIANNUAL` | Semiannual |
| `YEARLY` | Yearly |

## The contract anchor

The anchor is declared as three explicit fields: **day**, **month** and **year**.

| Field | Range | What it determines |
| --- | --- | --- |
| `day` | 1–31 | The day of the month on which the cycle cuts over. With no value, it cuts over on the 1st |
| `month` | 1–12 | The reference month for cadences longer than one month |
| `year` | year | The reference year from which the anchored cycle is projected |

### Day 31 does not drift

An anchor on the 31st adjusts to the actual last day of each month: January 31 → February 28 (or 29) → March 31. **It does not drag the cutover to the 28th in the following months.** A contract anchored to month-end stays anchored to month-end all year.

> **Key rule: Month and year go together, or not at all**
>
> `month` and `year` are either both declared or neither is.
>
> - **Both declared** → *anchored* cycle: the cycle is pinned to a negotiated `(year, month, day)` date, which must be a real calendar date. If `month` is declared, `day` is also required.
> - **Neither declared** → *calendar* cycle: aligned to the natural calendar (January/April/July/October for quarterly, January for yearly), with `day` as an optional cutover.

**Example: Anchored quarterly vs. calendar quarterly**

| Configuration | Periods it produces |
| --- | --- |
| `QUARTERLY`, no `month` | Jan–Mar · Apr–Jun · Jul–Sep · Oct–Dec |
| `QUARTERLY`, `month = 2`, `day = 15`, `year = 2026` | Feb 15–May 14 · May 15–Aug 14 · Aug 15–Nov 14 · … |

The second case is a contract negotiated on February 15 whose customer expects the cycle to respect that date, not the fiscal calendar.

## One anchor per contract

There is **only one anchor per contract**. What varies per charge is the interval, not the cutover date.

> **Caution: Do not configure a different anchor per charge**
>
> Even though a charge can carry its own anchor configuration, the effective period identity is resolved from the contract's default anchor. Two charges on the same contract with the same interval **always** share the same period boundaries. If you truly need different cutover dates, that is a second contract, not a second anchor.

## Period identity

Interval and anchor together form a charge's **period identity**. Two charges with the same identity produce exactly the same period boundaries, which is why they can be grouped into the same calculation and the same invoice.

That identity is derived from the configuration, not from the moment the process runs: a billing cycle can be rerun tomorrow, next week or during an audit, and it produces the same period.

## In advance and in arrears within the same period

The interval defines the window; `pay_in_advance` defines which end of that window the charge is billed at. A typical monthly contract bills the platform fee when the period opens and usage when it closes, and both amounts end up on the same invoice.

## Changing the cadence

The cadence of a period that has already closed is not modified. A change of interval or anchor is a change to future terms, and it is recorded as an **amendment** with an effective date. See [Contracts and phases](https://app.relvoerp.com/docs/product/en/contracts.md).

- [Contracts and phases](https://app.relvoerp.com/docs/product/en/contracts.md): How terms change over time without rewriting the past.
- [Charges and pricing](https://app.relvoerp.com/docs/product/en/pricing.md): What is billed in each period the cadence defines.
- [Charge calculations, pre-invoices and invoices](https://app.relvoerp.com/docs/product/en/invoicing-collections.md): What happens when the period closes.
