> ## Documentation Index
> Fetch the complete documentation index at: https://docs.integrateledger.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Rollover

> Carry customers' unused credits or units into the next period, up to a maximum you set, for as many periods as you choose.

> **Pro:** 1,000 credits and 500 messages a month. Up to 500 unused credits, and half the messages, carry into the next month.

Rollover lets customers keep what they paid for: what a period leaves unused carries into the next one, up to a maximum you set. It works on a plan's credits and on [metered items](https://docs.integrateledger.com/pricing/metered.md), each with its own limit and lifetime.

## The catalog

```ts ledger.config.ts theme={"system"}
import { defineCatalog, feature, plan } from "integrateledger-cli";

export default defineCatalog({
	features: [
		feature({ id: "generate_image", name: "Generate an image", creditCost: 1 }),
		feature({ id: "messages", name: "Messages", type: "metered" }),
	],
	plans: [
		plan({
			id: "pro",
			name: "Pro",
			monthlyCredits: 1000,
			priceCents: 2900,
			rollover: { maxCredits: 500 },
			items: [
				{ featureId: "messages", included: 500, rollover: { maxPercent: 50, periods: 2 } },
			],
		}),
	],
	creditPacks: [],
});
```

```json ledger.catalog.json theme={"system"}
{
  "schemaVersion": 1,
  "features": [
    { "id": "generate_image", "name": "Generate an image", "creditCost": 1 },
    { "id": "messages", "name": "Messages", "type": "metered" }
  ],
  "plans": [
    { "id": "pro", "name": "Pro", "monthlyCredits": 1000, "priceCents": 2900,
      "rollover": { "maxCredits": 500 },
      "items": [{ "featureId": "messages", "included": 500, "rollover": { "maxPercent": 50, "periods": 2 } }] }
  ],
  "addOns": []
}
```

| Field | |
| - | - |
| `maxCredits` | The most rolled-over credits (or units, on an item) live at once. |
| `maxPercent` | Or the most as a percent of one period's allowance, 1 to 100. Give one of the two. |
| `periods` | How many periods a rolled grant lasts. `1` (the default) ends it with the next period; `null` keeps it until used. |

Rollover on the plan carries `monthlyCredits`; on an item it carries a metered item's `included`.

## How it rolls

At each reset (a paid renewal, a free plan's next period, or the next month of an [annual plan](https://docs.integrateledger.com/pricing/annual.md) that resets monthly):

1. What the ending period's grant left unused is rolled into a `rollover` grant for the new period, up to the maximum less the rollover still live.
2. Rolled credits are counted as spent before the period's own. If 400 credits rolled into a 1,000-credit period and the customer used 500, the 600 left are all the period's own, and 600 roll again. The 400 rolled never roll a second time.
3. What [reservations](https://docs.integrateledger.com/customers/reservations.md) still hold at the reset doesn't roll: it's taken off what's unused.

The customer's balance and the `credits.granted` webhook show the rolled grant, with `source: "rollover"`. A metered item's `balance.included` counts rolled units.

## Plan changes

* **An upgrade** keeps live rollover until it expires, like the old plan's own credits. With `oldPlanCredits: "expire"` it ends with them.
* **A downgrade, a cancellation, or a renewal that's voided or marked uncollectible** ends the plan's rollover with its credits.
* The new plan's rollover rules apply from its first reset.

## Rules

* **Give `maxCredits` or `maxPercent`,** one of the two.
* **Plan rollover needs `monthlyCredits` above 0,** and item rollover a metered item with `included` above 0. Held, boolean and unlimited items, and lifetime plans, take no rollover.
* **Rollover is part of the plan version.** Editing it publishes a new [version](https://docs.integrateledger.com/billing/plan-versions.md); current subscribers keep theirs.

## Related

* [Credits](https://docs.integrateledger.com/pricing/credits.md): the shared pool rollover carries over.
* [Metered allowances](https://docs.integrateledger.com/pricing/metered.md): per-feature allowances.
* [Upgrades and downgrades](https://docs.integrateledger.com/billing/upgrades-and-downgrades.md): what happens to credits on a plan change.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.