---
title: "Catalog files"
description: "Every field of defineBillingCatalog, nested as a catalog file writes it, and the id map billing sync writes to billing.generated.ts."
canonical_url: "https://nuxt-backend.dev/docs/reference/configuration/catalogs"
---
# Catalog files

> Every field of defineBillingCatalog, nested as a catalog file writes it, and the id map billing sync writes to billing.generated.ts.

Version: nuxt-backend 0.6.x · Tab: Reference · Kind: reference · Status: stable

Every page: [llms.txt](https://nuxt-backend.dev/llms.txt) · Skill for coding agents: [nuxt-backend](https://nuxt-backend.dev/.well-known/skills/nuxt-backend/SKILL.md)

Commands use npm; use your project's package manager.

- [API reference](https://nuxt-backend.dev/docs/reference/api/billing)
- [Source](https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts)

`backend/billing.catalog.ts` declares what the app sells: meters, plans, credit packs and feature benefits, once, with `defineBillingCatalog`. `npx nuxt-backend billing sync` pushes it to the billing provider and writes the provider's ids to `backend/billing.generated.ts`. [Define and sync your catalog](https://nuxt-backend.dev/docs/build/billing/catalog) walks through it; this page lists the fields, generated from the catalog's types.

```ts [backend/billing.catalog.ts]
import { defineBillingCatalog } from 'nuxt-backend/billing'

export default defineBillingCatalog({
  meters: { credits: {} },
  plans: {
    pro: { name: 'Pro', prices: { month: 2900, year: 29000 }, credits: { meter: 'credits', units: 500 } },
  },
  packs: {
    credits500: { name: '500 credits', price: 2000, credits: { meter: 'credits', units: 500 } },
  },
})
```

## The catalog

### `BillingCatalog`

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      What it is
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        currency
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      ISO 4217 currency every single-currency <code>
        price
      </code>
      
       is created in, lowercase (<code>
        'usd'
      </code>
      
      , <code>
        'eur'
      </code>
      
      ), and the one a visitor pays in when the catalog does not price their own.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        meters
      </code>
    </td>
    
    <td>
      <code>
        Record<string, CatalogMeter>
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        plans
      </code>
    </td>
    
    <td>
      <code>
        Record<string, CatalogPlan>
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        packs
      </code>
    </td>
    
    <td>
      <code>
        Record<string, CatalogPack>
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        features
      </code>
    </td>
    
    <td>
      <code>
        Record<string, CatalogFeature>
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        quotas
      </code>
    </td>
    
    <td>
      <code>
        Record<string, CatalogQuota>
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      The quotas plans set, keyed by what <code>
        billing.requireQuota
      </code>
      
      , <code>
        useFeatures().quota()
      </code>
      
       and <code>
        <Gate quota>
      </code>
      
       name them by.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        customFields
      </code>
    </td>
    
    <td>
      <code>
        Record<string, CatalogCustomField>
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Checkout fields plans and packs can collect, keyed by catalog key.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        discounts
      </code>
    </td>
    
    <td>
      <code>
        Record<string, CatalogDiscount>
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Promotions: the provider's own discounts, declared here and kept in line by <code>
        billing sync
      </code>
      
      , keyed by what checkout names them by (<code>
        billing.checkout(ctx, { discount: 'launch' })
      </code>
      
      ).
    </td>
  </tr>
</tbody>
</table>

### `CatalogMeter`

A usage meter, keyed by the event name spends use (`spendCredits({ meter })`).

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      What it is
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        aggregation
      </code>
    </td>
    
    <td>
      <code>
        'sum' | 'count'
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      How events aggregate: <code>
        'sum'
      </code>
      
       (default) sums <code>
        property
      </code>
      
       across events — multi-credit spends in one event; <code>
        'count'
      </code>
      
       counts events (1 credit per event, not refundable).
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        property
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      The metadata property summed by <code>
        'sum'
      </code>
      
       meters.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        eventName
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Event name the meter filters on.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        unit
      </code>
    </td>
    
    <td>
      <code>
        MeterUnit
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      The unit it counts in, for the packaged labels ("Buy pages", "120 pages left."): <code>
        billing sync
      </code>
      
       writes it to the generated map, and the balance, pricing and usage reads carry it.
    </td>
  </tr>
</tbody>
</table>

### `CatalogPlan`

A subscription plan: one recurring product per priced interval.

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      What it is
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      yes
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        description
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        prices
      </code>
    </td>
    
    <td>
      <code>
        CatalogPlanPrices | CatalogCurrencyPrices
      </code>
    </td>
    
    <td>
      yes
    </td>
    
    <td>
      Price in cents per interval: <code>
        { month: 2900, year: 29000 }
      </code>
      
      , in the catalog's <code>
        BillingCatalog.currency
      </code>
      
      ; or per currency, <code>
        { usd: { month: 2900 }, eur: { month: 2700 } }
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        credits
      </code>
    </td>
    
    <td>
      <code>
        CatalogPlanCreditGrant
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Credits included with the plan, granted every cycle (see <code>
        CatalogPlanCreditGrant
      </code>
      
      ).
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        features
      </code>
    </td>
    
    <td>
      <code>
        string[]
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Feature-benefit keys (from <code>
        BillingCatalog.features
      </code>
      
      ) this plan grants.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        trial
      </code>
    </td>
    
    <td>
      <code>
        CatalogTrial
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Free trial before the first charge, on every interval.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        meterCycle
      </code>
    </td>
    
    <td>
      <code>
        'month'
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Run the plan's meters on a monthly cycle on every price: a yearly price then charges once a year while its credits are granted, and its usage invoiced, every month (the provider's meter cycle).
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        usage
      </code>
    </td>
    
    <td>
      <code>
        CatalogUsagePrice[]
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Metered prices charged on top of the fixed price (pay-as-you-go overage), every cycle.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        gift
      </code>
    </td>
    
    <td>
      <code>
        CatalogPlanGift
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Make the plan giftable as a pass, for these lengths: someone buys it once and a workspace on the free plan holds it for that long, with no card and no renewal.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        taxBehavior
      </code>
    </td>
    
    <td>
      <code>
        CatalogTaxBehavior
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Tax treatment of the price.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        customFields
      </code>
    </td>
    
    <td>
      <code>
        string[]
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Checkout field keys (from <code>
        BillingCatalog.customFields
      </code>
      
      ) to collect.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        retired
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Retire the plan: <code>
        billing sync
      </code>
      
       archives its products, so nobody new can check out or switch to it, while everyone subscribed keeps it, renews on it and can switch away.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        quotas
      </code>
    </td>
    
    <td>
      <code>
        Record<string, number | 'unlimited'>
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      How many of each quota (keys from <code>
        BillingCatalog.quotas
      </code>
      
      ) the plan allows: a whole number, or <code>
        'unlimited'
      </code>
      
      .
    </td>
  </tr>
</tbody>
</table>

### `CatalogPack`

A one-time credit pack.

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      What it is
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      yes
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        description
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        price
      </code>
    </td>
    
    <td>
      <code>
        number | CatalogPackPrices
      </code>
    </td>
    
    <td>
      yes
    </td>
    
    <td>
      Price in cents, in the catalog's <code>
        BillingCatalog.currency
      </code>
      
      ; or per currency, <code>
        { usd: 2000, eur: 1800 }
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        credits
      </code>
    </td>
    
    <td>
      <code>
        CatalogCreditGrant
      </code>
    </td>
    
    <td>
      yes
    </td>
    
    <td>
      Credits granted once at purchase.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        taxBehavior
      </code>
    </td>
    
    <td>
      <code>
        CatalogTaxBehavior
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Tax treatment of the price.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        customFields
      </code>
    </td>
    
    <td>
      <code>
        string[]
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Checkout field keys (from <code>
        BillingCatalog.customFields
      </code>
      
      ) to collect.
    </td>
  </tr>
</tbody>
</table>

### `CatalogCreditGrant`

A credit grant a plan or pack carries (a provider meter-credit benefit).

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      What it is
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        meter
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      yes
    </td>
    
    <td>
      The catalog meter key the credits land on.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        units
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      yes
    </td>
    
    <td>
      Units granted (per cycle for plans, once for packs).
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        rollover
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Carry unused credits into the next cycle.
    </td>
  </tr>
</tbody>
</table>

### `CatalogTrial`

A free trial the plan grants before its first charge: the provider's own, with the card taken at checkout.

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      What it is
    </th>
  </tr>
</thead>
</table>

### `CatalogUsagePrice`

A metered price billed on top of the plan's fixed price — pay-as-you-go overage, charged at the end of each cycle for what the meter recorded.

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      What it is
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        meter
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      yes
    </td>
    
    <td>
      The catalog meter key this price bills.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        unitAmount
      </code>
    </td>
    
    <td>
      <code>
        number | string
      </code>
    </td>
    
    <td>
      yes
    </td>
    
    <td>
      Price per unit in cents.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        cap
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Never charge more than this many cents per cycle, however much is used.
    </td>
  </tr>
</tbody>
</table>

### `CatalogFeature`

A feature benefit, gated by its key: in a function with `billing.requireFeature(ctx, key)` or the `withFeature(key)` tier, in the UI with `useFeatures().has(key)` and `<Gate feature>`.

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      What it is
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        description
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      yes
    </td>
    
    <td>
      
    </td>
  </tr>
</tbody>
</table>

### `CatalogQuota`

A quota: how many of a thing a billing entity may hold at once — projects, boards, sites — counted where the thing is made and given back where it is removed.

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      What it is
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        description
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      yes
    </td>
    
    <td>
      What it counts, as a sentence names it: <code>
        'projects'
      </code>
      
      , <code>
        'team boards'
      </code>
      
      .
    </td>
  </tr>
</tbody>
</table>

### `CatalogCustomField`

A field the checkout collects and stores on the order/subscription — the answers ride along to the provider dashboard and the webhook payloads.

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      What it is
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        type
      </code>
    </td>
    
    <td>
      <code>
        'text' | 'number' | 'checkbox' | 'date' | 'select'
      </code>
    </td>
    
    <td>
      yes
    </td>
    
    <td>
      Input type.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Label shown at checkout.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        slug
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Key the answer is stored under.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        required
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Checkout refuses to submit without an answer.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options
      </code>
    </td>
    
    <td>
      <code>
        Array<{ value: string, label: string }>
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Choices for <code>
        type: 'select'
      </code>
      
      .
    </td>
  </tr>
</tbody>
</table>

## The generated map

`billing.generated.ts` exports `catalog`, one id map per billing environment: `sandbox` and `production`. `billing sync` rewrites it, so never edit it by hand. Earlier previews also wrote a `simulated` map for the billing simulator, which is gone. Each map:

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      What it is
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        products
      </code>
    </td>
    
    <td>
      <code>
        Record<string, string>
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Product key → provider product id: packs by their catalog key, a plan's monthly price by the plan's key and its yearly one as <code>
        <plan>:year
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        plans
      </code>
    </td>
    
    <td>
      <code>
        Record<string, Partial<Record<CatalogInterval, string>>>
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Plan key → its product per priced interval, retired plans included.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        retired
      </code>
    </td>
    
    <td>
      <code>
        string[]
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      The keys of retired plans: archived at the provider, never sold again.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        packs
      </code>
    </td>
    
    <td>
      <code>
        string[]
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      The catalog keys of <code>
        products
      </code>
      
       that are credit packs: what a gift may buy.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        gifts
      </code>
    </td>
    
    <td>
      <code>
        Record<string, string>
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Pack key → the provider id of its private gift product: the same prices, no benefits, bought by a purchaser for someone else.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        passes
      </code>
    </td>
    
    <td>
      <code>
        Record<string, CatalogPassIds>
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Plan key → its gift as a plan pass: the private purchase product per length in months (<code>
        months
      </code>
      
      , keyed <code>
        '3'
      </code>
      
      ) and the one free pass product that carries the plan's benefits (<code>
        pass
      </code>
      
      ).
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        meters
      </code>
    </td>
    
    <td>
      <code>
        Record<string, CreditMeterConfig>
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Catalog key → credit meter config.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        quotas
      </code>
    </td>
    
    <td>
      <code>
        Record<string, string>
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Quota key → what it counts, as the catalog's <code>
        description
      </code>
      
       says it: each one is reported by <code>
        getFeatures
      </code>
      
       (as <code>
        useFeatures().quota()
      </code>
      
       reads it), granted or not.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        free
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      The free plan's key (<code>
        plans
      </code>
      
       holds its product): every billing entity starts on it, and returns to it when a paid plan ends.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        welcome
      </code>
    </td>
    
    <td>
      <code>
        { meter: string, units: number }
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      The free plan's welcome credits (<code>
        credits: { once: true }
      </code>
      
       in the catalog): the meter they land on and how many, granted once per person as the first billing entity they own first starts on the free plan.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        currency
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      The currency a visitor pays in when the catalog does not price theirs, lower-case ISO 4217: written for a catalog that prices more than one.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        discounts
      </code>
    </td>
    
    <td>
      <code>
        Record<string, BillingCatalogDiscount>
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Discount key → the discount and its terms.
    </td>
  </tr>
</tbody>
</table>


## Sitemap

See the full [sitemap](https://nuxt-backend.dev/sitemap.md) for all pages.
