> This page is for version Preview (default).
> For other versions, use one of these documentation indexes:
> - Preview (default): https://docs.preview.paid.ai/preview/llms.txt
> - Current: https://docs.preview.paid.ai/current/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.preview.paid.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.preview.paid.ai/_mcp/server.

# Credit grants

> Give customers credits from the bundles and top-ups they buy, or by hand, and control when those credits arrive, expire, roll over and refill.

A **credit grant** adds credits in a [credit currency](/credits/how-credits-work#credit-currencies) to a customer's balance. Most grants come from the prices your customer buys: a credit bundle grants credits each interval, and a top-up grants them once. You can also grant credits by hand, for goodwill or compensation. Each grant carries its own expiry, rollover and refill, so one balance can mix credits with different lifetimes and Paid still spends them in a fair, predictable order.

Use a credit grant to:

* **Sell credits** with a recurring or one-time price that carries `grants`. See [Grants from prices](#grants-from-prices).
* **Give a usage allowance that resets**, such as 50 messages every 4 hours, with a [refill](#refills).
* **Make things right** with goodwill or compensation credits, by [granting credits by hand](#grant-credits-by-hand).
* **Track what's left of each grant**, and when it expires, by [listing grants](#track-grants).

## How grants work

1. **A grant arrives** from a price on an order, at the start of each interval by default, or when you create one by hand.
2. **It adds an `amount`** of credits to the customer's shared balance, or to one [seat's](/orders-and-billing/seats) balance.
3. **Usage spends it** in the [spend order](/credits/how-credits-work#spend-order): scoped grants first, then the credits forfeited soonest, then the oldest.
4. **It ends** when it expires, after any rollover, or when you void it. Credits left at the end are forfeited with a ledger entry, so the [ledger](/credits/credit-ledger#credit-transactions) always reconciles.

Credit amounts are in the credit currency, as decimal strings with up to 15 decimal places.

## Grants from prices

Add `grants` to a recurring or one-time price to make it grant credits. Adatum sells a yearly credit bundle on a sliding scale: 70¢ a credit up to 50,000, 65¢ up to 100,000 and 60¢ above that. One price covers every bundle size, because the order line's quantity sets both the number of credits and the price on the curve.

#### API

[Create a price](../api-reference/catalog/prices/create) in money, with a `grants` entry in the credit currency. `grants` on prices, and the credit grant endpoints, are in the `credits=v1` beta; send `Paid-Beta: credits=v1`.

**`POST /v1/prices`**

```json title="POST /v1/prices"
{
  "product": "adatum_platform",
  "name": "Adatum credits",
  "currency": "usd",
  "type": "recurring",
  "recurring": {
    "interval": "year",
    "unit": "credit",
    "pricing": {
      "type": "graduated",
      "graduated": {
        "tiers": [
          { "upTo": "50000", "unitAmount": "70" },
          { "upTo": "100000", "unitAmount": "65" },
          { "upTo": null, "unitAmount": "60" }
        ]
      }
    },
    "grants": [
      {
        "creditCurrency": "adatum_credits",
        "amountPerUnit": "1",
        "expiresAfter": { "value": "12", "unit": "month" },
        "rollover": { "maxAmount": null, "duration": { "value": "3", "unit": "month" } }
      }
    ]
  }
}
```

The price's amounts are in cents, and `amountPerUnit` is in credits: one credit for each unit of the order line's quantity.

#### Dashboard

> **Draft**
>
> These steps describe the planned v1 dashboard and will change before release.

1. Go to **Configure > Products**, open **Adatum platform** and click **Add price**.
2. Choose **Recurring**, **Yearly**, and **Graduated** pricing in USD, and enter the three tiers.
3. Under **Grants credits**, choose **Adatum credits** and enter **1** credit per unit.
4. Set the credits to expire after **12 months**, and to roll over in full for **3 months**.
5. Click **Create price**.

An order line with `quantity: 120000` on this price grants 120,000 credits each year, and costs:

| Tier                     | Credits | Amount                              |
| ------------------------ | ------- | ----------------------------------- |
| Up to 50,000 at 70¢      | 50,000  | 50,000 × 70¢ = 3,500,000¢           |
| 50,001 to 100,000 at 65¢ | 50,000  | 50,000 × 65¢ = 3,250,000¢           |
| Above 100,000 at 60¢     | 20,000  | 20,000 × 60¢ = 1,200,000¢           |
| Total                    | 120,000 | 7,950,000¢ = **\$79,500.00** a year |

Each entry in `grants`, up to 5, becomes its own credit grant on the order:

| Field            | Description                                                                                                                                            |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `creditCurrency` | The credit currency granted.                                                                                                                           |
| `amountPerUnit`  | Credits per unit of the order line's quantity, each interval. Or set `unlimited: true` for a grant whose spends are recorded but never run it down.    |
| `grantedOn`      | When the credits arrive: `activation` (the default, at the start of each interval), `invoiceFinalized` or `invoicePaid`.                               |
| `expiresAfter`   | How long each grant lasts, such as `{ "value": "12", "unit": "month" }`. By default, until the order line ends, or never if the order has no end date. |
| `rollover`       | Keeps unspent credits spendable for a `duration` past expiry, up to `maxAmount` (`null` for all of them). The rest is forfeited.                       |
| `refill`         | Resets the grant to its full amount on a schedule. See [Refills](#refills).                                                                            |
| `scope`          | Limits what the credits can pay for to some `products` or some `prices`, never both.                                                                   |
| `recipient`      | `customer` (the default) for the shared balance, or `seat` to give each [seat](/orders-and-billing/seats) its own. `seat` needs a seat price.          |

A one-time price with `grants` is a **top-up**: it grants credits once, when it's bought, such as by an [amendment](/orders-and-billing/amending-orders) or an [auto top-up](/credits/auto-top-ups).

A grant from a price names where it came from in `source`. `grant` is the index of the entry in the price's `grants` list that made it, counting from 0:

```json
"source": {
  "type": "order",
  "order": { "order": "ord_7Gk3Xs", "orderLine": "oli_2Wd8Nf", "price": "prc_5Hv1Lp", "grant": 0, "amendment": null }
}
```

### Change the quantity mid-interval

When an [amendment](/orders-and-billing/amending-orders) raises a bundle line's quantity mid-interval, the extra credits are granted straight away for each entry in the price's `grants`, prorated by day for the rest of the interval. They arrive as that entry's `grantedOn` says. Each prorated grant expires and rolls over with the interval's grant, and its `source.order.amendment` names the amendment.

Brightrail raises its yearly bundle from 20,000 to 30,000 credits with 73 days of the 365-day year left:

| Step             | Value                                        |
| ---------------- | -------------------------------------------- |
| Extra quantity   | 30,000 - 20,000 = 10,000                     |
| Prorated credits | 10,000 × 1 credit × 73 ÷ 365 = 2,000 credits |

Prorated credits are rounded down to 15 decimal places. Lowering the quantity never takes back credits already granted: the next interval's grant uses the new quantity. A refilling grant gets no prorated grant: the new quantity sets its `amount` from its next window.

## Refills

A grant with `refill` resets to its full amount every `every`, such as every 4 hours, until it expires. Unspent credits don't carry over: the grant goes back to its `amount`, never above it. `every` is a whole number of hours, days or weeks, from 1 hour to 1 year.

Lucerne's monthly plan gives each subscriber 2,000 messages a month plus 50 every 4 hours. One price carries both grants:

```json
"grants": [
  {
    "creditCurrency": "messages",
    "amountPerUnit": "2000",
    "expiresAfter": { "value": "1", "unit": "month" }
  },
  {
    "creditCurrency": "messages",
    "amountPerUnit": "50",
    "expiresAfter": { "value": "1", "unit": "month" },
    "refill": { "every": { "value": "4", "unit": "hour" } }
  }
]
```

The 4-hour allowance is spent first, because its credits are lost soonest. A subscriber who sends 70 messages in one window spends:

| Step                                     | 4-hour grant | Monthly grant             |
| ---------------------------------------- | ------------ | ------------------------- |
| Start of the window                      | 50           | 2,000                     |
| 70 messages                              | 50 - 50 = 0  | 2,000 - (70 - 50) = 1,980 |
| Next refill, with a `refill` entry of 50 | 50           | 1,980                     |

A window with no spend writes no ledger entry. A grant's `refilledAt` and `nextRefillAt` say when its current window started and when it refills next, so you can show "refills in 1h 20m" in your app. `refill` can't be combined with `rollover` or `unlimited`.

## Grant credits by hand

Adatum gives Brightrail 5,000 credits of onboarding goodwill:

#### API

[Create a credit grant](../api-reference/credits/credit-grants/create) with an `Idempotency-Key` header, which is required, so a retry never grants twice.

**`POST /v1/credit-grants`**

```json title="POST /v1/credit-grants"
{
  "customer": "cus_3Vb9Rk",
  "creditCurrency": "adatum_credits",
  "amount": "5000",
  "expiresAt": "2027-06-30T00:00:00Z",
  "reason": "Onboarding goodwill"
}
```

**`Response`**

```json title="Response"
{
  "id": "cgr_5Lm2Qd",
  "object": "creditGrant",
  "livemode": false,
  "customer": "cus_3Vb9Rk",
  "seat": null,
  "creditCurrency": "adatum_credits",
  "amount": "5000",
  "used": "0",
  "available": "5000",
  "source": { "type": "manual" },
  "scope": null,
  "startsAt": "2026-11-03T10:00:00Z",
  "expiresAt": "2027-06-30T00:00:00Z",
  "rollover": null,
  "rolloverEndsAt": null,
  "refill": null,
  "refilledAt": null,
  "nextRefillAt": null,
  "status": "active",
  "reason": "Onboarding goodwill",
  "metadata": {},
  "createdAt": "2026-11-03T10:00:00Z"
}
```

`startsAt` defaults to now and can be in the future. Leave out `expiresAt`, or send `null`, for credits that never expire. A manual grant can also set `scope`, `rollover` and `refill`.

#### Dashboard

> **Draft**
>
> These steps describe the planned v1 dashboard and will change before release.

1. Go to **Operate > Customers** and open **Brightrail**.
2. On the **Credits** tab, click **Grant credits**.
3. Choose **Adatum credits**, enter **5000**, and set the expiry date.
4. Enter the reason, which shows in the credit ledger, and click **Grant credits**.

The credit currency must not be archived. Manual grants are spent in the same order as grants from prices.

## Track grants

[List credit grants](../api-reference/credits/credit-grants/list) by `customer`, `creditCurrency`, `seat`, `status`, `source.type` (`manual` or `order`) or `order` to see each grant's `amount`, what's `used` and what's `available`. For a refilling grant, `used` counts since its last refill.

| `status`    | The grant                                                                 |
| ----------- | ------------------------------------------------------------------------- |
| `scheduled` | starts in the future.                                                     |
| `active`    | can be spent.                                                             |
| `depleted`  | has nothing left. A refilling grant is `active` again at its next refill. |
| `expired`   | has passed its `expiresAt`, and any rollover.                             |
| `voided`    | was ended early.                                                          |

## How it bills

Brightrail renews its yearly bundle for 2027 with a quantity of 25,000, on the price above: 12 months' expiry, and everything rolls over for 3 months.

| Date            | What happens                                                                                                                  | Brightrail's credits    |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------- |
| 1 Jan 2027      | Bundle invoiced: 25,000 × 70¢ = 1,750,000¢ = **\$17,500.00**. A grant of 25,000 arrives.                                      | 25,000                  |
| During 2027     | Usage spends 21,000 credits.                                                                                                  | 25,000 - 21,000 = 4,000 |
| 1 Jan 2028      | The 2027 grant reaches `expiresAt`; its 4,000 credits roll over until 1 April. The 2028 bundle is invoiced and grants 25,000. | 4,000 + 25,000 = 29,000 |
| Jan to Mar 2028 | Usage spends 3,000 credits, all from the rolled-over credits, because they're forfeited first.                                | 29,000 - 3,000 = 26,000 |
| 1 Apr 2028      | Rollover ends. The last 4,000 - 3,000 = 1,000 rolled-over credits are forfeited, with an `expiry` entry.                      | 26,000 - 1,000 = 25,000 |

Brightrail pays only for the bundles. Credits spent are never invoiced again, and nothing is billed as overage while the balance covers the usage.

## Change or end a grant

[Update a grant](../api-reference/credits/credit-grants/update) to change its `reason` or `metadata`, or to move its `expiresAt` later. `expiresAt` can't move earlier, and an expired grant can't be revived. The amount, credit currency, `startsAt` and `refill` can't change: void the grant and create a new one instead.

[Void a grant](../api-reference/credits/credit-grants/void) to end it early. What's left is forfeited with a `void` ledger entry, so voiding a grant with credits left needs `forfeitRemaining: true`.

## Related

* [How credits work](/credits/how-credits-work)
* [Credit balances and ledger](/credits/credit-ledger)
* [Seats](/orders-and-billing/seats)
* [Amending orders](/orders-and-billing/amending-orders)
* [Credit grants API reference](../api-reference/credits/credit-grants/create)