> 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.

# Prepaid credit bundles

> How a video analysis company sells prepaid credit bundles on a volume curve, burns them per video minute across several agents, and bills multi-year contracts annually.

Adatum captures operating procedures from video for manufacturers and field-services companies. Its agents run time studies on process videos and blur faces in footage, and customers pay for both from one prepaid balance of Adatum Credits. Customers buy credits in yearly bundles priced on a volume curve, and each agent burns credits per minute of video it processes.

This example uses:

* [Credit currencies](../../api-reference/catalog/credit-currencies/create) for Adatum Credits
* [Products](../../api-reference/catalog/products/create) and [prices](../../api-reference/catalog/prices/create) for the bundle and the burn rates
* [Meters](../../api-reference/metering/meters/create) for the video minutes each agent processes
* [Customers](../../api-reference/customers/customers/create) and [customer aliases](../../api-reference/customers/customer-aliases/create) to accept usage under Adatum's own platform IDs
* [Orders](../../api-reference/billing/orders/create) with a negotiated discount, and [amendments](../../api-reference/billing/amendments/create) to extend the term
* [Events](../../api-reference/metering/events/create) for each processed video
* [Credit balances](../../api-reference/credits/credit-balances/list), [credit transactions](../../api-reference/credits/credit-transactions/list) and [usage summaries](../../api-reference/metering/usage-summaries/list) to show customers what they have left

> **Note**
>
> The calls below omit the headers every request sends: `Authorization`, `Paid-Version`, the `Paid-Beta` opt-in for each resource's beta (for example `orders=v1` or `credits=v1`), and an `Idempotency-Key` on writes. See [request headers](../../api-reference/introduction#request-headers) and [idempotency](../../api-reference/idempotency).

## Pricing \[#pricing]

**Burn rates.** A time study costs 15 credits a minute for the first 30 minutes of each video and 20 credits a minute after that. Face blurring costs 3 credits a minute.

**Bundles.** Credits are sold in yearly bundles on a graduated curve:

| Credits           | Price per credit |
| ----------------- | ---------------- |
| First 50,000      | \$0.70           |
| 50,001 to 100,000 | \$0.65           |
| Above 100,000     | \$0.60           |

So 50,000 credits cost \$35,000, 70,000 cost \$48,000, 100,000 cost \$67,500 and 500,000 cost \$307,500. One price on this curve replaces a list of fixed bundle sizes.

**Credits** are prepaid, shared across every agent, and roll over for 3 months after the year they were granted for.

Money amounts on prices (`unitAmount`) are decimal strings in cents, so `"70"` is \$0.70. On a price quoted in a credit currency, `unitAmount` is in that unit, so `"15"` is 15 credits. `Money` objects, such as a discount amount, are integers in cents. Credit amounts are decimal strings.

## Setup \[#setup]

[Create a credit currency](../../api-reference/catalog/credit-currencies/create) for Adatum Credits. The conversion sets what a credit costs once a customer's balance runs out: 70 cents of overage per credit.

**`POST /v1/credit-currencies`**

```json title="POST /v1/credit-currencies"
{
  "key": "adatum_credits",
  "name": "Adatum Credits",
  "conversion": { "currency": "usd", "unitAmount": "70" }
}
```

[Create one product](../../api-reference/catalog/products/create), so invoices read "Adatum Platform" however many agents ship:

**`POST /v1/products`**

```json title="POST /v1/products"
{
  "externalId": "adatum_platform",
  "name": "Adatum Platform"
}
```

[Create a meter](../../api-reference/metering/meters/create) for each agent that sums the `minutes` of the videos it processed:

**`POST /v1/meters`**

```json title="POST /v1/meters"
{
  "key": "time_study_minutes",
  "name": "Time study video analysis",
  "eventNames": ["time_study.video_analysed"],
  "measure": {
    "type": "events",
    "events": {
      "aggregation": { "type": "sum", "sum": { "path": "payload.minutes" } },
      "unit": "minute"
    }
  }
}
```

Create `face_blur_minutes` the same way, for `face_blur.completed` events. `unit` on a meter is what it counts (`minute`); the prices below say what each unit costs.

[Create the bundle price](../../api-reference/catalog/prices/create): a yearly recurring price on the volume curve, in dollars, where the order line's quantity is the number of credits bought. Its grant gives one credit per unit of quantity each year. The credits expire after 12 months, and whatever is left rolls over for 3 more.

**`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",
        "grantedOn": "activation",
        "expiresAfter": { "value": "12", "unit": "month" },
        "rollover": {
          "maxAmount": null,
          "duration": { "value": "3", "unit": "month" }
        }
      }
    ]
  }
}
```

The response's `id` (say `prc_bundle01`) is what orders refer to.

Then create the burn rates as usage prices in `adatum_credits`. The time study rate uses graduated tiers with `tierScope: "event"`, so the tiers restart for every video: the first 30 minutes of each video cost 15 credits a minute and the rest cost 20.

**`POST /v1/prices`**

```json title="POST /v1/prices"
{
  "product": "adatum_platform",
  "name": "Time studies",
  "creditCurrency": "adatum_credits",
  "type": "usage",
  "usage": {
    "meter": "time_study_minutes",
    "pricing": {
      "type": "graduated",
      "graduated": {
        "tierScope": "event",
        "tiers": [
          { "upTo": "30", "unitAmount": "15" },
          { "upTo": null, "unitAmount": "20" }
        ]
      }
    }
  }
}
```

**`POST /v1/prices`**

```json title="POST /v1/prices"
{
  "product": "adatum_platform",
  "name": "Face blurring",
  "creditCurrency": "adatum_credits",
  "type": "usage",
  "usage": {
    "meter": "face_blur_minutes",
    "pricing": { "type": "perUnit", "perUnit": { "unitAmount": "3" } }
  }
}
```

These return `prc_timestudy01` and `prc_blur01`.

> **Tip**
>
> To charge a whole video at the rate of the tier it ends in, use `volume` instead of `graduated`. A 45-minute video then costs 45 × 20 = 900 credits instead of 750.

## Signing Contoso Manufacturing \[#signing-a-customer]

[Create the customer](../../api-reference/customers/customers/create) from Adatum's CRM record:

**`POST /v1/customers`**

```json title="POST /v1/customers"
{
  "externalId": "crm-00412",
  "name": "Contoso Manufacturing",
  "currency": "usd"
}
```

Adatum's own platform knows Contoso as `fw-1042`. [Create an alias](../../api-reference/customers/customer-aliases/create) so events sent under that ID reach the same customer:

**`POST /v1/customers/crm-00412/aliases`**

```json title="POST /v1/customers/crm-00412/aliases"
{
  "value": "fw-1042",
  "source": "adatum-platform"
}
```

Contoso signs for 325,000 credits a year at a negotiated \$48,000. [Create the order](../../api-reference/billing/orders/create) with the bundle at its real quantity, the two burn rates, and the discount as a negotiated pricing entry with its own display name. A billing cycle of 12 months bills it annually, and the purchase order number is printed on every invoice.

**`POST /v1/orders`**

```json title="POST /v1/orders"
{
  "customer": "crm-00412",
  "externalId": "contoso-2026",
  "purchaseOrderNumber": "PO-CON-4471",
  "startsAt": "2026-10-01T00:00:00Z",
  "endsAt": "2027-10-01T00:00:00Z",
  "billingCycle": { "interval": "month", "intervalCount": 12 },
  "lines": [
    { "type": "price", "price": { "price": "prc_bundle01", "quantity": 325000 } },
    { "type": "price", "price": { "price": "prc_timestudy01" } },
    { "type": "price", "price": { "price": "prc_blur01" } }
  ],
  "negotiatedPricing": [
    {
      "key": "contoso_discount",
      "type": "discount",
      "discount": {
        "type": "amount",
        "amount": { "amountOff": { "amount": 15450000, "currency": "usd" } }
      },
      "target": { "type": "price", "price": { "price": "prc_bundle01" } },
      "displayName": "Negotiated discount"
    }
  ]
}
```

The discount has no `startsAt` or `endsAt`, so it lasts as long as the order. [Activate the order](../../api-reference/billing/orders/activate) to start billing:

```http
POST /v1/orders/ord_123/activate
```

Activation grants 325,000 credits and issues the first yearly invoice, billed in advance:

| Line                                                                                      | Amount          |
| ----------------------------------------------------------------------------------------- | --------------- |
| Adatum Credits, 325,000 credits (50,000 at \$0.70 + 50,000 at \$0.65 + 225,000 at \$0.60) | \$202,500.00    |
| Negotiated discount                                                                       | −\$154,500.00   |
| **Total**                                                                                 | **\$48,000.00** |

The bundle line shows the real 325,000 credits, and the discount is its own negative line. Each anniversary invoice grants the next year's credits.

## Sending usage \[#sending-usage]

Adatum's platform sends one [event](../../api-reference/metering/events/create) per agent per video, under its own customer ID. The alias routes it to Contoso. A `face_blur.completed` event with the same `payload` and a dedupe key ending `:face_blur` follows for the same video.

**`POST /v1/events`**

```json title="POST /v1/events"
{
  "eventName": "time_study.video_analysed",
  "customer": "fw-1042",
  "product": "adatum_platform",
  "dedupeKey": "vid_88213:time_study",
  "payload": { "minutes": 45, "videoId": "vid_88213" }
}
```

Each event comes back with Contoso's `cus_` ID in `customer` and `fw-1042` in `sentAs.customer`. This 45-minute video spends 30 × 15 + 15 × 20 = 750 credits on the time study and 45 × 3 = 135 credits on face blurring, both from Contoso's one balance.

## An illustrative month \[#the-month]

In its first month Contoso processes 40 videos under 30 minutes (800 minutes in all), 6 videos of 45 minutes, and 300 minutes of face blurring.

| Usage                      | Arithmetic                        | Credits    |
| -------------------------- | --------------------------------- | ---------- |
| Time studies, short videos | 800 min × 15                      | 12,000     |
| Time studies, long videos  | 6 × (30 × 15 + 15 × 20) = 6 × 750 | 4,500      |
| Face blurring              | 300 min × 3                       | 900        |
| **Credits burned**         |                                   | **17,400** |

Usage priced in credits spends the balance rather than adding money to the invoice. After the month Contoso has 325,000 − 17,400 = 307,600 credits, 94.6% available. Only if the balance ran out would further usage be billed as overage, at \$0.70 a credit.

At this rate Contoso spends 12 × 17,400 = 208,800 credits a year, well within its bundle. A customer on a 70,000-credit bundle would run out in about four months.

## Extending to three years \[#extending-the-term]

Contoso extends its one-year term to three, still billed annually. [Preview the amendment](../../api-reference/billing/amendments/preview) first. `extendLines` moves the lines to the new end date. The discount has no `endsAt`, so it ends with the order:

**`POST /v1/orders/ord_123/amendments/preview`**

```json title="POST /v1/orders/ord_123/amendments/preview"
{
  "expectedVersion": 1,
  "changes": [
    {
      "type": "updateTerm",
      "updateTerm": { "endsAt": "2029-10-01T00:00:00Z", "extendLines": true }
    }
  ]
}
```

Then [create the amendment](../../api-reference/billing/amendments/create) at `POST /v1/orders/ord_123/amendments` with the same body plus the `previewToken` the preview returned.

Only the end date moves, so nothing is prorated. The next yearly invoices, each for \$48,000 with 325,000 credits, come on 1 October 2027 and 2028.

## A customer with two business units \[#customer-units]

Fabrikam buys through two businesses: a 70,000-credit bundle (\$48,000) and a 50,000-credit bundle (\$35,000). If each should spend only its own credits, make them two customers with an order each. If they share a budget, make one customer with two [customer units](../../api-reference/customers/customer-units/create):

**`POST /v1/customers/fabrikam/units`**

```json title="POST /v1/customers/fabrikam/units"
{
  "externalId": "fabrikam-windows",
  "name": "Fabrikam Windows and Doors",
  "kind": "business"
}
```

Then create one order per bundle on Fabrikam, for a shared 120,000 credits a year. Only one of the orders carries the two burn-rate prices, since a meter can be priced by only one active order per customer. Events name the unit in `customerUnit`, so usage summaries report each business separately.

## Showing customers their balance \[#showing-balances]

Adatum shows each customer its [credit balance](../../api-reference/credits/credit-balances/list) in-product. The alias works here too:

```http
GET /v1/credit-balances?customer=fw-1042&creditCurrency=adatum_credits
```

The burn history comes from [credit transactions](../../api-reference/credits/credit-transactions/list): each entry carries `balanceAfter`, the event and the meter, so it shows which video spent what, and expired credits appear as `expiry` entries. Minutes per agent per month come from [usage summaries](../../api-reference/metering/usage-summaries/list) with `granularity=month`. Adatum's sales team finds every customer below 20% of its credits with `percentAvailable[lte]=20` on the balances list.