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

# Set up your catalog

> Create a plan with a base fee, metered usage and included credits.

> [!NOTE]
>
> **Why now?** With usage flowing, you can price against real numbers. A product holds both what customers pay (prices) and what they get (benefits). See [Products & prices](https://polar.sh/docs/concepts/products.md).

In this step you'll create a **Pro** plan: \$20 a month, including 100,000 tokens, with usage beyond that billed per token.

## Create the credits benefit

A [Meter Credits benefit](https://polar.sh/docs/features/usage-based-billing/credits.md) adds units to a customer's meter balance at the start of every billing cycle. Usage draws the balance down before anything is billed.

> [tab] Dashboard
>
> * Open **Catalog → Benefits**
> * Click **Create Benefit**
> * Set the type to **Meter Credits**
> * Enter the **Description** "100,000 AI tokens per month"
> * Pick the **AI tokens** meter and set **Number of credited units** to 100,000
> * Leave **Rollover unused credits** unchecked
> * Click **Create**

> [tab] CLI
>
> ```bash theme={null}
> export POLAR_BENEFIT_ID=$(polar benefits create --type meter_credit \
>   --description "100,000 AI tokens per month" \
>   --properties '{"meter_id": "'"$POLAR_METER_ID"'", "units": 100000, "rollover": false}' | jq -r .id)
> ```
>
> See [`polar benefits`](https://polar.sh/docs/integrate/cli/reference/benefits).

> [tab] Prompt
>
> ```text Prompt theme={null}
> In my Polar sandbox, create a Meter Credits benefit that grants 100,000 units of the AI tokens meter per month, without rollover.
> ```
>
> Uses the `benefits_create` operation of the [Polar MCP server](https://polar.sh/docs/integrate/mcp.md).

> [tab] Pricing as Code Beta
>
> Add a `benefits` section after `meters` in your billing config. Credits refer to the meter by its external ID:
>
> ```ts polar.config.ts theme={null}
> benefits: ({ credits }) => ({
>   ai_tokens_monthly: credits('100,000 AI tokens per month')
>     .meter('ai_tokens')
>     .units(100_000),
> }),
> ```
>
> You'll draft and publish it together with the product.

## Create the product

Create a monthly product with two prices: a fixed base fee and a metered price on the **AI tokens** meter, then attach the credits benefit.

> [tab] Dashboard
>
> * Open **Catalog**
> * Click **New Product**
> * Set **Name** to "Pro"
> * Under **Pricing**, choose **Recurring subscription** and set **Every** 1 month
> * Pick **Fixed price** and enter \$20
> * Click **Add metered price**, select the **AI tokens** meter and set **Amount per unit** to \$0.00002
> * Under **Automated Benefits**, select the credits benefit
> * Click **Create Product**

> [tab] CLI
>
> ```bash theme={null}
> export POLAR_PRODUCT_ID=$(polar products create --name "Pro" --recurring-interval month \
>   --prices '[
>     { "amount_type": "fixed", "price_amount": 2000 },
>     { "amount_type": "metered_unit", "meter_id": "'"$POLAR_METER_ID"'", "unit_amount": "0.002" }
>   ]' | jq -r .id)
>
> polar products update_benefits $POLAR_PRODUCT_ID --data '{ "benefits": ["'"$POLAR_BENEFIT_ID"'"] }'
> ```
>
> See [`polar products`](https://polar.sh/docs/integrate/cli/reference/products).

> [tab] Prompt
>
> ```text Prompt theme={null}
> In my Polar sandbox, create a monthly product called Pro for $20, with a metered price of $0.00002 per unit on the AI tokens meter, and attach the 100,000 AI tokens credits benefit.
> ```
>
> Uses the `products_create` and `products_update_benefits` operations of the [Polar MCP server](https://polar.sh/docs/integrate/mcp.md).

> [tab] Pricing as Code Beta
>
> Add the product, then draft and publish. The full billing config now reads:
>
> ```ts polar.config.ts theme={null}
> import { defineConfig, perMillion, usd } from '@polar-sh/config'
> import { z } from 'zod'
>
> export default defineConfig({
>   events: ({ event }) => ({
>     ai_usage: event(z.object({ model: z.string(), total_tokens: z.number() })),
>   }),
>   meters: ({ meter, events }) => ({
>     ai_tokens: meter('AI tokens').on(events.ai_usage).sum('total_tokens'),
>   }),
>   benefits: ({ credits }) => ({
>     ai_tokens_monthly: credits('100,000 AI tokens per month')
>       .meter('ai_tokens')
>       .units(100_000),
>   }),
>   products: ({ product, fixed, meter }) => ({
>     pro: product('Pro')
>       .prices(
>         fixed().amount(usd(20)),
>         meter('ai_tokens').flat().amount(perMillion(usd(20))),
>       )
>       .recurring('monthly')
>       .grants(['ai_tokens_monthly']),
>   }),
> })
> ```
>
> ```bash theme={null}
> polar config draft
> polar config publish
> ```
>
> `perMillion(usd(20))` is \$0.00002 per token. See [Billing config](https://polar.sh/docs/integrate/cli/config.md).

Customers now pay $20 a month. The first 100,000 tokens each month are covered by credits, and every token after that costs $0.00002.

> [!TIP]
>
> To protect customers from surprise bills, set a `cap_amount` on the metered price. To never bill for usage at all, leave out the metered price and sell credits only. See [Usage-based pricing](https://polar.sh/docs/features/usage-based-billing/billing.md).

## Verify it works

**Pro** has a \$20 monthly price, a metered price on **AI tokens**, and the credits benefit.

> [tab] Dashboard
>
> * Open **Catalog**
> * Select **Pro**
> * Check the prices and the benefit under **Automated Benefits**

> [tab] CLI
>
> ```bash theme={null}
> polar products get $POLAR_PRODUCT_ID
> ```

> [tab] Prompt
>
> ```text Prompt theme={null}
> Show the Pro product in my Polar sandbox with its prices and benefits.
> ```
>
> Uses the `products_get` operation of the [Polar MCP server](https://polar.sh/docs/integrate/mcp.md).

Save the product's ID as `POLAR_PRODUCT_ID` in your application's environment for [step 3](https://polar.sh/docs/quickstart/checkout.md). In the dashboard, open **Pro**'s menu and click **Copy Product ID**. The CLI example exports it already.

> [!TIP]
>
> Using [Pricing as Code](https://polar.sh/docs/features/pricing-as-code/overview.md)? Skip this and refer to the product by its external ID, `pro`. A Polar ID changes when a new [catalog version](https://polar.sh/docs/features/pricing-as-code/versioning.md) changes the product, but the external ID stays the same across versions.

## Learn more

| Resource | Description |
| - | - |
| [Products](https://polar.sh/docs/features/products.md) | Billing cycles, currencies, trials and archiving |
| [Usage-based pricing](https://polar.sh/docs/features/usage-based-billing/billing.md) | Unit, volume and graduated rates, caps and meter cycles |
| [Credits](https://polar.sh/docs/features/usage-based-billing/credits.md) | Credits-only spending and manual grants |
| [Benefits](https://polar.sh/docs/concepts/benefits.md) | License keys, feature flags, file downloads and more |
| [Pricing as Code](https://polar.sh/docs/features/pricing-as-code/overview.md) | Manage your catalog from a billing config in your repository |

> [card] [Next: Integrate checkout & customers](https://polar.sh/docs/quickstart/checkout.md)
>
> Link customers to your users and let them buy Pro.


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