---
title: "nuxt-backend/billing"
description: "Every export of nuxt-backend/billing, with its signature and where it is defined."
canonical_url: "https://nuxt-backend.dev/docs/reference/api/billing"
---
# nuxt-backend/billing

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.

## Classes

### ProviderUnsupportedError

Defined in: [src/convex/integrations/billing/providers/types.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts)

**Experimental**

A call a provider's API does not offer: the app shows the dashboard or the portal instead.

#### Extends

- `Error`

#### Constructors

##### Constructor

```ts
new ProviderUnsupportedError(
   provider, 
   operation, 
   hint
): ProviderUnsupportedError;
```

Defined in: [src/convex/integrations/billing/providers/types.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts)

**Experimental**

###### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        provider
      </code>
    </td>
    
    <td>
      <a href="#billingprovidername-3">
        <code>
          BillingProviderName
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        operation
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        hint
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
  </tr>
</tbody>
</table>

###### Returns

[`ProviderUnsupportedError`](#providerunsupportederror)

###### Overrides

`Error.constructor`

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Modifier
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Default value
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Overrides
    </th>
    
    <th>
      Inherited from
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="name-5">
        
      </a>
      
       <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        readonly
      </code>
    </td>
    
    <td>
      <code>
        "ProviderUnsupportedError"
      </code>
    </td>
    
    <td>
      <code>
        'ProviderUnsupportedError'
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      <code>
        Error.name
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="provider-1">
        
      </a>
      
       <code>
        provider
      </code>
    </td>
    
    <td>
      <code>
        readonly
      </code>
    </td>
    
    <td>
      <a href="#billingprovidername-3">
        <code>
          BillingProviderName
        </code>
      </a>
    </td>
    
    <td>
      <code>
        undefined
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="operation">
        
      </a>
      
       <code>
        operation
      </code>
    </td>
    
    <td>
      <code>
        readonly
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        undefined
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="cause">
        
      </a>
      
       <code>
        cause?
      </code>
    </td>
    
    <td>
      <code>
        public
      </code>
    </td>
    
    <td>
      <code>
        unknown
      </code>
    </td>
    
    <td>
      <code>
        undefined
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <code>
        Error.cause
      </code>
    </td>
    
    <td>
      node_modules/typescript/lib/lib.es2022.error.d.ts:24
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="message">
        
      </a>
      
       <code>
        message
      </code>
    </td>
    
    <td>
      <code>
        public
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        undefined
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <code>
        Error.message
      </code>
    </td>
    
    <td>
      node_modules/typescript/lib/lib.es5.d.ts:1075
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="stack">
        
      </a>
      
       <code>
        stack?
      </code>
    </td>
    
    <td>
      <code>
        public
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        undefined
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <code>
        Error.stack
      </code>
    </td>
    
    <td>
      node_modules/typescript/lib/lib.es5.d.ts:1076
    </td>
  </tr>
</tbody>
</table>

---

### ProviderHttpError

Defined in: [src/convex/integrations/billing/providers/types.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts)

**Experimental**

A provider's HTTP answer that was not a success. `statusCode` is read by
provider-failure.ts to tell a provider having trouble (408, 429, 5xx) from
one refusing the request. The body is never kept: it echoes the request.

#### Extends

- `Error`

#### Constructors

##### Constructor

```ts
new ProviderHttpError(
   provider, 
   operation, 
   statusCode, 
   code?
): ProviderHttpError;
```

Defined in: [src/convex/integrations/billing/providers/types.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts)

**Experimental**

###### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        provider
      </code>
    </td>
    
    <td>
      <a href="#billingprovidername-3">
        <code>
          BillingProviderName
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        operation
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        statusCode
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        code?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
  </tr>
</tbody>
</table>

###### Returns

[`ProviderHttpError`](#providerhttperror)

###### Overrides

`Error.constructor`

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Modifier
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Default value
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Overrides
    </th>
    
    <th>
      Inherited from
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="name-6">
        
      </a>
      
       <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        readonly
      </code>
    </td>
    
    <td>
      <code>
        "ProviderHttpError"
      </code>
    </td>
    
    <td>
      <code>
        'ProviderHttpError'
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      <code>
        Error.name
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="provider-2">
        
      </a>
      
       <code>
        provider
      </code>
    </td>
    
    <td>
      <code>
        readonly
      </code>
    </td>
    
    <td>
      <a href="#billingprovidername-3">
        <code>
          BillingProviderName
        </code>
      </a>
    </td>
    
    <td>
      <code>
        undefined
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="operation-1">
        
      </a>
      
       <code>
        operation
      </code>
    </td>
    
    <td>
      <code>
        readonly
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        undefined
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="statuscode">
        
      </a>
      
       <code>
        statusCode
      </code>
    </td>
    
    <td>
      <code>
        readonly
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        undefined
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="code-1">
        
      </a>
      
       <code>
        code
      </code>
    </td>
    
    <td>
      <code>
        readonly
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
    </td>
    
    <td>
      <code>
        undefined
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="cause-1">
        
      </a>
      
       <code>
        cause?
      </code>
    </td>
    
    <td>
      <code>
        public
      </code>
    </td>
    
    <td>
      <code>
        unknown
      </code>
    </td>
    
    <td>
      <code>
        undefined
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <code>
        Error.cause
      </code>
    </td>
    
    <td>
      node_modules/typescript/lib/lib.es2022.error.d.ts:24
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="message-1">
        
      </a>
      
       <code>
        message
      </code>
    </td>
    
    <td>
      <code>
        public
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        undefined
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <code>
        Error.message
      </code>
    </td>
    
    <td>
      node_modules/typescript/lib/lib.es5.d.ts:1075
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="stack-1">
        
      </a>
      
       <code>
        stack?
      </code>
    </td>
    
    <td>
      <code>
        public
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        undefined
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <code>
        Error.stack
      </code>
    </td>
    
    <td>
      node_modules/typescript/lib/lib.es5.d.ts:1076
    </td>
  </tr>
</tbody>
</table>

## Interfaces

### CatalogCreditGrant

Defined in: [src/convex/catalog.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts)

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

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="meter">
        
      </a>
      
       <code>
        meter
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The catalog meter key the credits land on.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="units">
        
      </a>
      
       <code>
        units
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Units granted (per cycle for plans, once for packs).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="rollover">
        
      </a>
      
       <code>
        rollover?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Carry unused credits into the next cycle. Defaults to <code>
        false
      </code>
      
       for plan grants (use-it-or-lose-it monthly allowances) and <code>
        true
      </code>
      
       for packs (purchased credits keep).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### MeterUnit

Defined in: [src/convex/catalog.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts)

What a meter counts, as the packaged labels name it: its word for each
plural category of the language (`Intl.PluralRules`), `one` and
`other` at least — `{ one: 'page', other: 'pages' }`. A language with
more forms names them too (`few` and `many` in Russian); a category it
leaves out reads as `other`, and a heading as `other` with a capital.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="one">
        
      </a>
      
       <code>
        one
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="other">
        
      </a>
      
       <code>
        other
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="zero">
        
      </a>
      
       <code>
        zero?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="two">
        
      </a>
      
       <code>
        two?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="few">
        
      </a>
      
       <code>
        few?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="many">
        
      </a>
      
       <code>
        many?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### CatalogMeter

Defined in: [src/convex/catalog.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts)

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

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="aggregation">
        
      </a>
      
       <code>
        aggregation?
      </code>
    </td>
    
    <td>
      <code>
        "count"
      </code>
      
       | <code>
        "sum"
      </code>
    </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>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="property">
        
      </a>
      
       <code>
        property?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The metadata property summed by <code>
        'sum'
      </code>
      
       meters. Default <code>
        'amount'
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="eventname">
        
      </a>
      
       <code>
        eventName?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Event name the meter filters on. Defaults to the catalog key.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="unit">
        
      </a>
      
       <code>
        unit?
      </code>
    </td>
    
    <td>
      <a href="#meterunit">
        <code>
          MeterUnit
        </code>
      </a>
    </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. Without it they say "credits", in every language the package speaks.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### CatalogPlanPrices

Defined in: [src/convex/catalog.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts)

A plan's prices in cents, one per billing interval it is sold at. Each
becomes a product of its own at the provider, tagged with the plan's key
and the interval, so a subscriber switches between them like between
plans. At least one is required. A plan priced `{ month: 0 }` is the
catalog's free plan (see [CatalogPlan.prices](#prices)).

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="month">
        
      </a>
      
       <code>
        month?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Billed every month.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="year">
        
      </a>
      
       <code>
        year?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Billed every year.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### CatalogPlanCreditGrant

Defined in: [src/convex/catalog.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts)

A plan's credit grant, given every billing cycle — a month on the monthly
price, a year on the yearly one. `units` as a number is the monthly
allowance, and the yearly product grants twelve times it once a year;
`{ month, year }` sets each cycle's grant yourself.

#### Extends

- `Omit`<[`CatalogCreditGrant`](#catalogcreditgrant), `"units"`>

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Inherited from
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="meter-1">
        
      </a>
      
       <code>
        meter
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The catalog meter key the credits land on.
    </td>
    
    <td>
      <a href="#catalogcreditgrant">
        <code>
          CatalogCreditGrant
        </code>
      </a>
      
      .<a href="#meter">
        <code>
          meter
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="rollover-1">
        
      </a>
      
       <code>
        rollover?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Carry unused credits into the next cycle. Defaults to <code>
        false
      </code>
      
       for plan grants (use-it-or-lose-it monthly allowances) and <code>
        true
      </code>
      
       for packs (purchased credits keep).
    </td>
    
    <td>
      <a href="#catalogcreditgrant">
        <code>
          CatalogCreditGrant
        </code>
      </a>
      
      .<a href="#rollover">
        <code>
          rollover
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="units-1">
        
      </a>
      
       <code>
        units
      </code>
    </td>
    
    <td>
      | <code>
        number
      </code>
      
       | <code>
        Partial
      </code>
      
      <<code>
        Record
      </code>
      
      <<a href="#cataloginterval">
        <code>
          CatalogInterval
        </code>
      </a>
      
      , <code>
        number
      </code>
      
      >>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="once">
        
      </a>
      
       <code>
        once?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Grant the credits once, as welcome credits, instead of every cycle: the free plan's alone. Each person gets <code>
        units
      </code>
      
       (a whole number) once, when the first billing entity they own first starts on the free plan, as soon as the reverse trial begins if the catalog has one (not when it ends), and never again: not for a second workspace, an account made again with their address, a retry or a concurrent start. The person is the owner's address, tags and dots taken out, kept as a hash, as the reverse trial counts it (outside production, a <code>
        delivered+<label>@resend.dev
      </code>
      
       sandbox address whole). <code>
        billing sync
      </code>
      
       pushes no credit benefit for them: they land as a refund-shaped usage event on a sum meter (<code>
        meter
      </code>
      
       needs a <code>
        property
      </code>
      
      ), keyed <code>
        welcome:<entityId>
      </code>
      
      .
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### CatalogPlanGift

Defined in: [src/convex/catalog.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts)

A plan's gift as a pass: the lengths it is sold for.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="months">
        
      </a>
      
       <code>
        months
      </code>
    </td>
    
    <td>
      readonly (<code>
        1
      </code>
      
       | <code>
        3
      </code>
      
       | <code>
        12
      </code>
      
      )<span>
        
      </span>
    </td>
    
    <td>
      Which of 1, 3 and 12 months the plan can be gifted for.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### CatalogPlan

Defined in: [src/convex/catalog.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts)

A subscription plan: one recurring product per priced interval.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="name">
        
      </a>
      
       <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="description">
        
      </a>
      
       <code>
        description?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="prices">
        
      </a>
      
       <code>
        prices
      </code>
    </td>
    
    <td>
      | <a href="#catalogplanprices">
        <code>
          CatalogPlanPrices
        </code>
      </a>
      
       | <a href="#catalogcurrencyprices">
        <code>
          CatalogCurrencyPrices
        </code>
      </a>
    </td>
    
    <td>
      Price in cents per interval: <code>
        { month: 2900, year: 29000 }
      </code>
      
      , in the catalog's <a href="#currency">
        BillingCatalog.currency
      </a>
      
      ; or per currency, <code>
        { usd: { month: 2900 }, eur: { month: 2700 } }
      </code>
      
      . <code>
        { month: 0 }
      </code>
      
       makes the plan the catalog's free plan: a real subscription the provider holds, started for every new billing entity and again whenever a paid plan ends, so its credits and features are granted like any plan's. A catalog has at most one, priced by the month only, with no trial and no <code>
        usage
      </code>
      
      ; it is never checked out, and a checkout of a paid plan upgrades it in place.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="credits">
        
      </a>
      
       <code>
        credits?
      </code>
    </td>
    
    <td>
      <a href="#catalogplancreditgrant">
        <code>
          CatalogPlanCreditGrant
        </code>
      </a>
    </td>
    
    <td>
      Credits included with the plan, granted every cycle (see <a href="#catalogplancreditgrant">
        CatalogPlanCreditGrant
      </a>
      
      ).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="features">
        
      </a>
      
       <code>
        features?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      Feature-benefit keys (from <a href="#features-1">
        BillingCatalog.features
      </a>
      
      ) this plan grants.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="trial">
        
      </a>
      
       <code>
        trial?
      </code>
    </td>
    
    <td>
      <code>
        CatalogTrial
      </code>
    </td>
    
    <td>
      Free trial before the first charge, on every interval. <code>
        billing sync
      </code>
      
       pushes a change to it. <code>
        { pass: true }
      </code>
      
       makes it a reverse trial: a pass every new workspace starts on, with no card.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="metercycle">
        
      </a>
      
       <code>
        meterCycle?
      </code>
    </td>
    
    <td>
      <code>
        "month"
      </code>
    </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). <code>
        billing sync
      </code>
      
       sets it on the plan's yearly product as it creates it; the provider never changes a product's meter cycle afterwards.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="usage">
        
      </a>
      
       <code>
        usage?
      </code>
    </td>
    
    <td>
      <code>
        CatalogUsagePrice
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      Metered prices charged on top of the fixed price (pay-as-you-go overage), every cycle.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="gift">
        
      </a>
      
       <code>
        gift?
      </code>
    </td>
    
    <td>
      <a href="#catalogplangift">
        <code>
          CatalogPlanGift
        </code>
      </a>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       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. <code>
        billing sync
      </code>
      
       makes two private products for it: a one-time purchase product per length (the months at the monthly price, 12 at the yearly one when the plan has it) and one free pass product carrying the plan's benefits. Needs a free plan to return to.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="taxbehavior">
        
      </a>
      
       <code>
        taxBehavior?
      </code>
    </td>
    
    <td>
      <code>
        CatalogTaxBehavior
      </code>
    </td>
    
    <td>
      Tax treatment of the price. Defaults to the organization's setting.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="customfields">
        
      </a>
      
       <code>
        customFields?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      Checkout field keys (from <a href="#customfields-2">
        BillingCatalog.customFields
      </a>
      
      ) to collect.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="retired">
        
      </a>
      
       <code>
        retired?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </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. Keep a retired plan in the catalog — its ids stay in the generated map, so a subscriber's plan still reads back by its key.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="quotas">
        
      </a>
      
       <code>
        quotas?
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        number
      </code>
      
       | <code>
        "unlimited"
      </code>
      
      >
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       How many of each quota (keys from <a href="#quotas-1">
        BillingCatalog.quotas
      </a>
      
      ) the plan allows: a whole number, or <code>
        'unlimited'
      </code>
      
      . A quota the plan leaves out allows none. <code>
        billing sync
      </code>
      
       pushes them as one feature-flag benefit on the plan's products, <code>
        <plan>-quotas
      </code>
      
      , and pushes a change to them; a plan that drops them all keeps the benefit, its limits cleared.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### CatalogPack

Defined in: [src/convex/catalog.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts)

A one-time credit pack.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="name-1">
        
      </a>
      
       <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="description-1">
        
      </a>
      
       <code>
        description?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="price">
        
      </a>
      
       <code>
        price
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <a href="#catalogpackprices">
        <code>
          CatalogPackPrices
        </code>
      </a>
    </td>
    
    <td>
      Price in cents, in the catalog's <a href="#currency">
        BillingCatalog.currency
      </a>
      
      ; or per currency, <code>
        { usd: 2000, eur: 1800 }
      </code>
      
      . A pack's gift twin carries every one of them.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="credits-1">
        
      </a>
      
       <code>
        credits
      </code>
    </td>
    
    <td>
      <a href="#catalogcreditgrant">
        <code>
          CatalogCreditGrant
        </code>
      </a>
    </td>
    
    <td>
      Credits granted once at purchase.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="taxbehavior-1">
        
      </a>
      
       <code>
        taxBehavior?
      </code>
    </td>
    
    <td>
      <code>
        CatalogTaxBehavior
      </code>
    </td>
    
    <td>
      Tax treatment of the price. Defaults to the organization's setting.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="customfields-1">
        
      </a>
      
       <code>
        customFields?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      Checkout field keys (from <a href="#customfields-2">
        BillingCatalog.customFields
      </a>
      
      ) to collect.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### CatalogFeature

Defined in: [src/convex/catalog.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts)

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>`. Pushed
as the provider's native feature-flag benefit; the catalog key rides along
in the benefit metadata, which is what every gate matches on.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="description-2">
        
      </a>
      
       <code>
        description
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### CatalogQuota

Defined in: [src/convex/catalog.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts)

**Experimental**

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. It never resets on a billing period: an allowance per period
is what credits and meters are for. Each plan says how many it allows
([CatalogPlan.quotas](#quotas)); one it does not name allows none. Never
people: a quota on members, seats, users, teammates, collaborators,
guests or people is refused, since a plan here is never priced per seat.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="description-3">
        
      </a>
      
       <code>
        description
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       What it counts, as a sentence names it: <code>
        'projects'
      </code>
      
      , <code>
        'team boards'
      </code>
      
      . <code>
        billing sync
      </code>
      
       writes it to the generated map, <code>
        getFeatures
      </code>
      
       reports it with the quota, <code>
        <Gate quota>
      </code>
      
       says it ("You have used 3 of 3 projects") unless given a <code>
        name
      </code>
      
      , and DevTools shows it.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### CatalogDiscountProducts

Defined in: [src/convex/catalog.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts)

What a discount applies to: the catalog's plans and packs, by key. Never
every product: one the discount does not list is never discounted, and
a product created later is not either.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="plans">
        
      </a>
      
       <code>
        plans?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      Plan keys. Their prices at every interval, or at <code>
        interval
      </code>
      
       only.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="interval">
        
      </a>
      
       <code>
        interval?
      </code>
    </td>
    
    <td>
      <a href="#cataloginterval">
        <code>
          CatalogInterval
        </code>
      </a>
    </td>
    
    <td>
      Only the plans' prices at this interval.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="packs">
        
      </a>
      
       <code>
        packs?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      Pack keys.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### CatalogDiscountTerms

Defined in: [src/convex/catalog.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts)

What every catalog discount says beside its amount (see [CatalogDiscount](#catalogdiscount)).

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="name-2">
        
      </a>
      
       <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The name the customer sees at checkout and on the invoice.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="duration">
        
      </a>
      
       <code>
        duration
      </code>
    </td>
    
    <td>
      <a href="#catalogdiscountduration">
        <code>
          CatalogDiscountDuration
        </code>
      </a>
    </td>
    
    <td>
      How long it takes money off (see <a href="#catalogdiscountduration">
        CatalogDiscountDuration
      </a>
      
      ).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="code">
        
      </a>
      
       <code>
        code?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      A code customers type at checkout and a campaign link carries: 3 to 64 letters and digits, unique among the catalog's discounts. A discount with a code is public: anyone who knows the code can use it, and a client may name it by key (<code>
        useBilling().checkout(id, { discount })
      </code>
      
      ). One without a code is the server's alone: <code>
        billing.checkout(ctx, { discount })
      </code>
      
       or the <code>
        checkoutDiscount
      </code>
      
       hook applies it.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="maxredemptions">
        
      </a>
      
       <code>
        maxRedemptions?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      How many times it may be redeemed in all.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="percustomer">
        
      </a>
      
       <code>
        perCustomer?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      How many times one customer may redeem it.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="startsat">
        
      </a>
      
       <code>
        startsAt?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        Date
      </code>
    </td>
    
    <td>
      When it can first be redeemed: an ISO date-time (a date alone is the start of that day, UTC).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="endsat">
        
      </a>
      
       <code>
        endsAt?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        Date
      </code>
    </td>
    
    <td>
      When it can no longer be redeemed: the real end of the offer, which <code>
        <PricingTable>
      </code>
      
       shows as a date. Customers who redeemed it keep it for its duration.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="products">
        
      </a>
      
       <code>
        products
      </code>
    </td>
    
    <td>
      <a href="#catalogdiscountproducts">
        <code>
          CatalogDiscountProducts
        </code>
      </a>
    </td>
    
    <td>
      The plans and packs it applies to: at least one.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="retired-1">
        
      </a>
      
       <code>
        retired?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Retire it: <code>
        billing sync
      </code>
      
       ends it now and frees its code, so nobody new redeems it, while everyone who did keeps it for its duration. A changed amount or duration after the first redemption is published this way: retire the key and declare the new terms under another.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### BillingCatalog

Defined in: [src/convex/catalog.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="currency">
        
      </a>
      
       <code>
        currency?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </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. Defaults to the organization's default presentment currency, which the provider requires on every product: a per-currency price names it too.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="meters">
        
      </a>
      
       <code>
        meters?
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <a href="#catalogmeter">
        <code>
          CatalogMeter
        </code>
      </a>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="plans-1">
        
      </a>
      
       <code>
        plans?
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <a href="#catalogplan">
        <code>
          CatalogPlan
        </code>
      </a>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="packs-1">
        
      </a>
      
       <code>
        packs?
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <a href="#catalogpack">
        <code>
          CatalogPack
        </code>
      </a>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="features-1">
        
      </a>
      
       <code>
        features?
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <a href="#catalogfeature">
        <code>
          CatalogFeature
        </code>
      </a>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="quotas-1">
        
      </a>
      
       <code>
        quotas?
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <a href="#catalogquota">
        <code>
          CatalogQuota
        </code>
      </a>
      
      >
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       The quotas plans set, keyed by what <code>
        billing.requireQuota
      </code>
      
      , <code>
        useFeatures().quota()
      </code>
      
       and <code>
        <Gate quota>
      </code>
      
       name them by.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="customfields-2">
        
      </a>
      
       <code>
        customFields?
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        CatalogCustomField
      </code>
      
      >
    </td>
    
    <td>
      Checkout fields plans and packs can collect, keyed by catalog key.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="discounts">
        
      </a>
      
       <code>
        discounts?
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <a href="#catalogdiscount">
        <code>
          CatalogDiscount
        </code>
      </a>
      
      >
    </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>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts" rel="nofollow">
        src/convex/catalog.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### CommerceWebhookOptions

Defined in: [src/convex/integrations/billing/commerce-webhooks.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/commerce-webhooks.ts)

The options of [createCommerceWebhookHandler](#createcommercewebhookhandler).

#### Type Parameters

<table>
<thead>
  <tr>
    <th>
      Type Parameter
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="type-parameter-ctx-1">
        
      </a>
      
       <code>
        Ctx
      </code>
    </td>
  </tr>
</tbody>
</table>

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="provider">
        
      </a>
      
       <code>
        provider
      </code>
    </td>
    
    <td>
      <a href="#commerceprovider">
        <code>
          CommerceProvider
        </code>
      </a>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/commerce-webhooks.ts" rel="nofollow">
        src/convex/integrations/billing/commerce-webhooks.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="secrets">
        
      </a>
      
       <code>
        secrets
      </code>
    </td>
    
    <td>
      readonly <code>
        string
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      The accepted signing secrets, first entry primary (<code>
        BILLING_WEBHOOK_SECRET
      </code>
      
      , comma-separated while rotating).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/commerce-webhooks.ts" rel="nofollow">
        src/convex/integrations/billing/commerce-webhooks.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="webhooklog">
        
      </a>
      
       <code>
        webhookLog
      </code>
    </td>
    
    <td>
      <code>
        WebhookLogRefs
      </code>
    </td>
    
    <td>
      <code>
        components.backend.webhooks
      </code>
      
      : the delivery log the dedupe reads.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/commerce-webhooks.ts" rel="nofollow">
        src/convex/integrations/billing/commerce-webhooks.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="onevent">
        
      </a>
      
       <code>
        onEvent
      </code>
    </td>
    
    <td>
      <a href="#commerceeventhandler">
        <code>
          CommerceEventHandler
        </code>
      </a>
      
      <<code>
        Ctx
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/commerce-webhooks.ts" rel="nofollow">
        src/convex/integrations/billing/commerce-webhooks.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### DigitalContentConsent

Defined in: [src/convex/integrations/billing/providers/consent.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/consent.ts)

What the buyer agreed to, as a checkout records it.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="at">
        
      </a>
      
       <code>
        at
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      When they ticked it, in Unix milliseconds.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/consent.ts" rel="nofollow">
        src/convex/integrations/billing/providers/consent.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="version">
        
      </a>
      
       <code>
        version
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/consent.ts" rel="nofollow">
        src/convex/integrations/billing/providers/consent.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="texthash">
        
      </a>
      
       <code>
        textHash
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The SHA-256 hex of the exact text shown, in the language shown.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/consent.ts" rel="nofollow">
        src/convex/integrations/billing/providers/consent.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### ProviderCapabilities

Defined in: [src/convex/integrations/billing/providers/types.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts)

What one provider can do through its API, for the doctor, the docs and a refusal that names what is missing.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="onetime">
        
      </a>
      
       <code>
        oneTime
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      One-time purchases (a comic issue, a credit pack).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="subscriptions">
        
      </a>
      
       <code>
        subscriptions
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Renewing subscriptions.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="customerportal">
        
      </a>
      
       <code>
        customerPortal
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      A hosted page where customers manage payment methods, invoices and cancellation.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="changeplan">
        
      </a>
      
       <code>
        changePlan
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Moving a subscription to another product, with proration.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="cancelatperiodend">
        
      </a>
      
       <code>
        cancelAtPeriodEnd
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Cancelling at period end, and taking that back before it ends.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="uncancel">
        
      </a>
      
       <code>
        uncancel
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Taking a scheduled cancellation back through the API.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="pause">
        
      </a>
      
       <code>
        pause
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Pausing and resuming a subscription.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="refundapi">
        
      </a>
      
       <code>
        refundApi
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Refunding an order through the API (every provider refunds from its dashboard).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="invoices">
        
      </a>
      
       <code>
        invoices
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      A link to, or the bytes of, an order's invoice or receipt.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="discountcodes">
        
      </a>
      
       <code>
        discountCodes
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Discount or promotion codes at checkout.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="signedredirect">
        
      </a>
      
       <code>
        signedRedirect
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      The provider signs the query it appends to the success URL, so the success page can trust its ids.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="merchantofrecord">
        
      </a>
      
       <code>
        merchantOfRecord
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      The provider sells as merchant of record: it is the seller, and files and remits sales tax and VAT.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="sendsreceipts">
        
      </a>
      
       <code>
        sendsReceipts
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      The provider emails receipts and invoices itself.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### CheckoutCustomer

Defined in: [src/convex/integrations/billing/providers/types.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts)

A checkout's buyer, as the app knows them.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="entityid">
        
      </a>
      
       <code>
        entityId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The billing entity id the order belongs to (the workspace or the user): stored on the provider as metadata and as the external reference.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="email">
        
      </a>
      
       <code>
        email?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="name-3">
        
      </a>
      
       <code>
        name?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="providercustomerid">
        
      </a>
      
       <code>
        providerCustomerId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The provider's own customer id, once one exists: the checkout reuses it instead of making another.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### CheckoutRequest

Defined in: [src/convex/integrations/billing/providers/types.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts)

What a checkout sells.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="productid">
        
      </a>
      
       <code>
        productId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The provider's product id (Dodo, Creem, Polar) or price id (Stripe).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="kind">
        
      </a>
      
       <code>
        kind
      </code>
    </td>
    
    <td>
      <code>
        "one_time"
      </code>
      
       | <code>
        "subscription"
      </code>
    </td>
    
    <td>
      Whether the product renews: Stripe needs to know (<code>
        mode
      </code>
      
      ), the others read it off the product.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="quantity">
        
      </a>
      
       <code>
        quantity?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="customer">
        
      </a>
      
       <code>
        customer
      </code>
    </td>
    
    <td>
      <a href="#checkoutcustomer">
        <code>
          CheckoutCustomer
        </code>
      </a>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="successurl">
        
      </a>
      
       <code>
        successUrl
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Where the provider sends the buyer after paying.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="cancelurl">
        
      </a>
      
       <code>
        cancelUrl?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Where it sends a buyer who leaves (Stripe, Dodo).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="discountcode">
        
      </a>
      
       <code>
        discountCode?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      A discount or promotion code the buyer entered.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="allowdiscountcodes">
        
      </a>
      
       <code>
        allowDiscountCodes?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      <code>
        false
      </code>
      
       keeps the buyer from entering a code on the hosted page (Dodo's <code>
        allow_discount_code
      </code>
      
      ). Stripe takes a code only when one is passed, and Creem's page has no switch for it.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="locale">
        
      </a>
      
       <code>
        locale?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The checkout page's language, as a BCP 47 tag (Stripe).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="trialdays">
        
      </a>
      
       <code>
        trialDays?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Free trial length in days, for a subscription (Stripe, Dodo).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="metadata">
        
      </a>
      
       <code>
        metadata?
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
      >
    </td>
    
    <td>
      Metadata carried through to the order, the subscription and their events (refund and dispute events carry only the order's or the subscription's id). The adapter adds <code>
        entity_id
      </code>
      
       (and Stripe <code>
        product_id
      </code>
      
      , the price, which its session does not echo) and no consent: to keep the digital-content consent with the sale, record the buyer's explicit acceptance with <code>
        recordDigitalContentConsent
      </code>
      
       and pass <code>
        consentMetadata(...)
      </code>
      
       in here. Keys and values stay short: Stripe caps a key at 40 characters and a value at 500.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="idempotencykey">
        
      </a>
      
       <code>
        idempotencyKey?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      A key that makes a retried create return the first checkout instead of a second one. Only Stripe honors it (<code>
        Idempotency-Key
      </code>
      
      ). Creem keeps it as <code>
        request_id
      </code>
      
      , a reference it echoes, not a dedupe; Dodo takes none. On those two a retry can open a second checkout, and a buyer could pay both: keep the open checkout's URL and send the buyer back to it, and refund a second <code>
        order.paid
      </code>
      
       for the same purchase.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### CheckoutSession

Defined in: [src/convex/integrations/billing/providers/types.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts)

A created checkout: the page to send the buyer to.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="id">
        
      </a>
      
       <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="url">
        
      </a>
      
       <code>
        url
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### NeutralSubscription

Defined in: [src/convex/integrations/billing/providers/types.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts)

A subscription as every provider reports it, in the package's words.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="id-1">
        
      </a>
      
       <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="customerid">
        
      </a>
      
       <code>
        customerId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="entityid-1">
        
      </a>
      
       <code>
        entityId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      The billing entity id the checkout carried in its metadata, when it did.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="productid-1">
        
      </a>
      
       <code>
        productId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="status">
        
      </a>
      
       <code>
        status
      </code>
    </td>
    
    <td>
      <a href="#neutralsubscriptionstatus">
        <code>
          NeutralSubscriptionStatus
        </code>
      </a>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="cancelatperiodend-1">
        
      </a>
      
       <code>
        cancelAtPeriodEnd
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Whether it ends at the end of the current period instead of renewing.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="currentperiodstart">
        
      </a>
      
       <code>
        currentPeriodStart?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      When the current period started, in Unix milliseconds, where the provider says: a change of interval starts a new period there, never at the old one's end. Without it, a later end reads as a renewal.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="currentperiodend">
        
      </a>
      
       <code>
        currentPeriodEnd
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      When the current period ends (and the next charge falls), in Unix milliseconds.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="amount">
        
      </a>
      
       <code>
        amount?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      What each renewal charges before tax, in the minor unit of <a href="#currency-1">
        currency
      </a>
      
      , as the provider holds it: the price it bills, which can differ from the catalog's (another currency for the buyer's country, or a price edited in the dashboard). Absent where the delivery does not say.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="currency-1">
        
      </a>
      
       <code>
        currency?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      The currency <a href="#amount">
        amount
      </a>
      
       is in, ISO 4217 lowercase.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="scheduledchange">
        
      </a>
      
       <code>
        scheduledChange?
      </code>
    </td>
    
    <td>
      | { <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        appliesAt
      </code>
      
      : <code>
        number
      </code>
      
      ; } | <code>
        null
      </code>
    </td>
    
    <td>
      The plan change the provider has scheduled for a later date (a downgrade at the period's end): <code>
        null
      </code>
      
       when it holds none, absent when the delivery does not say (a Stripe webhook names its schedule by id only).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="observedat">
        
      </a>
      
       <code>
        observedAt?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      When the provider held what a delivery says, in Unix milliseconds: its event's time, or its read's for one read whole. Orders the delivery's <a href="#scheduledchange">
        scheduledChange
      </a>
      
       against a lifecycle answer, so a late or retried delivery never undoes a newer change. Absent where the delivery does not say.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="metadata-1">
        
      </a>
      
       <code>
        metadata
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### NeutralOrder

Defined in: [src/convex/integrations/billing/providers/types.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts)

An order (a one-time purchase or a subscription's charge) in neutral words.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="id-2">
        
      </a>
      
       <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="customerid-1">
        
      </a>
      
       <code>
        customerId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="entityid-2">
        
      </a>
      
       <code>
        entityId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="productid-2">
        
      </a>
      
       <code>
        productId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="subscriptionid">
        
      </a>
      
       <code>
        subscriptionId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="amount-1">
        
      </a>
      
       <code>
        amount
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      The amount charged in the currency's minor unit, tax included.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="taxamount">
        
      </a>
      
       <code>
        taxAmount
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      The tax in it, in the minor unit, when the provider reports it.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="currency-2">
        
      </a>
      
       <code>
        currency
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      ISO 4217, lowercase.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="metadata-2">
        
      </a>
      
       <code>
        metadata
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### NeutralRefund

Defined in: [src/convex/integrations/billing/providers/types.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts)

A refund in neutral words.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="id-3">
        
      </a>
      
       <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="orderid">
        
      </a>
      
       <code>
        orderId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="subscriptionid-1">
        
      </a>
      
       <code>
        subscriptionId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="amount-2">
        
      </a>
      
       <code>
        amount
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="currency-3">
        
      </a>
      
       <code>
        currency
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="status-1">
        
      </a>
      
       <code>
        status
      </code>
    </td>
    
    <td>
      <code>
        "failed"
      </code>
      
       | <code>
        "pending"
      </code>
      
       | <code>
        "succeeded"
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### VerifiedDelivery

Defined in: [src/convex/integrations/billing/providers/types.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts)

A verified delivery: its id (for the redelivery dedupe) and what it means.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="id-4">
        
      </a>
      
       <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="event">
        
      </a>
      
       <code>
        event
      </code>
    </td>
    
    <td>
      <a href="#neutralbillingevent">
        <code>
          NeutralBillingEvent
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### ChangePlanRequest

Defined in: [src/convex/integrations/billing/providers/types.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts)

Changing a subscription's product.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="subscriptionid-2">
        
      </a>
      
       <code>
        subscriptionId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="productid-3">
        
      </a>
      
       <code>
        productId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="proration">
        
      </a>
      
       <code>
        proration
      </code>
    </td>
    
    <td>
      <code>
        "next_period"
      </code>
      
       | <code>
        "immediately"
      </code>
    </td>
    
    <td>
      Charge (or credit) the difference now, or schedule the change for the period's end, the old plan kept until then and the new one billed from the renewal: a Stripe subscription schedule, Dodo's <code>
        effective_at: next_billing_date
      </code>
      
      . Creem has no schedule: its <code>
        next_period
      </code>
      
       switches at once and bills the new price from the renewal.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="quantity-1">
        
      </a>
      
       <code>
        quantity?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      The new quantity. Creem refuses it: its plan change takes a product only.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### RefundRequest

Defined in: [src/convex/integrations/billing/providers/types.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts)

Refunding an order, in full or in part.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="orderid-1">
        
      </a>
      
       <code>
        orderId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="amount-3">
        
      </a>
      
       <code>
        amount?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      In the minor unit; the whole order without one.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="reason">
        
      </a>
      
       <code>
        reason?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="idempotencykey-1">
        
      </a>
      
       <code>
        idempotencyKey?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### CommerceProvider

Defined in: [src/convex/integrations/billing/providers/types.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts)

The calls every commerce provider answers. A call its API lacks throws [ProviderUnsupportedError](#providerunsupportederror).

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Modifier
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="name-4">
        
      </a>
      
       <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        readonly
      </code>
    </td>
    
    <td>
      <a href="#billingprovidername-3">
        <code>
          BillingProviderName
        </code>
      </a>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="environment">
        
      </a>
      
       <code>
        environment
      </code>
    </td>
    
    <td>
      <code>
        readonly
      </code>
    </td>
    
    <td>
      <a href="#providerenvironment">
        <code>
          ProviderEnvironment
        </code>
      </a>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="capabilities">
        
      </a>
      
       <code>
        capabilities
      </code>
    </td>
    
    <td>
      <code>
        readonly
      </code>
    </td>
    
    <td>
      <a href="#providercapabilities">
        <code>
          ProviderCapabilities
        </code>
      </a>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="createcheckout">
        
      </a>
      
       <code>
        createCheckout
      </code>
    </td>
    
    <td>
      <code>
        public
      </code>
    </td>
    
    <td>
      (<code>
        request
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<a href="#checkoutsession">
        <code>
          CheckoutSession
        </code>
      </a>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="customerportalurl">
        
      </a>
      
       <code>
        customerPortalUrl
      </code>
    </td>
    
    <td>
      <code>
        public
      </code>
    </td>
    
    <td>
      (<code>
        providerCustomerId
      </code>
      
      , <code>
        options?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        string
      </code>
      
      >
    </td>
    
    <td>
      The customer portal's link for one of the provider's customers.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="getsubscription">
        
      </a>
      
       <code>
        getSubscription
      </code>
    </td>
    
    <td>
      <code>
        public
      </code>
    </td>
    
    <td>
      (<code>
        subscriptionId
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<a href="#neutralsubscription">
        <code>
          NeutralSubscription
        </code>
      </a>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="changeplan-1">
        
      </a>
      
       <code>
        changePlan
      </code>
    </td>
    
    <td>
      <code>
        public
      </code>
    </td>
    
    <td>
      (<code>
        request
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="cancelscheduledchange">
        
      </a>
      
       <code>
        cancelScheduledChange
      </code>
    </td>
    
    <td>
      <code>
        public
      </code>
    </td>
    
    <td>
      (<code>
        subscriptionId
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Take back a plan change scheduled for the period's end; nothing when none is scheduled.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="cancelsubscription">
        
      </a>
      
       <code>
        cancelSubscription
      </code>
    </td>
    
    <td>
      <code>
        public
      </code>
    </td>
    
    <td>
      (<code>
        subscriptionId
      </code>
      
      , <code>
        options?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Cancel now (<code>
        immediately
      </code>
      
      ), or at the end of the period.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="uncancelsubscription">
        
      </a>
      
       <code>
        uncancelSubscription
      </code>
    </td>
    
    <td>
      <code>
        public
      </code>
    </td>
    
    <td>
      (<code>
        subscriptionId
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Take a scheduled cancellation back.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="pausesubscription">
        
      </a>
      
       <code>
        pauseSubscription
      </code>
    </td>
    
    <td>
      <code>
        public
      </code>
    </td>
    
    <td>
      (<code>
        subscriptionId
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Stop billing (and access) until resumed.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="resumesubscription">
        
      </a>
      
       <code>
        resumeSubscription
      </code>
    </td>
    
    <td>
      <code>
        public
      </code>
    </td>
    
    <td>
      (<code>
        subscriptionId
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="refundorder">
        
      </a>
      
       <code>
        refundOrder
      </code>
    </td>
    
    <td>
      <code>
        public
      </code>
    </td>
    
    <td>
      (<code>
        request
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<a href="#neutralrefund">
        <code>
          NeutralRefund
        </code>
      </a>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="invoice">
        
      </a>
      
       <code>
        invoice
      </code>
    </td>
    
    <td>
      <code>
        public
      </code>
    </td>
    
    <td>
      (<code>
        orderId
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<a href="#invoiceanswer">
        <code>
          InvoiceAnswer
        </code>
      </a>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="verifycheckoutredirect">
        
      </a>
      
       <code>
        verifyCheckoutRedirect
      </code>
    </td>
    
    <td>
      <code>
        public
      </code>
    </td>
    
    <td>
      (<code>
        search
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      Whether the query the provider appended to the success URL is its own (<code>
        capabilities.signedRedirect
      </code>
      
      ; the others throw <code>
        ProviderUnsupportedError
      </code>
      
      ). It lets a success page trust the ids it shows; access is still granted by <code>
        order.paid
      </code>
      
      , never by the redirect.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="verifywebhook">
        
      </a>
      
       <code>
        verifyWebhook
      </code>
    </td>
    
    <td>
      <code>
        public
      </code>
    </td>
    
    <td>
      (<code>
        body
      </code>
      
      , <code>
        headers
      </code>
      
      , <code>
        secrets
      </code>
      
      , <code>
        now?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<a href="#verifieddelivery">
        <code>
          VerifiedDelivery
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      Verify a delivery against the accepted secrets (a rotation accept-list, first entry primary) and read it. <code>
        null
      </code>
      
       when no secret verifies it: the route answers 401 and reads nothing of the body.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### ProviderOptions

Defined in: [src/convex/integrations/billing/providers/types.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts)

What every adapter is built with.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="apikey">
        
      </a>
      
       <code>
        apiKey
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The provider's secret API key (Stripe <code>
        sk_…
      </code>
      
      /<code>
        rk_…
      </code>
      
      , Dodo <code>
        dodo_…
      </code>
      
      , Creem <code>
        creem_…
      </code>
      
      ).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="environment-1">
        
      </a>
      
       <code>
        environment
      </code>
    </td>
    
    <td>
      <a href="#providerenvironment">
        <code>
          ProviderEnvironment
        </code>
      </a>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="fetch">
        
      </a>
      
       <code>
        fetch?
      </code>
    </td>
    
    <td>
      { (<code>
        input
      </code>
      
      , <code>
        init?
      </code>
      
      ): <code>
        Promise
      </code>
      
      <<code>
        Response
      </code>
      
      >; (<code>
        input
      </code>
      
      , <code>
        init?
      </code>
      
      ): <code>
        Promise
      </code>
      
      <<code>
        Response
      </code>
      
      >; }
    </td>
    
    <td>
      A <code>
        fetch
      </code>
      
       to call the provider with: the global one by default, a fake in tests.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts" rel="nofollow">
        src/convex/integrations/billing/providers/types.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### BillingRateLimiter

Defined in: [src/convex/integrations/billing/types/base.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/base.ts)

A structural rate limiter for throttling `syncEntitlements` — satisfied by
`setupRateLimiter(...)` from `nuxt-backend/rate-limit`, which seeds the
`billingSync` limit by default. Kept structural (rather than importing the
rate-limiter's own type) so any compatible limiter is assignable.

#### Methods

##### limit()

```ts
limit(
   ctx, 
   name, 
   options?
): Promise<{
  ok: boolean;
  retryAfter?: number;
}>;
```

Defined in: [src/convex/integrations/billing/types/base.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/base.ts)

###### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        ctx
      </code>
    </td>
    
    <td>
      <code>
        RunWriteCtx
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        "billingSync"
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      { <code>
        key?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        throws?
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options.key?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options.throws?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
  </tr>
</tbody>
</table>

###### Returns

`Promise`<{
`ok`: `boolean`;
`retryAfter?`: `number`;
}>

---

### BillingLifecycle

Defined in: [src/convex/integrations/billing/types/lifecycle.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/lifecycle.ts)

`setupBilling({ lifecycle })`: what the package does around a
subscription's life beyond the provider's own.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="saveoffers">
        
      </a>
      
       <code>
        saveOffers?
      </code>
    </td>
    
    <td>
      <code>
        Partial
      </code>
      
      <<code>
        Record
      </code>
      
      <<a href="#cancellationreason">
        <code>
          CancellationReason
        </code>
      </a>
      
      , <a href="#saveofferrule">
        <code>
          SaveOfferRule
        </code>
      </a>
      
      >>
    </td>
    
    <td>
      Save offers by cancellation reason: cancelling stays one step, and a reason with an entry gets one optional step first, its offer. None in the withdrawal period, on a past-due plan or a trial, and one per billing entity in 12 months.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/lifecycle.ts" rel="nofollow">
        src/convex/integrations/billing/types/lifecycle.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="abandonedcheckout">
        
      </a>
      
       <code>
        abandonedCheckout?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Record <code>
        billing.checkout_abandoned
      </code>
      
       once per checkout that expired unpaid, which the <code>
        checkoutAbandoned
      </code>
      
       lifecycle email starts from.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/lifecycle.ts" rel="nofollow">
        src/convex/integrations/billing/types/lifecycle.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="renewalreminders">
        
      </a>
      
       <code>
        renewalReminders?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Email the billing managers a yearly reminder of a renewing subscription's terms, as California's automatic renewal law asks, on cycles the provider's own reminder does not cover (under six months).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/lifecycle.ts" rel="nofollow">
        src/convex/integrations/billing/types/lifecycle.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="withdrawal">
        
      </a>
      
       <code>
        withdrawal?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      The EU withdrawal button (Art. 11a of the Consumer Rights Directive): <code>
        getWithdrawal
      </code>
      
       and <code>
        withdraw
      </code>
      
      , which <code>
        <WithdrawalButton>
      </code>
      
       calls, and the <code>
        withdrawalReceipt
      </code>
      
       email. For where the provider does not offer it.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/lifecycle.ts" rel="nofollow">
        src/convex/integrations/billing/types/lifecycle.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### BillingConsole

Defined in: [src/convex/integrations/billing/types/lifecycle.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/lifecycle.ts)

The billing lifecycle's records as the admin console's Billing tab
reads them (`getBillingConsole`), newest first, the latest 50 of each.
Each names the billing entity: a workspace's id, or an account's with
`billTo: 'user'`.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="saveoffers-1">
        
      </a>
      
       <code>
        saveOffers
      </code>
    </td>
    
    <td>
      { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        reason
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        kind
      </code>
      
      : <code>
        "downgrade"
      </code>
      
       | <code>
        "pause"
      </code>
      
       | <code>
        "discount"
      </code>
      
      ; <code>
        months
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        plan
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        discount
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        madeAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        acceptedAt
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; }<span>
        
      </span>
    </td>
    
    <td>
      The save offers the cancel flow made: for which reason, what, and whether it was taken.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/lifecycle.ts" rel="nofollow">
        src/convex/integrations/billing/types/lifecycle.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="withdrawals">
        
      </a>
      
       <code>
        withdrawals
      </code>
    </td>
    
    <td>
      { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        plan
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        at
      </code>
      
      : <code>
        number
      </code>
      
      ; }<span>
        
      </span>
    </td>
    
    <td>
      The EU withdrawals: who withdrew from which plan, and when.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/lifecycle.ts" rel="nofollow">
        src/convex/integrations/billing/types/lifecycle.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="consents">
        
      </a>
      
       <code>
        consents
      </code>
    </td>
    
    <td>
      { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        plan
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        interval
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        intervalCount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        termsVersion
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        consentedAt
      </code>
      
      : <code>
        number
      </code>
      
      ; }<span>
        
      </span>
    </td>
    
    <td>
      The confirmed renewal consent proofs: what the checkout showed (the plan, the price and its interval, the terms version), who agreed and when.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/lifecycle.ts" rel="nofollow">
        src/convex/integrations/billing/types/lifecycle.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### SubscriptionTarget

Defined in: [src/convex/integrations/billing/types/options.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts)

Shared addressing for the subscription-lifecycle operations.

#### Extended by

- [`UpdateSubscriptionOptions`](#updatesubscriptionoptions)
- [`CancelSubscriptionOptions`](#cancelsubscriptionoptions)
- [`PauseSubscriptionOptions`](#pausesubscriptionoptions)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="subscriptionid-3">
        
      </a>
      
       <code>
        subscriptionId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Which subscription to act on. Omit for the account's single live subscription — required once <code>
        multipleSubscriptions
      </code>
      
       (<a href="#setupbillingconfig">
        SetupBillingConfig
      </a>
      
      ) is on and an entity can hold several at once.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### UpdateSubscriptionOptions

Defined in: [src/convex/integrations/billing/types/options.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts)

Options for [Billing.updateSubscription](#updatesubscription) (upgrade / downgrade).

#### Extends

- [`SubscriptionTarget`](#subscriptiontarget)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Inherited from
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="subscriptionid-4">
        
      </a>
      
       <code>
        subscriptionId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Which subscription to act on. Omit for the account's single live subscription — required once <code>
        multipleSubscriptions
      </code>
      
       (<a href="#setupbillingconfig">
        SetupBillingConfig
      </a>
      
      ) is on and an entity can hold several at once.
    </td>
    
    <td>
      <a href="#subscriptiontarget">
        <code>
          SubscriptionTarget
        </code>
      </a>
      
      .<a href="#subscriptionid-3">
        <code>
          subscriptionId
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="productid-4">
        
      </a>
      
       <code>
        productId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The product to switch to.
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="proration-1">
        
      </a>
      
       <code>
        proration?
      </code>
    </td>
    
    <td>
      <a href="#prorationbehavior">
        <code>
          ProrationBehavior
        </code>
      </a>
    </td>
    
    <td>
      How to settle the mid-period money difference.
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### CancelSubscriptionOptions

Defined in: [src/convex/integrations/billing/types/options.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts)

Options for [Billing.cancelSubscription](#cancelsubscription-1).

#### Extends

- [`SubscriptionTarget`](#subscriptiontarget)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Inherited from
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="subscriptionid-5">
        
      </a>
      
       <code>
        subscriptionId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Which subscription to act on. Omit for the account's single live subscription — required once <code>
        multipleSubscriptions
      </code>
      
       (<a href="#setupbillingconfig">
        SetupBillingConfig
      </a>
      
      ) is on and an entity can hold several at once.
    </td>
    
    <td>
      <a href="#subscriptiontarget">
        <code>
          SubscriptionTarget
        </code>
      </a>
      
      .<a href="#subscriptionid-3">
        <code>
          subscriptionId
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="atperiodend">
        
      </a>
      
       <code>
        atPeriodEnd?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Keep the subscription running until the period it is paid for ends (default). <code>
        false
      </code>
      
       revokes it immediately — benefits are withdrawn on the spot and the remainder is not refunded.
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="reason-1">
        
      </a>
      
       <code>
        reason?
      </code>
    </td>
    
    <td>
      <a href="#cancellationreason">
        <code>
          CancellationReason
        </code>
      </a>
    </td>
    
    <td>
      The customer's own churn reason.
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="comment">
        
      </a>
      
       <code>
        comment?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The customer's own words. Never an internal note — they can read it back.
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### PauseSubscriptionOptions

Defined in: [src/convex/integrations/billing/types/options.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts)

Options for [Billing.pauseSubscription](#pausesubscription-1).

#### Extends

- [`SubscriptionTarget`](#subscriptiontarget)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Inherited from
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="subscriptionid-6">
        
      </a>
      
       <code>
        subscriptionId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Which subscription to act on. Omit for the account's single live subscription — required once <code>
        multipleSubscriptions
      </code>
      
       (<a href="#setupbillingconfig">
        SetupBillingConfig
      </a>
      
      ) is on and an entity can hold several at once.
    </td>
    
    <td>
      <a href="#subscriptiontarget">
        <code>
          SubscriptionTarget
        </code>
      </a>
      
      .<a href="#subscriptionid-3">
        <code>
          subscriptionId
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="resumesat">
        
      </a>
      
       <code>
        resumesAt?
      </code>
    </td>
    
    <td>
      <code>
        Date
      </code>
    </td>
    
    <td>
      When the paused subscription resumes by itself (must be after the current period ends). Omit to pause until it is resumed by hand.
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### OrdersOptions

Defined in: [src/convex/integrations/billing/types/options.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts)

Options for [Billing.getOrders](#getorders).

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="limit-1">
        
      </a>
      
       <code>
        limit?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Orders per page (1–100, default 10).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="cursor">
        
      </a>
      
       <code>
        cursor?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      An opaque page token from a previous page's <code>
        nextCursor
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="page">
        
      </a>
      
       <code>
        page?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      The provider's 1-based page number — the raw form of <code>
        cursor
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### BillingPage

Defined in: [src/convex/integrations/billing/types/options.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts)

A page of provider records, plus the token that reads the next one.

#### Type Parameters

<table>
<thead>
  <tr>
    <th>
      Type Parameter
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="type-parameter-item">
        
      </a>
      
       <code>
        Item
      </code>
    </td>
  </tr>
</tbody>
</table>

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="items">
        
      </a>
      
       <code>
        items
      </code>
    </td>
    
    <td>
      <code>
        Item
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="pagination">
        
      </a>
      
       <code>
        pagination
      </code>
    </td>
    
    <td>
      { <code>
        totalCount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        maxPage
      </code>
      
      : <code>
        number
      </code>
      
      ; }
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        pagination.totalCount
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        pagination.maxPage
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="nextcursor">
        
      </a>
      
       <code>
        nextCursor?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Pass back as <code>
        cursor
      </code>
      
       to read the next page; absent on the last one.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### UsageHistoryOptions

Defined in: [src/convex/integrations/billing/types/options.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts)

Options for [Billing.getUsageHistory](#getusagehistory).

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="meter-2">
        
      </a>
      
       <code>
        meter?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Which meter's consumption to read: a configured credit-meter name (<code>
        'credits'
      </code>
      
      ) or a raw meter id. Omit for every ingested event on the account.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="limit-2">
        
      </a>
      
       <code>
        limit?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Events per page (1–100, default 10).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="cursor-1">
        
      </a>
      
       <code>
        cursor?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      An opaque page token from a previous page's <code>
        nextCursor
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="page-1">
        
      </a>
      
       <code>
        page?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      The provider's 1-based page number — the raw form of <code>
        cursor
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="starttimestamp">
        
      </a>
      
       <code>
        startTimestamp?
      </code>
    </td>
    
    <td>
      <code>
        Date
      </code>
    </td>
    
    <td>
      Only events at or after this moment.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="endtimestamp">
        
      </a>
      
       <code>
        endTimestamp?
      </code>
    </td>
    
    <td>
      <code>
        Date
      </code>
    </td>
    
    <td>
      Only events at or before this moment.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### RefundOrderOptions

Defined in: [src/convex/integrations/billing/types/options.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts)

Options for [Billing.refundOrder](#refundorder-1).

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="orderid-2">
        
      </a>
      
       <code>
        orderId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="amount-4">
        
      </a>
      
       <code>
        amount?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Amount to refund in the currency's minor unit (cents). Omit to refund everything still refundable on the order.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="reason-2">
        
      </a>
      
       <code>
        reason
      </code>
    </td>
    
    <td>
      <a href="#refundreason">
        <code>
          RefundReason
        </code>
      </a>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="revokebenefits">
        
      </a>
      
       <code>
        revokeBenefits?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Withdraw the order's benefits as well. The provider only allows this for one-time purchases — a subscription's benefits are withdrawn when the subscription itself is revoked.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="metadata-3">
        
      </a>
      
       <code>
        metadata?
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        number
      </code>
      
       | <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      Extra key-value data stored on the refund.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### RefundRecord

Defined in: [src/convex/integrations/billing/types/options.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts)

The outcome of [Billing.refundOrder](#refundorder-1), JSON-normalized.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="id-5">
        
      </a>
      
       <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="orderid-3">
        
      </a>
      
       <code>
        orderId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="status-2">
        
      </a>
      
       <code>
        status
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="reason-3">
        
      </a>
      
       <code>
        reason
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="amount-5">
        
      </a>
      
       <code>
        amount
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Refunded amount in the currency's minor unit (cents).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="currency-4">
        
      </a>
      
       <code>
        currency
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="revokebenefits-1">
        
      </a>
      
       <code>
        revokeBenefits
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### DiscountListOptions

Defined in: [src/convex/integrations/billing/types/options.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts)

Filters for [BillingDiscounts.list](#list).

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="query">
        
      </a>
      
       <code>
        query?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Match against the discount's name. The provider matches part of its code too, letter case aside, though it documents the name only: to find one by its code, compare <code>
        code
      </code>
      
       on what comes back.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="limit-3">
        
      </a>
      
       <code>
        limit?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Discounts per page (1–100, default 10).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="page-2">
        
      </a>
      
       <code>
        page?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      The provider's 1-based page number.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### BillingDiscounts

Defined in: [src/convex/integrations/billing/types/options.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts)

Discount (coupon) management. Privileged by design — a public action that
mints discounts would let anyone create a 100%-off code — so these are
server-side methods, not registered functions: call them from an
`internalAction` or an admin-tier action of your own.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="create">
        
      </a>
      
       <code>
        create
      </code>
    </td>
    
    <td>
      (<code>
        discount
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <{ <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        code
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; }>
    </td>
    
    <td>
      Create a discount / coupon. Accepts the full provider shape (fixed or percentage).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="list">
        
      </a>
      
       <code>
        list
      </code>
    </td>
    
    <td>
      (<code>
        options?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<a href="#billingpage">
        <code>
          BillingPage
        </code>
      </a>
      
      <<code>
        Discount
      </code>
      
      >>
    </td>
    
    <td>
      List discounts (newest provider order), one page at a time.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="remove">
        
      </a>
      
       <code>
        remove
      </code>
    </td>
    
    <td>
      (<code>
        discountId
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Delete a discount: nobody redeems it any more, and its code is free for another. The provider keeps it for the subscriptions that hold it: they keep taking it off for its duration.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### ApplyDiscountOptions

Defined in: [src/convex/integrations/billing/types/options.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts)

What [Billing.applyDiscount](#applydiscount) takes.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="entityid-3">
        
      </a>
      
       <code>
        entityId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The billing entity whose subscription takes the discount, by id: the workspace id (<code>
        billTo: 'workspace'
      </code>
      
      , the default) or the user id. Server code that passes it has decided the entity qualifies; never pass an id a caller sent.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="discount">
        
      </a>
      
       <code>
        discount
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      A catalog discount's key, or <code>
        null
      </code>
      
       to remove the subscription's discount.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="subscriptionid-7">
        
      </a>
      
       <code>
        subscriptionId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The subscription, when the entity holds several (<code>
        multipleSubscriptions
      </code>
      
      ).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### CheckoutPrefill

Defined in: [src/convex/integrations/billing/types/options.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts)

Pre-filled customer details for a checkout session. Every field is only a
default the customer can still change — the provider owns the form.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="name-7">
        
      </a>
      
       <code>
        name?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="email-1">
        
      </a>
      
       <code>
        email?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="billingname">
        
      </a>
      
       <code>
        billingName?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The name that should appear on the invoice, when it differs from <code>
        name
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="billingaddress">
        
      </a>
      
       <code>
        billingAddress?
      </code>
    </td>
    
    <td>
      { <code>
        country
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        line1?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        line2?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        postalCode?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        city?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        state?
      </code>
      
      : <code>
        string
      </code>
      
      ; }
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billingAddress.country
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      ISO 3166-1 alpha-2 country code — the one field the provider requires.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billingAddress.line1?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billingAddress.line2?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billingAddress.postalCode?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billingAddress.city?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billingAddress.state?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="taxid">
        
      </a>
      
       <code>
        taxId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      VAT / tax identification number.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="business">
        
      </a>
      
       <code>
        business?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Bill a business rather than an individual. Turning this on makes the provider require a full billing address and billing name.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### CampaignAttribution

Defined in: [src/convex/integrations/billing/types/options.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts)

Campaign attribution a checkout carries, as a campaign link's UTM
parameters. Stored on the order or subscription as flat `utm_source`,
`utm_medium`, … metadata, the way the provider's own checkout links store
it; each value is trimmed and cut to 100 characters.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="source">
        
      </a>
      
       <code>
        source?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="medium">
        
      </a>
      
       <code>
        medium?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="campaign">
        
      </a>
      
       <code>
        campaign?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="term">
        
      </a>
      
       <code>
        term?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="content">
        
      </a>
      
       <code>
        content?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### CheckoutTrial

Defined in: [src/convex/integrations/billing/types/options.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts)

A trial the server grants at checkout in place of the product's own: 1 to
30 days, in days or weeks. No months: the provider counts a month as a
calendar month, up to 31 days.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="interval-1">
        
      </a>
      
       <code>
        interval
      </code>
    </td>
    
    <td>
      <code>
        "day"
      </code>
      
       | <code>
        "week"
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="count">
        
      </a>
      
       <code>
        count?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Number of intervals. Defaults to 1.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### FeatureCheckOptions

Defined in: [src/convex/integrations/billing/types/options.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts)

What [Billing.hasFeature](#hasfeature) and [Billing.requireFeature](#requirefeature) take
beside the feature, and the quota reads and counts beside the quota.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="userid">
        
      </a>
      
       <code>
        userId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The billing entity to check, by id: the workspace id (<code>
        billTo: 'workspace'
      </code>
      
      , the default) or the user id. Server code that passes it has decided whose features these are, so nobody is checked: never pass an id a caller sent, which would tell anyone whether any entity has the feature. Omit it to check the caller's own entity, checked the way the billing reads check it: signed in, an account not banned, a member of the workspace that pays (read fresh).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### EntitlementBenefit

Defined in: [src/convex/integrations/billing/types/records.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts)

A single granted benefit (entitlement) in a customer's billing state.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="id-6">
        
      </a>
      
       <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The grant's id.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="benefitid">
        
      </a>
      
       <code>
        benefitId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="type">
        
      </a>
      
       <code>
        type
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The provider's own benefit type; <code>
        kind
      </code>
      
       says the same in neutral words.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="kind-1">
        
      </a>
      
       <code>
        kind?
      </code>
    </td>
    
    <td>
      <a href="#benefitkind">
        <code>
          BenefitKind
        </code>
      </a>
    </td>
    
    <td>
      What the benefit gives (see <a href="#benefitkind">
        BenefitKind
      </a>
      
      ).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="name-8">
        
      </a>
      
       <code>
        name?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The benefit's name, as the provider lists it to the customer. Absent until the benefit was read once.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="grantedat">
        
      </a>
      
       <code>
        grantedAt?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      When it was granted (epoch ms).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="licensekey">
        
      </a>
      
       <code>
        licenseKey?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      A license key's display key: masked but for its last characters.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="files">
        
      </a>
      
       <code>
        files?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      How many files a download benefit grants.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="repository">
        
      </a>
      
       <code>
        repository?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The repository a repository benefit opens, as <code>
        owner/name
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="metadata-5">
        
      </a>
      
       <code>
        metadata?
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        number
      </code>
      
       | <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      The benefit's <strong>
        live
      </strong>
      
       provider metadata (read from the benefit, not the grant-time snapshot in customer state). Lets consumers feature-gate by a friendly key — set e.g. <code>
        { key: 'premium' }
      </code>
      
       on the benefit and check <code>
        useFeatures().has('premium')
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### EntitlementMeter

Defined in: [src/convex/integrations/billing/types/records.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts)

A credit-meter balance in a customer's billing state (prepaid credits).

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="meterid">
        
      </a>
      
       <code>
        meterId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="unit-1">
        
      </a>
      
       <code>
        unit?
      </code>
    </td>
    
    <td>
      <a href="#meterunit">
        <code>
          MeterUnit
        </code>
      </a>
    </td>
    
    <td>
      What the meter counts, when the catalog names its unit (<code>
        getCredits
      </code>
      
       adds it).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="consumedunits">
        
      </a>
      
       <code>
        consumedUnits
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="creditedunits">
        
      </a>
      
       <code>
        creditedUnits
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="balance">
        
      </a>
      
       <code>
        balance
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="cyclestart">
        
      </a>
      
       <code>
        cycleStart?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      The granting subscription's current period (epoch ms) — a meter has no period of its own in the provider's model. Absent for meters granted only by one-time credit packs.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="cycleend">
        
      </a>
      
       <code>
        cycleEnd?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="rollover-2">
        
      </a>
      
       <code>
        rollover?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Whether unspent credited units carry into the next cycle.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### CustomerEntitlements

Defined in: [src/convex/integrations/billing/types/records.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts)

A user's full billing entitlement state — active plans, granted benefits, and
credit-meter balances — normalized for caching into the reactive component table.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="customerid-2">
        
      </a>
      
       <code>
        customerId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="activeproductids">
        
      </a>
      
       <code>
        activeProductIds
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="benefits">
        
      </a>
      
       <code>
        benefits
      </code>
    </td>
    
    <td>
      <a href="#entitlementbenefit">
        <code>
          EntitlementBenefit
        </code>
      </a>
      
      <span>
        
      </span>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="meters-1">
        
      </a>
      
       <code>
        meters
      </code>
    </td>
    
    <td>
      <a href="#entitlementmeter">
        <code>
          EntitlementMeter
        </code>
      </a>
      
      <span>
        
      </span>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### CreditMeterConfig

Defined in: [src/convex/integrations/billing/types/records.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts)

A named credit meter: how a spend by friendly name (`meter: 'credits'`)
resolves to the provider meter and its ingestion shape. Declared in
`setupBilling({ credits })` or generated into `billing.generated.ts` by
`nuxt-backend billing sync`.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="meterid-1">
        
      </a>
      
       <code>
        meterId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The provider meter id the balance guard runs against.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="eventname-1">
        
      </a>
      
       <code>
        eventName?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Event name the meter's filter matches. Defaults to the config key.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="property-1">
        
      </a>
      
       <code>
        property?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      For sum-aggregation meters: the metadata property carrying the amount — ingested as <code>
        metadata[property] = value
      </code>
      
      . Omit for count meters (which count events, so each spend is exactly 1 credit).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="unit-2">
        
      </a>
      
       <code>
        unit?
      </code>
    </td>
    
    <td>
      <a href="#meterunit">
        <code>
          MeterUnit
        </code>
      </a>
    </td>
    
    <td>
      What the meter counts, as the catalog's <code>
        unit
      </code>
      
       names it: the packaged labels' word for its units.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### BillingCatalogDiscount

Defined in: [src/convex/integrations/billing/types/records.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts)

A catalog discount as `billing sync` left it at the provider: its id and
its terms, which checkout applies by key and `getPricing` shows. Dates
are ISO strings, amounts in the currency's smallest unit.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="id-7">
        
      </a>
      
       <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The provider's discount id.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="name-9">
        
      </a>
      
       <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The name the customer sees at checkout.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="code-2">
        
      </a>
      
       <code>
        code?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Its code: a public promotion. Absent on one only the server applies.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="percentoff">
        
      </a>
      
       <code>
        percentOff?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Percent off, <code>
        20
      </code>
      
       for 20%.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="amountoff">
        
      </a>
      
       <code>
        amountOff?
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        number
      </code>
      
      >
    </td>
    
    <td>
      A fixed amount off per currency, lower-case ISO 4217 code → cents.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="duration-1">
        
      </a>
      
       <code>
        duration
      </code>
    </td>
    
    <td>
      <code>
        "once"
      </code>
      
       | <code>
        "forever"
      </code>
      
       | <code>
        "repeating"
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="months-1">
        
      </a>
      
       <code>
        months?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      The months a <code>
        repeating
      </code>
      
       discount lasts.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="startsat-1">
        
      </a>
      
       <code>
        startsAt?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="endsat-1">
        
      </a>
      
       <code>
        endsAt?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="productids-1">
        
      </a>
      
       <code>
        productIds
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      The products it applies to: every one a checkout may take it on.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### CatalogPassIds

Defined in: [src/convex/integrations/billing/types/records.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts)

A plan's pass products in the generated map, and the length of its reverse trial when it has one.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="pass">
        
      </a>
      
       <code>
        pass
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The free pass product that carries the plan's benefits.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="months-2">
        
      </a>
      
       <code>
        months
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
      >
    </td>
    
    <td>
      The private purchase product per gift length in months, keyed <code>
        '3'
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="trialdays-1">
        
      </a>
      
       <code>
        trialDays?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Days of the reverse trial every new workspace starts on this pass for.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### BillingCatalogIds

Defined in: [src/convex/integrations/billing/types/records.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts)

The environment-keyed id map `nuxt-backend billing sync` generates.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="products-1">
        
      </a>
      
       <code>
        products?
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
      >
    </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>
      
      . A retired plan's products stay listed, so a subscriber's plan still reads back by its key; the checkout never sells them.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="plans-2">
        
      </a>
      
       <code>
        plans?
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        Partial
      </code>
      
      <<code>
        Record
      </code>
      
      <<a href="#cataloginterval">
        <code>
          CatalogInterval
        </code>
      </a>
      
      , <code>
        string
      </code>
      
      >>>
    </td>
    
    <td>
      Plan key → its product per priced interval, retired plans included.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="retired-2">
        
      </a>
      
       <code>
        retired?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      The keys of retired plans: archived at the provider, never sold again.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="packs-2">
        
      </a>
      
       <code>
        packs?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      The catalog keys of <code>
        products
      </code>
      
       that are credit packs: what a gift may buy.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="gifts">
        
      </a>
      
       <code>
        gifts?
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
      >
    </td>
    
    <td>
      Pack key → the provider id of its private gift product: the same prices, no benefits, bought by a purchaser for someone else. Never sold on its own, so it is outside <code>
        products
      </code>
      
       and the checkout allow-list.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="passes">
        
      </a>
      
       <code>
        passes?
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <a href="#catalogpassids">
        <code>
          CatalogPassIds
        </code>
      </a>
      
      >
    </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>
      
      ). Neither is sold on its own. <code>
        trialDays
      </code>
      
       marks the plan whose trial is a reverse trial: every new workspace starts on its pass for that many days.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="meters-2">
        
      </a>
      
       <code>
        meters?
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <a href="#creditmeterconfig">
        <code>
          CreditMeterConfig
        </code>
      </a>
      
      >
    </td>
    
    <td>
      Catalog key → credit meter config.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="quotas-2">
        
      </a>
      
       <code>
        quotas?
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
      >
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       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>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="free">
        
      </a>
      
       <code>
        free?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </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>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="welcome">
        
      </a>
      
       <code>
        welcome?
      </code>
    </td>
    
    <td>
      { <code>
        meter
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        units
      </code>
      
      : <code>
        number
      </code>
      
      ; }
    </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>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        welcome.meter
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        welcome.units
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="currency-6">
        
      </a>
      
       <code>
        currency?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </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>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="discounts-1">
        
      </a>
      
       <code>
        discounts?
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <a href="#billingcatalogdiscount">
        <code>
          BillingCatalogDiscount
        </code>
      </a>
      
      >
    </td>
    
    <td>
      Discount key → the discount and its terms. A retired one is left out: nothing applies it again.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### SpendCreditsEvent

Defined in: [src/convex/integrations/billing/types/records.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts)

A prepaid-credit consumption event (drawn from the customer's meter balance).

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="userid-1">
        
      </a>
      
       <code>
        userId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The billing entity id — the workspace id (<code>
        billTo: 'workspace'
      </code>
      
      , the default) or the auth user id (<code>
        billTo: 'user'
      </code>
      
      ). Omit to resolve it from the caller's identity (the active workspace / signed-in user).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="meter-3">
        
      </a>
      
       <code>
        meter?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      A configured credit meter name (<code>
        setupBilling({ credits })
      </code>
      
       / catalog key) — the preferred spend target: resolves the meter id, event name, and ingestion shape in one word.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="name-10">
        
      </a>
      
       <code>
        name?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The meter event name. Defaults to the configured meter's <code>
        eventName
      </code>
      
      /key.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="meterid-2">
        
      </a>
      
       <code>
        meterId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      A raw credit meter id to guard against (escape hatch when no named meter config exists). When a meter resolves (by <code>
        meter
      </code>
      
       or <code>
        meterId
      </code>
      
      ), the spend is <strong>
        reserved
      </strong>
      
       against the cached balance first and <strong>
        blocked
      </strong>
      
       (throws) if it is below <code>
        value
      </code>
      
       — keeping credits strictly prepaid (never billed as overage). The reservation settles after the provider event ingests, or releases on failure, so a failed run never consumes credits.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="value">
        
      </a>
      
       <code>
        value?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Credits required for this spend (default <code>
        1
      </code>
      
      ): a finite number above zero. Anything else is refused before the balance or the provider sees it.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="allowoverage">
        
      </a>
      
       <code>
        allowOverage?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Let the balance go negative instead of refusing the spend — the pay-as-you-go case: the meter has no credit benefit behind it, so every unit is overage the provider invoices at the end of the cycle. Off by default: credits stay strictly prepaid.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="metadata-6">
        
      </a>
      
       <code>
        metadata?
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        number
      </code>
      
       | <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      Event properties used by the meter's aggregation/filter.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="externalid">
        
      </a>
      
       <code>
        externalId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Idempotency key to prevent double-counting (defaults to a random UUID).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="timestamp">
        
      </a>
      
       <code>
        timestamp?
      </code>
    </td>
    
    <td>
      <code>
        Date
      </code>
    </td>
    
    <td>
      Event time (defaults to now).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### SpendReservation

Defined in: [src/convex/integrations/billing/types/records.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts)

A credit reservation's addressing data — serializable, so a spend can
reserve in one function and settle/release in another (the streaming HTTP
dispatcher does exactly that). Being plain data, it is checked again when it
settles: a `value` that is not a finite number above zero is refused.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="entityid-4">
        
      </a>
      
       <code>
        entityId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The billing entity the spend belongs to.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="externalid-1">
        
      </a>
      
       <code>
        externalId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Idempotency key shared by the reservation and the provider event.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="reserved">
        
      </a>
      
       <code>
        reserved
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Whether a meter guard actually reserved cached balance.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="meter-4">
        
      </a>
      
       <code>
        meter?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The configured meter name (when reserved via one).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="meterid-3">
        
      </a>
      
       <code>
        meterId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The raw meter id (when reserved).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="value-1">
        
      </a>
      
       <code>
        value
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Credits reserved.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### CostReport

Defined in: [src/convex/integrations/billing/types/records.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts)

What some work cost the app, for the billing provider's cost insights ([Billing.reportCost](#reportcost)).

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="userid-2">
        
      </a>
      
       <code>
        userId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The billing entity the work was for.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="name-11">
        
      </a>
      
       <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The event's name.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="externalid-2">
        
      </a>
      
       <code>
        externalId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Idempotency key: the same report sent twice counts once.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="parentid">
        
      </a>
      
       <code>
        parentId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The charge this cost belongs to, by its <code>
        externalId
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="cents">
        
      </a>
      
       <code>
        cents?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      What the work cost, in US cents; left out when nothing reported a cost.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="llm">
        
      </a>
      
       <code>
        llm?
      </code>
    </td>
    
    <td>
      { <code>
        vendor
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        model
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        inputTokens
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        outputTokens
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        cachedInputTokens?
      </code>
      
      : <code>
        number
      </code>
      
      ; }
    </td>
    
    <td>
      The model the work called, and the tokens it used.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        llm.vendor
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        llm.model
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        llm.inputTokens
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        llm.outputTokens
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        llm.cachedInputTokens?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="memberid">
        
      </a>
      
       <code>
        memberId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The member who started the work.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### RefundCreditsEvent

Defined in: [src/convex/integrations/billing/types/records.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts)

A prepaid-credit refund (compensating event on a sum meter).

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="userid-3">
        
      </a>
      
       <code>
        userId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The billing entity id; omit to resolve from the caller's identity.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="meter-5">
        
      </a>
      
       <code>
        meter
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The configured credit meter name to refund on (must be a sum meter).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="value-2">
        
      </a>
      
       <code>
        value
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Credits to give back: a finite number above zero.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="metadata-7">
        
      </a>
      
       <code>
        metadata?
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        number
      </code>
      
       | <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      Extra event properties.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="externalid-3">
        
      </a>
      
       <code>
        externalId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Idempotency key (defaults to a random UUID).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### GiftRecord

Defined in: [src/convex/integrations/billing/types/records.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts)

A gift purchase record, as stored by the `backend` component
(`components.backend.gifts.*`).

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="id-8">
        
      </a>
      
       <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="recipientemail">
        
      </a>
      
       <code>
        recipientEmail
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="purchaseruserid">
        
      </a>
      
       <code>
        purchaserUserId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="purchaseremail">
        
      </a>
      
       <code>
        purchaserEmail?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Before 0.2 only: gifts no longer keep the purchaser's email.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="purchasername">
        
      </a>
      
       <code>
        purchaserName?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="productids-2">
        
      </a>
      
       <code>
        productIds
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      The credit pack's provider product: what the recipient's claim grants.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="message-2">
        
      </a>
      
       <code>
        message?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="status-3">
        
      </a>
      
       <code>
        status
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        'pending'
      </code>
      
       (the purchaser's checkout is open) → <code>
        'paid'
      </code>
      
       (the purchase is paid and claimable) → <code>
        'claimed'
      </code>
      
      , or <code>
        'refunded'
      </code>
      
       when the purchase was refunded before the claim.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="billingcustomerid">
        
      </a>
      
       <code>
        billingCustomerId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Before 0.2 only: the customer keyed by the recipient's email that the purchase was billed to.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="billingorderid">
        
      </a>
      
       <code>
        billingOrderId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The purchase order, on the purchaser's own customer.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="purchaserentityid">
        
      </a>
      
       <code>
        purchaserEntityId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The billing entity that paid.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="pack">
        
      </a>
      
       <code>
        pack?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The pack's catalog key.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="giftproductid">
        
      </a>
      
       <code>
        giftProductId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The private gift product the purchaser bought.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="packcredits">
        
      </a>
      
       <code>
        packCredits?
      </code>
    </td>
    
    <td>
      { <code>
        meter
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        units
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        rollover
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }
    </td>
    
    <td>
      On an adapter provider, the pack's credits as bought: what the claim grants, whatever the catalog says by then.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        packCredits.meter
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        packCredits.units
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        packCredits.rollover
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="amount-6">
        
      </a>
      
       <code>
        amount?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      What the purchase charged, in the currency's smallest unit.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="currency-7">
        
      </a>
      
       <code>
        currency?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="discountid">
        
      </a>
      
       <code>
        discountId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The single-use 100% discount the recipient claims the pack with.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="claimingentityid">
        
      </a>
      
       <code>
        claimingEntityId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="claiminguserid">
        
      </a>
      
       <code>
        claimingUserId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="claimorderid">
        
      </a>
      
       <code>
        claimOrderId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="claimedbyuserid">
        
      </a>
      
       <code>
        claimedByUserId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="claimedentityid">
        
      </a>
      
       <code>
        claimedEntityId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="createdat">
        
      </a>
      
       <code>
        createdAt
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="paidat">
        
      </a>
      
       <code>
        paidAt?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="notifiedat">
        
      </a>
      
       <code>
        notifiedAt?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      When the recipient's notification email went out — stamped only after the send succeeded.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="claimedat">
        
      </a>
      
       <code>
        claimedAt?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="refundedat">
        
      </a>
      
       <code>
        refundedAt?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="refundfailedat">
        
      </a>
      
       <code>
        refundFailedAt?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      When an adapter provider refused a cancellation's refund at once: the next cancellation asks under a new key.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="plan">
        
      </a>
      
       <code>
        plan?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      A plan pass: the plan's catalog key, and the months the purchaser paid for.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="months-3">
        
      </a>
      
       <code>
        months?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="deliverat">
        
      </a>
      
       <code>
        deliverAt?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      The date the purchaser chose for the notice (the payment's own moment when none), and when it went out: the recipient sees and claims the gift from then.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="deliveredat">
        
      </a>
      
       <code>
        deliveredAt?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="noticedat">
        
      </a>
      
       <code>
        noticedAt?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      The last notice sent (the first, the reminder or a resend), and how many.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="noticecount">
        
      </a>
      
       <code>
        noticeCount?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="recipientchanges">
        
      </a>
      
       <code>
        recipientChanges?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      How many times the purchaser changed the address: each address's notices carry their own idempotency keys.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="remindedat">
        
      </a>
      
       <code>
        remindedAt?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      The one reminder, a week after delivery.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="passsubscriptionid">
        
      </a>
      
       <code>
        passSubscriptionId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      A claimed pass: the subscription it switched, its start and end, and the steps taken toward the end.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="passstartedat">
        
      </a>
      
       <code>
        passStartedAt?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="passendsat">
        
      </a>
      
       <code>
        passEndsAt?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="passreturnscheduledat">
        
      </a>
      
       <code>
        passReturnScheduledAt?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="passnoticedat">
        
      </a>
      
       <code>
        passNoticedAt?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="passendedat">
        
      </a>
      
       <code>
        passEndedAt?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="reversetrial">
        
      </a>
      
       <code>
        reverseTrial?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      A reverse trial's pass, which nobody bought: the workspace started on it.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### GiftTask

Defined in: [src/convex/integrations/billing/types/records.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts)

A task the gift sweep found due.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="kind-2">
        
      </a>
      
       <code>
        kind
      </code>
    </td>
    
    <td>
      <code>
        "deliver"
      </code>
      
       | <code>
        "remind"
      </code>
      
       | <code>
        "schedule_return"
      </code>
      
       | <code>
        "end_pass"
      </code>
      
       | <code>
        "pass_notice"
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="giftid">
        
      </a>
      
       <code>
        giftId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### PricedGiftLength

Defined in: [src/convex/integrations/billing/types/records.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts)

**Experimental**

One length a plan is gifted for, as a pass, from its private purchase
product: what it costs, in [Pricing.currency](https://nuxt-backend.dev/docs/reference/api/use-pricing#currency-2) when the product is
priced in it.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="months-4">
        
      </a>
      
       <code>
        months
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       How many months the pass holds the plan: 1, 3 or 12.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="amount-7">
        
      </a>
      
       <code>
        amount
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       What the gift costs, in the currency's smallest unit.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="currency-8">
        
      </a>
      
       <code>
        currency
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       Lower-case ISO 4217 code.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="monthly">
        
      </a>
      
       <code>
        monthly
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       The same per month: the amount divided by the months, unrounded.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="savings">
        
      </a>
      
       <code>
        savings?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       How many percent it saves against as many months at the plan's monthly price in the same currency, rounded down; absent when it saves nothing.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### PricedPlanGift

Defined in: [src/convex/integrations/billing/types/records.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts)

**Experimental**

A plan's gift as a pass: the lengths it is sold for.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="lengths">
        
      </a>
      
       <code>
        lengths
      </code>
    </td>
    
    <td>
      <a href="#pricedgiftlength">
        <code>
          PricedGiftLength
        </code>
      </a>
      
      <span>
        
      </span>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       One entry per length on sale, shortest first.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### RevenuePeriod

Defined in: [src/convex/integrations/billing/types/revenue.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/revenue.ts)

One period of a read: when it starts, and its values.

#### Extends

- [`RevenueValues`](#revenuevalues)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Inherited from
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="costs">
        
      </a>
      
       <code>
        costs
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <code>
        RevenueValues.costs
      </code>
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="revenue">
        
      </a>
      
       <code>
        revenue
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <code>
        RevenueValues.revenue
      </code>
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="activesubscriptions">
        
      </a>
      
       <code>
        activeSubscriptions
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <code>
        RevenueValues.activeSubscriptions
      </code>
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="churnrate">
        
      </a>
      
       <code>
        churnRate
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <code>
        RevenueValues.churnRate
      </code>
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="lifetimevalue">
        
      </a>
      
       <code>
        lifetimeValue
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <code>
        RevenueValues.lifetimeValue
      </code>
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="newsubscriptions">
        
      </a>
      
       <code>
        newSubscriptions
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <code>
        RevenueValues.newSubscriptions
      </code>
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="renewedsubscriptions">
        
      </a>
      
       <code>
        renewedSubscriptions
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <code>
        RevenueValues.renewedSubscriptions
      </code>
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="churnedsubscriptions">
        
      </a>
      
       <code>
        churnedSubscriptions
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <code>
        RevenueValues.churnedSubscriptions
      </code>
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="checkouts">
        
      </a>
      
       <code>
        checkouts
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <code>
        RevenueValues.checkouts
      </code>
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="costperuser">
        
      </a>
      
       <code>
        costPerUser
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <code>
        RevenueValues.costPerUser
      </code>
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="grossmargin">
        
      </a>
      
       <code>
        grossMargin
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <code>
        RevenueValues.grossMargin
      </code>
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="monthlyrecurringrevenue">
        
      </a>
      
       <code>
        monthlyRecurringRevenue
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <code>
        RevenueValues.monthlyRecurringRevenue
      </code>
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="annualrecurringrevenue">
        
      </a>
      
       <code>
        annualRecurringRevenue
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <code>
        RevenueValues.annualRecurringRevenue
      </code>
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="netrevenue">
        
      </a>
      
       <code>
        netRevenue
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <code>
        RevenueValues.netRevenue
      </code>
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="canceledsubscriptions">
        
      </a>
      
       <code>
        canceledSubscriptions
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <code>
        RevenueValues.canceledSubscriptions
      </code>
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="succeededcheckouts">
        
      </a>
      
       <code>
        succeededCheckouts
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <code>
        RevenueValues.succeededCheckouts
      </code>
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="checkoutsconversion">
        
      </a>
      
       <code>
        checkoutsConversion
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <code>
        RevenueValues.checkoutsConversion
      </code>
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="grossmarginpercentage">
        
      </a>
      
       <code>
        grossMarginPercentage
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <code>
        RevenueValues.grossMarginPercentage
      </code>
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="at-1">
        
      </a>
      
       <code>
        at
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      The period's first moment, in epoch milliseconds.
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/revenue.ts" rel="nofollow">
        src/convex/integrations/billing/types/revenue.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### MeterUsage

Defined in: [src/convex/integrations/billing/types/revenue.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/revenue.ts)

What one metered feature consumed over a read's window.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="meter-6">
        
      </a>
      
       <code>
        meter
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The meter's key in the billing catalog: <code>
        credits
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/revenue.ts" rel="nofollow">
        src/convex/integrations/billing/types/revenue.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="total">
        
      </a>
      
       <code>
        total
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      What it consumed over the whole window, in the meter's own units.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/revenue.ts" rel="nofollow">
        src/convex/integrations/billing/types/revenue.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="periods">
        
      </a>
      
       <code>
        periods
      </code>
    </td>
    
    <td>
      { <code>
        at
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        quantity
      </code>
      
      : <code>
        number
      </code>
      
      ; }<span>
        
      </span>
    </td>
    
    <td>
      What it consumed in each period.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/revenue.ts" rel="nofollow">
        src/convex/integrations/billing/types/revenue.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### RevenueCancellations

Defined in: [src/convex/integrations/billing/types/revenue.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/revenue.ts)

Why people cancelled over the window, and what the cancel flow saved.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="reasons">
        
      </a>
      
       <code>
        reasons
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<a href="#cancellationreason">
        <code>
          CancellationReason
        </code>
      </a>
      
      , <code>
        number
      </code>
      
      >
    </td>
    
    <td>
      Cancellations per reason the cancel flow asks about, as the provider counted them.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/revenue.ts" rel="nofollow">
        src/convex/integrations/billing/types/revenue.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="saveoffers-2">
        
      </a>
      
       <code>
        saveOffers
      </code>
    </td>
    
    <td>
      { <code>
        made
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        accepted
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        truncated
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }
    </td>
    
    <td>
      The cancel flow's save offers made in the window, and how many of them were accepted.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/revenue.ts" rel="nofollow">
        src/convex/integrations/billing/types/revenue.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        saveOffers.made
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/revenue.ts" rel="nofollow">
        src/convex/integrations/billing/types/revenue.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        saveOffers.accepted
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/revenue.ts" rel="nofollow">
        src/convex/integrations/billing/types/revenue.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        saveOffers.truncated
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      The window held more offers than one read counts: the counts cover its oldest ones.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/revenue.ts" rel="nofollow">
        src/convex/integrations/billing/types/revenue.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### RevenueReport

Defined in: [src/convex/integrations/billing/types/revenue.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/revenue.ts)

What `getRevenue` answers: the provider's metrics over a window, per period and in total.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="since">
        
      </a>
      
       <code>
        since
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      The window's first moment, in epoch milliseconds: the start of its first UTC day.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/revenue.ts" rel="nofollow">
        src/convex/integrations/billing/types/revenue.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="until">
        
      </a>
      
       <code>
        until
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      The window's end: the end of its last UTC day.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/revenue.ts" rel="nofollow">
        src/convex/integrations/billing/types/revenue.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="interval-2">
        
      </a>
      
       <code>
        interval
      </code>
    </td>
    
    <td>
      <a href="#revenueinterval">
        <code>
          RevenueInterval
        </code>
      </a>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/revenue.ts" rel="nofollow">
        src/convex/integrations/billing/types/revenue.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="totals">
        
      </a>
      
       <code>
        totals
      </code>
    </td>
    
    <td>
      <a href="#revenuevalues">
        <code>
          RevenueValues
        </code>
      </a>
    </td>
    
    <td>
      Each metric over the whole window.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/revenue.ts" rel="nofollow">
        src/convex/integrations/billing/types/revenue.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="periods-1">
        
      </a>
      
       <code>
        periods
      </code>
    </td>
    
    <td>
      <a href="#revenueperiod">
        <code>
          RevenuePeriod
        </code>
      </a>
      
      <span>
        
      </span>
    </td>
    
    <td>
      Each metric per period, oldest first.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/revenue.ts" rel="nofollow">
        src/convex/integrations/billing/types/revenue.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="cancellations">
        
      </a>
      
       <code>
        cancellations
      </code>
    </td>
    
    <td>
      <a href="#revenuecancellations">
        <code>
          RevenueCancellations
        </code>
      </a>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/revenue.ts" rel="nofollow">
        src/convex/integrations/billing/types/revenue.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="meters-3">
        
      </a>
      
       <code>
        meters
      </code>
    </td>
    
    <td>
      <a href="#meterusage">
        <code>
          MeterUsage
        </code>
      </a>
      
      <span>
        
      </span>
    </td>
    
    <td>
      Usage per meter of the billing catalog, credits included.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/revenue.ts" rel="nofollow">
        src/convex/integrations/billing/types/revenue.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### RevenueOptions

Defined in: [src/convex/integrations/billing/types/revenue.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/revenue.ts)

What `getRevenue` takes.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="since-1">
        
      </a>
      
       <code>
        since
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      The window's start, in epoch milliseconds: read from the start of its UTC day.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/revenue.ts" rel="nofollow">
        src/convex/integrations/billing/types/revenue.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="until-1">
        
      </a>
      
       <code>
        until?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      The window's end, in epoch milliseconds: read to the end of its UTC day. Default: now.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/revenue.ts" rel="nofollow">
        src/convex/integrations/billing/types/revenue.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="interval-3">
        
      </a>
      
       <code>
        interval?
      </code>
    </td>
    
    <td>
      <a href="#revenueinterval">
        <code>
          RevenueInterval
        </code>
      </a>
    </td>
    
    <td>
      How the periods are cut. Default <code>
        day
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/revenue.ts" rel="nofollow">
        src/convex/integrations/billing/types/revenue.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### SaveOfferTerms

Defined in: [src/convex/integrations/billing/types/setup.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts)

A save offer's terms as the component keeps them.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="kind-3">
        
      </a>
      
       <code>
        kind
      </code>
    </td>
    
    <td>
      <code>
        "downgrade"
      </code>
      
       | <code>
        "pause"
      </code>
      
       | <code>
        "discount"
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="months-5">
        
      </a>
      
       <code>
        months?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="resumesat-1">
        
      </a>
      
       <code>
        resumesAt?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="plan-1">
        
      </a>
      
       <code>
        plan?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="productid-5">
        
      </a>
      
       <code>
        productId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="discount-2">
        
      </a>
      
       <code>
        discount?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### BillingComponents

Defined in: [src/convex/integrations/billing/types/setup.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts)

The component handles `setupBilling` reads from your generated `components`
object. Pass the whole object — each key is picked structurally:

- `polar` — the upstream billing-provider component (checkout / portal /
webhooks / customer mapping).
- `backend` — the package's all-in-one component: `billing` is the reactive
entitlement cache, `gifts` the gift-purchase records, `email` (optional)
delivers gift notifications, and `adapter` reads the workspace members
and the roles every call is checked against, fresh.
- `shardedCounter` — the counter component the scaffold mounts: it counts
what each billing entity holds of a quota (`billing.requireQuota`).
- `workpool` — the queue the scaffold mounts: the free plan starts for
each new billing entity through it, a few provider requests at a time.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="polar">
        
      </a>
      
       <code>
        polar
      </code>
    </td>
    
    <td>
      <code>
        ComponentApi
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="workpool">
        
      </a>
      
       <code>
        workpool?
      </code>
    </td>
    
    <td>
      <code>
        WorkpoolComponent
      </code>
    </td>
    
    <td>
      The workpool component the scaffold mounts. The free plan is started through it, so a wave of sign-ups queues its provider requests and retries a refused one; without it, through the scheduler.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="shardedcounter">
        
      </a>
      
       <code>
        shardedCounter?
      </code>
    </td>
    
    <td>
      <code>
        ComponentApi
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       The sharded counter component the scaffold mounts: it keeps how many of each plan quota a billing entity holds (<code>
        billing.requireQuota
      </code>
      
       and <code>
        releaseQuota
      </code>
      
      ). Without it, <code>
        getQuota
      </code>
      
       and <code>
        getFeatures
      </code>
      
       read every quota as nothing used, and counting one throws, naming the mount.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="backend">
        
      </a>
      
       <code>
        backend
      </code>
    </td>
    
    <td>
      { <code>
        adapter
      </code>
      
      : { <code>
        findOne
      </code>
      
      : <code>
        unknown
      </code>
      
      ; <code>
        findMany?
      </code>
      
      : <code>
        unknown
      </code>
      
      ; }; <code>
        billing
      </code>
      
      : { <code>
        getByUser
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        CachedEntitlements
      </code>
      
       | <code>
        null
      </code>
      
      >; <code>
        upsert
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        customerId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        activeProductIds
      </code>
      
      : <code>
        string
      </code>
      
      <span>
        
      </span>
      
      ; <code>
        benefits
      </code>
      
      : <a href="#entitlementbenefit">
        <code>
          EntitlementBenefit
        </code>
      </a>
      
      <span>
        
      </span>
      
      ; <code>
        meters
      </code>
      
      : <a href="#entitlementmeter">
        <code>
          EntitlementMeter
        </code>
      </a>
      
      <span>
        
      </span>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        userByCustomer
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        customerId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      >; <code>
        entityProfile
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <a href="#entityprofile">
        <code>
          EntityProfile
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >; <code>
        claimTrial
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        ownerUserId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        holdMs
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        markTrialUsed
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        ownerUserId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        claimWelcome
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        address
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        reserveDiscountCode
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        max
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        windowMs
      </code>
      
      : <code>
        number
      </code>
      
      ; }, | { <code>
        reserved
      </code>
      
      : <code>
        true
      </code>
      
      ; <code>
        windowStart
      </code>
      
      : <code>
        number
      </code>
      
      ; } | { <code>
        reserved
      </code>
      
      : <code>
        false
      </code>
      
      ; <code>
        retryAfter
      </code>
      
      : <code>
        number
      </code>
      
      ; }>; <code>
        releaseDiscountCode
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        windowStart
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        debit
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        meterId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        externalId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        allowOverage?
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }, { <code>
        ok
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        balance
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        reason?
      </code>
      
      : <code>
        "no-row"
      </code>
      
       | <code>
        "no-meter"
      </code>
      
       | <code>
        "insufficient"
      </code>
      
      ; }>; <code>
        settle
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        externalId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        finalAmount?
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        finalize
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        externalId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        finalAmount?
      </code>
      
      : <code>
        number
      </code>
      
      ; }, { <code>
        settled
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        released
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        balance
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        balanceBefore
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        releaseJobId?
      </code>
      
      : <code>
        string
      </code>
      
      ; }>; <code>
        release
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        externalId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        keep?
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        credit
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        meterId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        externalId?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        clearPendingSpends
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        deleteByUser
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        recordQuotaKey
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        key
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        quotaKeys
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        string
      </code>
      
      <span>
        
      </span>
      
      >; <code>
        getBenefitMetadata
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        benefitIds
      </code>
      
      : <code>
        string
      </code>
      
      <span>
        
      </span>
      
      ; }, { <code>
        benefitId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        metadata
      </code>
      
      : <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        number
      </code>
      
       | <code>
        boolean
      </code>
      
      >; <code>
        description?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        updatedAt
      </code>
      
      : <code>
        number
      </code>
      
      ; }<span>
        
      </span>
      
      >; <code>
        upsertBenefitMetadata
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entries
      </code>
      
      : { <code>
        benefitId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        metadata
      </code>
      
      : <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        number
      </code>
      
       | <code>
        boolean
      </code>
      
      >; <code>
        description?
      </code>
      
      : <code>
        string
      </code>
      
      ; }<span>
        
      </span>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        recordSubscriptionChange
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        pendingChange
      </code>
      
      : | { <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        appliesAt
      </code>
      
      : <code>
        number
      </code>
      
      ; } | <code>
        null
      </code>
      
      ; <code>
        resumesAt
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        modifiedAt
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        subscriptionChanges
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        subscriptionIds
      </code>
      
      : <code>
        string
      </code>
      
      <span>
        
      </span>
      
      ; }, { <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        pendingChange
      </code>
      
      : | { <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        appliesAt
      </code>
      
      : <code>
        number
      </code>
      
      ; } | <code>
        null
      </code>
      
      ; <code>
        resumesAt
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        modifiedAt
      </code>
      
      : <code>
        number
      </code>
      
      ; }<span>
        
      </span>
      
      >; }; <code>
        referrals?
      </code>
      
      : { <code>
        offerFor
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        discount?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        trialDays?
      </code>
      
      : <code>
        number
      </code>
      
      ; } | <code>
        null
      </code>
      
      >; <code>
        orderPaid
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        ownerId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        holdUntil
      </code>
      
      : <code>
        number
      </code>
      
      ; } | <code>
        null
      </code>
      
      >; <code>
        orderRefunded
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      >; }; <code>
        gifts
      </code>
      
      : { <code>
        create
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        recipientEmail
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        purchaserUserId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        purchaserEntityId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        purchaserName?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        pack?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        plan?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        months?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        deliverAt?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        productIds
      </code>
      
      : <code>
        string
      </code>
      
      <span>
        
      </span>
      
      ; <code>
        giftProductId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        packCredits?
      </code>
      
      : { <code>
        meter
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        units
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        rollover
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }; <code>
        message?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        string
      </code>
      
      >; <code>
        markPaid
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        billingOrderId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        amount?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        setDiscount
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        discountId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        markNotified
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        startClaim
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        reservePass
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        until
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        "reserved"
      </code>
      
       | <code>
        "closed"
      </code>
      
       | <code>
        "busy"
      </code>
      
       | <code>
        "taken"
      </code>
      
      >; <code>
        releasePass
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        until
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        beginCancel
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        until
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        endCancel
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        refuseCancel
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        markClaimed
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        claimOrderId?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        markRefunded
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        listByEmail
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        email
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        status?
      </code>
      
      : <code>
        "claimed"
      </code>
      
       | <code>
        "paid"
      </code>
      
      ; }, <a href="#giftrecord">
        <code>
          GiftRecord
        </code>
      </a>
      
      <span>
        
      </span>
      
      >; <code>
        countBought
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        purchaserUserId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        since
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        pendingSince
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        excludeGiftId?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, { <code>
        count
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        oldest
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; }>; <code>
        get
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <a href="#giftrecord">
        <code>
          GiftRecord
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >; <code>
        getByOrder
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        billingOrderId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <a href="#giftrecord">
        <code>
          GiftRecord
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >; <code>
        personalEntity
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      >; <code>
        listByPurchaser
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        purchaserUserId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <a href="#giftrecord">
        <code>
          GiftRecord
        </code>
      </a>
      
      <span>
        
      </span>
      
      >; <code>
        countToAddress
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        email
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        since
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        pendingSince
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        excludeGiftId?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        number
      </code>
      
      >; <code>
        markDelivered
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        noteNotice
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        reminder?
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        setRecipient
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        recipientEmail
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        setDeliverAt
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        deliverAt
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        startPass
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        until
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        endsAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        returnFrom
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        notePass
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        step
      </code>
      
      : <code>
        "ended"
      </code>
      
       | <code>
        "return_scheduled"
      </code>
      
       | <code>
        "noticed"
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        activePass
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        plan
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        months?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        startedAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        endsAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        subscriptionId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        trial?
      </code>
      
      : <code>
        true
      </code>
      
      ; <code>
        rewardId?
      </code>
      
      : <code>
        string
      </code>
      
      ; } | <code>
        null
      </code>
      
      >; <code>
        startTrialPass
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        address
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        plan
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        endsAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        returnFrom
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        startRewardPass
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        rewardId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        plan
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        months
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        endsAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        returnFrom
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        trialPassTaken
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        address
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        due
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        now
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        limit?
      </code>
      
      : <code>
        number
      </code>
      
      ; }, { <code>
        tasks
      </code>
      
      : <a href="#gifttask">
        <code>
          GiftTask
        </code>
      </a>
      
      <span>
        
      </span>
      
      ; <code>
        more
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }>; <code>
        registerSweep
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        wake
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; }; <code>
        webhooks
      </code>
      
      : <code>
        WebhookLogRefs
      </code>
      
      ; <code>
        subscriptions
      </code>
      
      : { <code>
        recordOffer
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        reason
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        offer
      </code>
      
      : <a href="#saveofferterms">
        <code>
          SaveOfferTerms
        </code>
      </a>
      
      ; <code>
        since
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      >; <code>
        lastOffer
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        since
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      >; <code>
        takeOffer
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        offerId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        reason
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        offer
      </code>
      
      : <a href="#saveofferterms">
        <code>
          SaveOfferTerms
        </code>
      </a>
      
      ; <code>
        madeAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        acceptedAt?
      </code>
      
      : <code>
        number
      </code>
      
      ; } | <code>
        null
      </code>
      
      >; <code>
        releaseOffer
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        offerId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        offerCounts
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        since
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        until
      </code>
      
      : <code>
        number
      </code>
      
      ; }, { <code>
        made
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        accepted
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        truncated
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }>; <code>
        recordConsent
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        checkoutId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        interval
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        intervalCount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        termsVersion?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        confirmConsent
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        checkoutId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        at
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        purchasedAt
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      >; <code>
        markOnce
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        key
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        every?
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        recordWithdrawal
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        at
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        withdrawalOf
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        at
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; } | <code>
        null
      </code>
      
      >; <code>
        lifecycleConsole
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, { <code>
        saveOffers
      </code>
      
      : { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        reason
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        offer
      </code>
      
      : <a href="#saveofferterms">
        <code>
          SaveOfferTerms
        </code>
      </a>
      
      ; <code>
        madeAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        acceptedAt?
      </code>
      
      : <code>
        number
      </code>
      
      ; }<span>
        
      </span>
      
      ; <code>
        withdrawals
      </code>
      
      : { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        at
      </code>
      
      : <code>
        number
      </code>
      
      ; }<span>
        
      </span>
      
      ; <code>
        consents
      </code>
      
      : { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        interval
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        intervalCount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        termsVersion?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        consentedAt
      </code>
      
      : <code>
        number
      </code>
      
      ; }<span>
        
      </span>
      
      ; }>; }; <code>
        consents
      </code>
      
      : { <code>
        latest
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        kind
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        kind
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        version
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        granted
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        at
      </code>
      
      : <code>
        number
      </code>
      
      ; } | <code>
        null
      </code>
      
      >; }; <code>
        commerce?
      </code>
      
      : { <code>
        customerOf
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        provider
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        disputeOrder
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        createdAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        provider
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        refundedAmount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        status
      </code>
      
      : <code>
        "refunded"
      </code>
      
       | <code>
        "paid"
      </code>
      
       | <code>
        "partially_refunded"
      </code>
      
       | <code>
        "disputed"
      </code>
      
      ; <code>
        subscriptionId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        taxAmount?
      </code>
      
      : <code>
        number
      </code>
      
      ; } | <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        entityOfCustomer
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        customerId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        provider
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        failRefund
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        amount?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        refundId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        order
      </code>
      
      : { <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        createdAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        provider
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        refundedAmount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        status
      </code>
      
      : <code>
        "refunded"
      </code>
      
       | <code>
        "paid"
      </code>
      
       | <code>
        "partially_refunded"
      </code>
      
       | <code>
        "disputed"
      </code>
      
      ; <code>
        subscriptionId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        taxAmount?
      </code>
      
      : <code>
        number
      </code>
      
      ; }; <code>
        restored
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        undone
      </code>
      
      : <code>
        boolean
      </code>
      
      ; } | <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        forgetEntity
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        getOrder
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        createdAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        provider
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        refundedAmount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        status
      </code>
      
      : <code>
        "refunded"
      </code>
      
       | <code>
        "paid"
      </code>
      
       | <code>
        "partially_refunded"
      </code>
      
       | <code>
        "disputed"
      </code>
      
      ; <code>
        subscriptionId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        taxAmount?
      </code>
      
      : <code>
        number
      </code>
      
      ; } | <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        grantCredits
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        cycleEnd?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        cycleStart?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        externalId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        keep?
      </code>
      
      : <code>
        string
      </code>
      
      <span>
        
      </span>
      
      ; <code>
        meterId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        orderId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        paidBy?
      </code>
      
      : { <code>
        since
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; }; <code>
        rollover
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        source
      </code>
      
      : <code>
        "plan"
      </code>
      
       | <code>
        "pack"
      </code>
      
       | <code>
        "grant"
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, { <code>
        balance
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        granted
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }, <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        grantedTo
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        externalId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        holdReversal
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        amount?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        kind
      </code>
      
      : <code>
        "refund"
      </code>
      
       | <code>
        "dispute"
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        refundId?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        lapseSubscriptionGrants
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        number
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        linkCustomer
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        customerId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        provider
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        linkGrants
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        externalIds
      </code>
      
      : <code>
        string
      </code>
      
      <span>
        
      </span>
      
      ; <code>
        from?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        until?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        listOrders
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        paginationOpts
      </code>
      
      : { <code>
        cursor
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        endCursor?
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        id?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        maximumBytesRead?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        maximumRowsRead?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        numItems
      </code>
      
      : <code>
        number
      </code>
      
      ; }; }, { <code>
        continueCursor
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        isDone
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        page
      </code>
      
      : { <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        createdAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        provider
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        refundedAmount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        status
      </code>
      
      : <code>
        "refunded"
      </code>
      
       | <code>
        "paid"
      </code>
      
       | <code>
        "partially_refunded"
      </code>
      
       | <code>
        "disputed"
      </code>
      
      ; <code>
        subscriptionId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        taxAmount?
      </code>
      
      : <code>
        number
      </code>
      
      ; }<span>
        
      </span>
      
      ; }, <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        recordOrder
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        provider
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        taxAmount?
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        refundAttempt
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        refused?
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        number
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        refundOrder
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        amount?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        refundId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        counted
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        order
      </code>
      
      : { <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        createdAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        provider
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        refundedAmount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        status
      </code>
      
      : <code>
        "refunded"
      </code>
      
       | <code>
        "paid"
      </code>
      
       | <code>
        "partially_refunded"
      </code>
      
       | <code>
        "disputed"
      </code>
      
      ; <code>
        subscriptionId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        taxAmount?
      </code>
      
      : <code>
        number
      </code>
      
      ; }; } | <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        revokeGrant
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        externalId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        number
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        revokeOrderGrants
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        number
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        setPlanState
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        activeProductIds
      </code>
      
      : <code>
        string
      </code>
      
      <span>
        
      </span>
      
      ; <code>
        benefits
      </code>
      
      : { <code>
        benefitId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        files?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        grantedAt?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        licenseKey?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        metadata?
      </code>
      
      : <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        number
      </code>
      
       | <code>
        boolean
      </code>
      
      >; <code>
        repository?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        type
      </code>
      
      : <code>
        string
      </code>
      
      ; }<span>
        
      </span>
      
      ; <code>
        customerId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; }; <code>
        storage?
      </code>
      
      : { <code>
        quotaUsage
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        holder
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        number
      </code>
      
      >>; }; <code>
        account?
      </code>
      
      : { <code>
        isDeleting
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; }; }
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.adapter
      </code>
    </td>
    
    <td>
      { <code>
        findOne
      </code>
      
      : <code>
        unknown
      </code>
      
      ; <code>
        findMany?
      </code>
      
      : <code>
        unknown
      </code>
      
      ; }
    </td>
    
    <td>
      The auth tables' adapter: a member's role and an account's role are read through <code>
        findOne
      </code>
      
      ; the free plan's backfill pages the workspaces (or the users) through <code>
        findMany
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.adapter.findOne
      </code>
    </td>
    
    <td>
      <code>
        unknown
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.adapter.findMany?
      </code>
    </td>
    
    <td>
      <code>
        unknown
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.billing
      </code>
    </td>
    
    <td>
      { <code>
        getByUser
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        CachedEntitlements
      </code>
      
       | <code>
        null
      </code>
      
      >; <code>
        upsert
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        customerId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        activeProductIds
      </code>
      
      : <code>
        string
      </code>
      
      <span>
        
      </span>
      
      ; <code>
        benefits
      </code>
      
      : <a href="#entitlementbenefit">
        <code>
          EntitlementBenefit
        </code>
      </a>
      
      <span>
        
      </span>
      
      ; <code>
        meters
      </code>
      
      : <a href="#entitlementmeter">
        <code>
          EntitlementMeter
        </code>
      </a>
      
      <span>
        
      </span>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        userByCustomer
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        customerId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      >; <code>
        entityProfile
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <a href="#entityprofile">
        <code>
          EntityProfile
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >; <code>
        claimTrial
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        ownerUserId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        holdMs
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        markTrialUsed
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        ownerUserId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        claimWelcome
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        address
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        reserveDiscountCode
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        max
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        windowMs
      </code>
      
      : <code>
        number
      </code>
      
      ; }, | { <code>
        reserved
      </code>
      
      : <code>
        true
      </code>
      
      ; <code>
        windowStart
      </code>
      
      : <code>
        number
      </code>
      
      ; } | { <code>
        reserved
      </code>
      
      : <code>
        false
      </code>
      
      ; <code>
        retryAfter
      </code>
      
      : <code>
        number
      </code>
      
      ; }>; <code>
        releaseDiscountCode
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        windowStart
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        debit
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        meterId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        externalId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        allowOverage?
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }, { <code>
        ok
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        balance
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        reason?
      </code>
      
      : <code>
        "no-row"
      </code>
      
       | <code>
        "no-meter"
      </code>
      
       | <code>
        "insufficient"
      </code>
      
      ; }>; <code>
        settle
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        externalId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        finalAmount?
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        finalize
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        externalId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        finalAmount?
      </code>
      
      : <code>
        number
      </code>
      
      ; }, { <code>
        settled
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        released
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        balance
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        balanceBefore
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        releaseJobId?
      </code>
      
      : <code>
        string
      </code>
      
      ; }>; <code>
        release
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        externalId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        keep?
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        credit
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        meterId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        externalId?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        clearPendingSpends
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        deleteByUser
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        recordQuotaKey
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        key
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        quotaKeys
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        string
      </code>
      
      <span>
        
      </span>
      
      >; <code>
        getBenefitMetadata
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        benefitIds
      </code>
      
      : <code>
        string
      </code>
      
      <span>
        
      </span>
      
      ; }, { <code>
        benefitId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        metadata
      </code>
      
      : <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        number
      </code>
      
       | <code>
        boolean
      </code>
      
      >; <code>
        description?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        updatedAt
      </code>
      
      : <code>
        number
      </code>
      
      ; }<span>
        
      </span>
      
      >; <code>
        upsertBenefitMetadata
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entries
      </code>
      
      : { <code>
        benefitId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        metadata
      </code>
      
      : <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        number
      </code>
      
       | <code>
        boolean
      </code>
      
      >; <code>
        description?
      </code>
      
      : <code>
        string
      </code>
      
      ; }<span>
        
      </span>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        recordSubscriptionChange
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        pendingChange
      </code>
      
      : | { <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        appliesAt
      </code>
      
      : <code>
        number
      </code>
      
      ; } | <code>
        null
      </code>
      
      ; <code>
        resumesAt
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        modifiedAt
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        subscriptionChanges
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        subscriptionIds
      </code>
      
      : <code>
        string
      </code>
      
      <span>
        
      </span>
      
      ; }, { <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        pendingChange
      </code>
      
      : | { <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        appliesAt
      </code>
      
      : <code>
        number
      </code>
      
      ; } | <code>
        null
      </code>
      
      ; <code>
        resumesAt
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        modifiedAt
      </code>
      
      : <code>
        number
      </code>
      
      ; }<span>
        
      </span>
      
      >; }
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.billing.getByUser
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        CachedEntitlements
      </code>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.billing.upsert
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        customerId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        activeProductIds
      </code>
      
      : <code>
        string
      </code>
      
      <span>
        
      </span>
      
      ; <code>
        benefits
      </code>
      
      : <a href="#entitlementbenefit">
        <code>
          EntitlementBenefit
        </code>
      </a>
      
      <span>
        
      </span>
      
      ; <code>
        meters
      </code>
      
      : <a href="#entitlementmeter">
        <code>
          EntitlementMeter
        </code>
      </a>
      
      <span>
        
      </span>
      
      ; }, <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.billing.userByCustomer
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        customerId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.billing.entityProfile
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <a href="#entityprofile">
        <code>
          EntityProfile
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      Who stands behind a workspace entity: its name, whether it is personal, its owner and the workspaces that owner owns; <code>
        null
      </code>
      
       for anything else.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.billing.claimTrial
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        ownerUserId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        holdMs
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      Hold the owner's one trial for this entity's checkout, or say no when it is spent or held for another entity.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.billing.markTrialUsed
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        ownerUserId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      Record that a subscription of this entity started its owner's trial.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.billing.claimWelcome
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        address
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.billing.reserveDiscountCode
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        max
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        windowMs
      </code>
      
      : <code>
        number
      </code>
      
      ; }, | { <code>
        reserved
      </code>
      
      : <code>
        true
      </code>
      
      ; <code>
        windowStart
      </code>
      
      : <code>
        number
      </code>
      
      ; } | { <code>
        reserved
      </code>
      
      : <code>
        false
      </code>
      
      ; <code>
        retryAfter
      </code>
      
      : <code>
        number
      </code>
      
      ; }>
    </td>
    
    <td>
      Count one discount-code attempt for an entity before the provider is asked, in a fixed window of at most <code>
        max
      </code>
      
      : the window's start, or the wait once <code>
        max
      </code>
      
       are counted.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.billing.releaseDiscountCode
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        windowStart
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      Give back an attempt <code>
        reserveDiscountCode
      </code>
      
       counted, in the window it was counted in.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.billing.debit
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        meterId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        externalId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        allowOverage?
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }, { <code>
        ok
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        balance
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        reason?
      </code>
      
      : <code>
        "no-row"
      </code>
      
       | <code>
        "no-meter"
      </code>
      
       | <code>
        "insufficient"
      </code>
      
      ; }>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.billing.settle
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        externalId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        finalAmount?
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.billing.finalize
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        externalId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        finalAmount?
      </code>
      
      : <code>
        number
      </code>
      
      ; }, { <code>
        settled
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        released
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        balance
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        balanceBefore
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        releaseJobId?
      </code>
      
      : <code>
        string
      </code>
      
      ; }>
    </td>
    
    <td>
      settle, reporting whether a reservation was still there to close.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.billing.release
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        externalId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        keep?
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.billing.credit
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        meterId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        externalId?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.billing.clearPendingSpends
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      Drop every in-flight spend reservation for one entity, without re-crediting: used after a refund, where the provider's balance is already the truth and re-subtracting local reservations would push the cache below it.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.billing.deleteByUser
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      Delete one entity's entitlement cache row (account erasure).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.billing.recordQuotaKey
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        key
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      Note that an entity counts a plan quota, once per entity and key.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.billing.quotaKeys
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        string
      </code>
      
      <span>
        
      </span>
      
      >
    </td>
    
    <td>
      Every plan quota an entity has counted, by key.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.billing.getBenefitMetadata
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        benefitIds
      </code>
      
      : <code>
        string
      </code>
      
      <span>
        
      </span>
      
      ; }, { <code>
        benefitId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        metadata
      </code>
      
      : <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        number
      </code>
      
       | <code>
        boolean
      </code>
      
      >; <code>
        description?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        updatedAt
      </code>
      
      : <code>
        number
      </code>
      
      ; }<span>
        
      </span>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.billing.upsertBenefitMetadata
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entries
      </code>
      
      : { <code>
        benefitId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        metadata
      </code>
      
      : <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        number
      </code>
      
       | <code>
        boolean
      </code>
      
      >; <code>
        description?
      </code>
      
      : <code>
        string
      </code>
      
      ; }<span>
        
      </span>
      
      ; }, <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.billing.recordSubscriptionChange
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        pendingChange
      </code>
      
      : | { <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        appliesAt
      </code>
      
      : <code>
        number
      </code>
      
      ; } | <code>
        null
      </code>
      
      ; <code>
        resumesAt
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        modifiedAt
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      Record a subscription's scheduled plan change and resume date (epoch ms), unless a newer state is stored.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.billing.subscriptionChanges
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        subscriptionIds
      </code>
      
      : <code>
        string
      </code>
      
      <span>
        
      </span>
      
      ; }, { <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        pendingChange
      </code>
      
      : | { <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        appliesAt
      </code>
      
      : <code>
        number
      </code>
      
      ; } | <code>
        null
      </code>
      
      ; <code>
        resumesAt
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        modifiedAt
      </code>
      
      : <code>
        number
      </code>
      
      ; }<span>
        
      </span>
      
      >
    </td>
    
    <td>
      The recorded plan changes and resume dates (epoch ms) of these subscriptions, with the provider time each was recorded at.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.referrals?
      </code>
    </td>
    
    <td>
      { <code>
        offerFor
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        discount?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        trialDays?
      </code>
      
      : <code>
        number
      </code>
      
      ; } | <code>
        null
      </code>
      
      >; <code>
        orderPaid
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        ownerId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        holdUntil
      </code>
      
      : <code>
        number
      </code>
      
      ; } | <code>
        null
      </code>
      
      >; <code>
        orderRefunded
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      >; }
    </td>
    
    <td>
      The referral program: what the first paid checkout and the order webhooks ask of it. Absent from a component built before it.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.referrals.offerFor
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        discount?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        trialDays?
      </code>
      
      : <code>
        number
      </code>
      
      ; } | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.referrals.orderPaid
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        ownerId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        holdUntil
      </code>
      
      : <code>
        number
      </code>
      
      ; } | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.referrals.orderRefunded
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts
      </code>
    </td>
    
    <td>
      { <code>
        create
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        recipientEmail
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        purchaserUserId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        purchaserEntityId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        purchaserName?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        pack?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        plan?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        months?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        deliverAt?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        productIds
      </code>
      
      : <code>
        string
      </code>
      
      <span>
        
      </span>
      
      ; <code>
        giftProductId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        packCredits?
      </code>
      
      : { <code>
        meter
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        units
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        rollover
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }; <code>
        message?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        string
      </code>
      
      >; <code>
        markPaid
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        billingOrderId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        amount?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        setDiscount
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        discountId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        markNotified
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        startClaim
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        reservePass
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        until
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        "reserved"
      </code>
      
       | <code>
        "closed"
      </code>
      
       | <code>
        "busy"
      </code>
      
       | <code>
        "taken"
      </code>
      
      >; <code>
        releasePass
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        until
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        beginCancel
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        until
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        endCancel
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        refuseCancel
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        markClaimed
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        claimOrderId?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        markRefunded
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        listByEmail
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        email
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        status?
      </code>
      
      : <code>
        "claimed"
      </code>
      
       | <code>
        "paid"
      </code>
      
      ; }, <a href="#giftrecord">
        <code>
          GiftRecord
        </code>
      </a>
      
      <span>
        
      </span>
      
      >; <code>
        countBought
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        purchaserUserId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        since
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        pendingSince
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        excludeGiftId?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, { <code>
        count
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        oldest
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; }>; <code>
        get
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <a href="#giftrecord">
        <code>
          GiftRecord
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >; <code>
        getByOrder
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        billingOrderId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <a href="#giftrecord">
        <code>
          GiftRecord
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >; <code>
        personalEntity
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      >; <code>
        listByPurchaser
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        purchaserUserId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <a href="#giftrecord">
        <code>
          GiftRecord
        </code>
      </a>
      
      <span>
        
      </span>
      
      >; <code>
        countToAddress
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        email
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        since
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        pendingSince
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        excludeGiftId?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        number
      </code>
      
      >; <code>
        markDelivered
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        noteNotice
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        reminder?
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        setRecipient
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        recipientEmail
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        setDeliverAt
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        deliverAt
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        startPass
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        until
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        endsAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        returnFrom
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        notePass
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        step
      </code>
      
      : <code>
        "ended"
      </code>
      
       | <code>
        "return_scheduled"
      </code>
      
       | <code>
        "noticed"
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        activePass
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        plan
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        months?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        startedAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        endsAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        subscriptionId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        trial?
      </code>
      
      : <code>
        true
      </code>
      
      ; <code>
        rewardId?
      </code>
      
      : <code>
        string
      </code>
      
      ; } | <code>
        null
      </code>
      
      >; <code>
        startTrialPass
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        address
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        plan
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        endsAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        returnFrom
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        startRewardPass
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        rewardId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        plan
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        months
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        endsAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        returnFrom
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        trialPassTaken
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        address
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        due
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        now
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        limit?
      </code>
      
      : <code>
        number
      </code>
      
      ; }, { <code>
        tasks
      </code>
      
      : <a href="#gifttask">
        <code>
          GiftTask
        </code>
      </a>
      
      <span>
        
      </span>
      
      ; <code>
        more
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }>; <code>
        registerSweep
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        wake
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; }
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.create
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        recipientEmail
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        purchaserUserId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        purchaserEntityId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        purchaserName?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        pack?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        plan?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        months?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        deliverAt?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        productIds
      </code>
      
      : <code>
        string
      </code>
      
      <span>
        
      </span>
      
      ; <code>
        giftProductId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        packCredits?
      </code>
      
      : { <code>
        meter
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        units
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        rollover
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }; <code>
        message?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        string
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.markPaid
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        billingOrderId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        amount?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.setDiscount
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        discountId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.markNotified
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.startClaim
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.reservePass
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        until
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        "reserved"
      </code>
      
       | <code>
        "closed"
      </code>
      
       | <code>
        "busy"
      </code>
      
       | <code>
        "taken"
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.releasePass
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        until
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.beginCancel
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        until
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.endCancel
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.refuseCancel
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.markClaimed
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        claimOrderId?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.markRefunded
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.listByEmail
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        email
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        status?
      </code>
      
      : <code>
        "claimed"
      </code>
      
       | <code>
        "paid"
      </code>
      
      ; }, <a href="#giftrecord">
        <code>
          GiftRecord
        </code>
      </a>
      
      <span>
        
      </span>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.countBought
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        purchaserUserId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        since
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        pendingSince
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        excludeGiftId?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, { <code>
        count
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        oldest
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; }>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.get
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <a href="#giftrecord">
        <code>
          GiftRecord
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.getByOrder
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        billingOrderId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <a href="#giftrecord">
        <code>
          GiftRecord
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.personalEntity
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.listByPurchaser
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        purchaserUserId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <a href="#giftrecord">
        <code>
          GiftRecord
        </code>
      </a>
      
      <span>
        
      </span>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.countToAddress
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        email
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        since
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        pendingSince
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        excludeGiftId?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        number
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.markDelivered
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.noteNotice
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        reminder?
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }, <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.setRecipient
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        recipientEmail
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.setDeliverAt
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        deliverAt
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.startPass
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        until
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        endsAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        returnFrom
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.notePass
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        giftId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        step
      </code>
      
      : <code>
        "ended"
      </code>
      
       | <code>
        "return_scheduled"
      </code>
      
       | <code>
        "noticed"
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.activePass
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        plan
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        months?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        startedAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        endsAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        subscriptionId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        trial?
      </code>
      
      : <code>
        true
      </code>
      
      ; <code>
        rewardId?
      </code>
      
      : <code>
        string
      </code>
      
      ; } | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.startTrialPass
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        address
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        plan
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        endsAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        returnFrom
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.startRewardPass
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        rewardId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        plan
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        months
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        endsAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        returnFrom
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.trialPassTaken
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        address
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.due
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        now
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        limit?
      </code>
      
      : <code>
        number
      </code>
      
      ; }, { <code>
        tasks
      </code>
      
      : <a href="#gifttask">
        <code>
          GiftTask
        </code>
      </a>
      
      <span>
        
      </span>
      
      ; <code>
        more
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.gifts.registerSweep
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        wake
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.webhooks
      </code>
    </td>
    
    <td>
      <code>
        WebhookLogRefs
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.subscriptions
      </code>
    </td>
    
    <td>
      { <code>
        recordOffer
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        reason
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        offer
      </code>
      
      : <a href="#saveofferterms">
        <code>
          SaveOfferTerms
        </code>
      </a>
      
      ; <code>
        since
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      >; <code>
        lastOffer
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        since
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      >; <code>
        takeOffer
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        offerId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        reason
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        offer
      </code>
      
      : <a href="#saveofferterms">
        <code>
          SaveOfferTerms
        </code>
      </a>
      
      ; <code>
        madeAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        acceptedAt?
      </code>
      
      : <code>
        number
      </code>
      
      ; } | <code>
        null
      </code>
      
      >; <code>
        releaseOffer
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        offerId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        offerCounts
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        since
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        until
      </code>
      
      : <code>
        number
      </code>
      
      ; }, { <code>
        made
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        accepted
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        truncated
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }>; <code>
        recordConsent
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        checkoutId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        interval
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        intervalCount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        termsVersion?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >; <code>
        confirmConsent
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        checkoutId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        at
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        purchasedAt
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      >; <code>
        markOnce
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        key
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        every?
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        recordWithdrawal
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        at
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; <code>
        withdrawalOf
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        at
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; } | <code>
        null
      </code>
      
      >; <code>
        lifecycleConsole
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, { <code>
        saveOffers
      </code>
      
      : { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        reason
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        offer
      </code>
      
      : <a href="#saveofferterms">
        <code>
          SaveOfferTerms
        </code>
      </a>
      
      ; <code>
        madeAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        acceptedAt?
      </code>
      
      : <code>
        number
      </code>
      
      ; }<span>
        
      </span>
      
      ; <code>
        withdrawals
      </code>
      
      : { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        at
      </code>
      
      : <code>
        number
      </code>
      
      ; }<span>
        
      </span>
      
      ; <code>
        consents
      </code>
      
      : { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        interval
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        intervalCount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        termsVersion?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        consentedAt
      </code>
      
      : <code>
        number
      </code>
      
      ; }<span>
        
      </span>
      
      ; }>; }
    </td>
    
    <td>
      The billing lifecycle's records: save offers, consent proofs, once-marks and withdrawals.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.subscriptions.recordOffer
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        reason
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        offer
      </code>
      
      : <a href="#saveofferterms">
        <code>
          SaveOfferTerms
        </code>
      </a>
      
      ; <code>
        since
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.subscriptions.lastOffer
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        since
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.subscriptions.takeOffer
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        offerId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        reason
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        offer
      </code>
      
      : <a href="#saveofferterms">
        <code>
          SaveOfferTerms
        </code>
      </a>
      
      ; <code>
        madeAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        acceptedAt?
      </code>
      
      : <code>
        number
      </code>
      
      ; } | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.subscriptions.releaseOffer
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        offerId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.subscriptions.offerCounts
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        since
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        until
      </code>
      
      : <code>
        number
      </code>
      
      ; }, { <code>
        made
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        accepted
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        truncated
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }>
    </td>
    
    <td>
      The save offers made in a window, and how many were accepted: the Revenue view's count (analytics).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.subscriptions.recordConsent
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        checkoutId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        interval
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        intervalCount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        termsVersion?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.subscriptions.confirmConsent
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        checkoutId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        at
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.subscriptions.purchasedAt
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.subscriptions.markOnce
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        key
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        every?
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.subscriptions.recordWithdrawal
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        at
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.subscriptions.withdrawalOf
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        at
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; } | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.subscriptions.lifecycleConsole
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, { <code>
        saveOffers
      </code>
      
      : { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        reason
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        offer
      </code>
      
      : <a href="#saveofferterms">
        <code>
          SaveOfferTerms
        </code>
      </a>
      
      ; <code>
        madeAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        acceptedAt?
      </code>
      
      : <code>
        number
      </code>
      
      ; }<span>
        
      </span>
      
      ; <code>
        withdrawals
      </code>
      
      : { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        at
      </code>
      
      : <code>
        number
      </code>
      
      ; }<span>
        
      </span>
      
      ; <code>
        consents
      </code>
      
      : { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        interval
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        intervalCount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        termsVersion?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        consentedAt
      </code>
      
      : <code>
        number
      </code>
      
      ; }<span>
        
      </span>
      
      ; }>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.consents
      </code>
    </td>
    
    <td>
      { <code>
        latest
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        kind
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        kind
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        version
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        granted
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        at
      </code>
      
      : <code>
        number
      </code>
      
      ; } | <code>
        null
      </code>
      
      >; }
    </td>
    
    <td>
      The consent ledger: the terms version a renewal's consent proof names.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.consents.latest
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        kind
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        kind
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        version
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        granted
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        at
      </code>
      
      : <code>
        number
      </code>
      
      ; } | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.commerce?
      </code>
    </td>
    
    <td>
      { <code>
        customerOf
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        provider
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        disputeOrder
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        createdAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        provider
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        refundedAmount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        status
      </code>
      
      : <code>
        "refunded"
      </code>
      
       | <code>
        "paid"
      </code>
      
       | <code>
        "partially_refunded"
      </code>
      
       | <code>
        "disputed"
      </code>
      
      ; <code>
        subscriptionId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        taxAmount?
      </code>
      
      : <code>
        number
      </code>
      
      ; } | <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        entityOfCustomer
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        customerId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        provider
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        failRefund
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        amount?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        refundId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        order
      </code>
      
      : { <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        createdAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        provider
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        refundedAmount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        status
      </code>
      
      : <code>
        "refunded"
      </code>
      
       | <code>
        "paid"
      </code>
      
       | <code>
        "partially_refunded"
      </code>
      
       | <code>
        "disputed"
      </code>
      
      ; <code>
        subscriptionId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        taxAmount?
      </code>
      
      : <code>
        number
      </code>
      
      ; }; <code>
        restored
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        undone
      </code>
      
      : <code>
        boolean
      </code>
      
      ; } | <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        forgetEntity
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        getOrder
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        createdAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        provider
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        refundedAmount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        status
      </code>
      
      : <code>
        "refunded"
      </code>
      
       | <code>
        "paid"
      </code>
      
       | <code>
        "partially_refunded"
      </code>
      
       | <code>
        "disputed"
      </code>
      
      ; <code>
        subscriptionId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        taxAmount?
      </code>
      
      : <code>
        number
      </code>
      
      ; } | <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        grantCredits
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        cycleEnd?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        cycleStart?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        externalId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        keep?
      </code>
      
      : <code>
        string
      </code>
      
      <span>
        
      </span>
      
      ; <code>
        meterId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        orderId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        paidBy?
      </code>
      
      : { <code>
        since
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; }; <code>
        rollover
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        source
      </code>
      
      : <code>
        "plan"
      </code>
      
       | <code>
        "pack"
      </code>
      
       | <code>
        "grant"
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, { <code>
        balance
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        granted
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }, <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        grantedTo
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        externalId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        holdReversal
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        amount?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        kind
      </code>
      
      : <code>
        "refund"
      </code>
      
       | <code>
        "dispute"
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        refundId?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        lapseSubscriptionGrants
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        number
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        linkCustomer
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        customerId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        provider
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        linkGrants
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        externalIds
      </code>
      
      : <code>
        string
      </code>
      
      <span>
        
      </span>
      
      ; <code>
        from?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        until?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        listOrders
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        paginationOpts
      </code>
      
      : { <code>
        cursor
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        endCursor?
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        id?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        maximumBytesRead?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        maximumRowsRead?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        numItems
      </code>
      
      : <code>
        number
      </code>
      
      ; }; }, { <code>
        continueCursor
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        isDone
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        page
      </code>
      
      : { <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        createdAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        provider
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        refundedAmount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        status
      </code>
      
      : <code>
        "refunded"
      </code>
      
       | <code>
        "paid"
      </code>
      
       | <code>
        "partially_refunded"
      </code>
      
       | <code>
        "disputed"
      </code>
      
      ; <code>
        subscriptionId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        taxAmount?
      </code>
      
      : <code>
        number
      </code>
      
      ; }<span>
        
      </span>
      
      ; }, <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        recordOrder
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        provider
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        taxAmount?
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        refundAttempt
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        refused?
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        number
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        refundOrder
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        amount?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        refundId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        counted
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        order
      </code>
      
      : { <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        createdAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        provider
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        refundedAmount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        status
      </code>
      
      : <code>
        "refunded"
      </code>
      
       | <code>
        "paid"
      </code>
      
       | <code>
        "partially_refunded"
      </code>
      
       | <code>
        "disputed"
      </code>
      
      ; <code>
        subscriptionId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        taxAmount?
      </code>
      
      : <code>
        number
      </code>
      
      ; }; } | <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        revokeGrant
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        externalId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        number
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        revokeOrderGrants
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        number
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; <code>
        setPlanState
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        activeProductIds
      </code>
      
      : <code>
        string
      </code>
      
      <span>
        
      </span>
      
      ; <code>
        benefits
      </code>
      
      : { <code>
        benefitId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        files?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        grantedAt?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        licenseKey?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        metadata?
      </code>
      
      : <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        number
      </code>
      
       | <code>
        boolean
      </code>
      
      >; <code>
        repository?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        type
      </code>
      
      : <code>
        string
      </code>
      
      ; }<span>
        
      </span>
      
      ; <code>
        customerId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >; }
    </td>
    
    <td>
      The records of a provider on the neutral adapters (<code>
        BILLING_PROVIDER
      </code>
      
       stripe, dodo or creem): customers, orders and credit grants. Absent on a component built before them, which sells through Polar only.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.commerce.customerOf
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        provider
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/components/backend/_generated/component.ts" rel="nofollow">
        src/convex/components/backend/_generated/component.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.commerce.disputeOrder
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        createdAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        provider
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        refundedAmount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        status
      </code>
      
      : <code>
        "refunded"
      </code>
      
       | <code>
        "paid"
      </code>
      
       | <code>
        "partially_refunded"
      </code>
      
       | <code>
        "disputed"
      </code>
      
      ; <code>
        subscriptionId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        taxAmount?
      </code>
      
      : <code>
        number
      </code>
      
      ; } | <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/components/backend/_generated/component.ts" rel="nofollow">
        src/convex/components/backend/_generated/component.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.commerce.entityOfCustomer
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        customerId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        provider
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/components/backend/_generated/component.ts" rel="nofollow">
        src/convex/components/backend/_generated/component.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.commerce.failRefund
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        amount?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        refundId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        order
      </code>
      
      : { <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        createdAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        provider
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        refundedAmount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        status
      </code>
      
      : <code>
        "refunded"
      </code>
      
       | <code>
        "paid"
      </code>
      
       | <code>
        "partially_refunded"
      </code>
      
       | <code>
        "disputed"
      </code>
      
      ; <code>
        subscriptionId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        taxAmount?
      </code>
      
      : <code>
        number
      </code>
      
      ; }; <code>
        restored
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        undone
      </code>
      
      : <code>
        boolean
      </code>
      
      ; } | <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/components/backend/_generated/component.ts" rel="nofollow">
        src/convex/components/backend/_generated/component.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.commerce.forgetEntity
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/components/backend/_generated/component.ts" rel="nofollow">
        src/convex/components/backend/_generated/component.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.commerce.getOrder
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        createdAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        provider
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        refundedAmount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        status
      </code>
      
      : <code>
        "refunded"
      </code>
      
       | <code>
        "paid"
      </code>
      
       | <code>
        "partially_refunded"
      </code>
      
       | <code>
        "disputed"
      </code>
      
      ; <code>
        subscriptionId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        taxAmount?
      </code>
      
      : <code>
        number
      </code>
      
      ; } | <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/components/backend/_generated/component.ts" rel="nofollow">
        src/convex/components/backend/_generated/component.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.commerce.grantCredits
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        cycleEnd?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        cycleStart?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        externalId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        keep?
      </code>
      
      : <code>
        string
      </code>
      
      <span>
        
      </span>
      
      ; <code>
        meterId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        orderId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        paidBy?
      </code>
      
      : { <code>
        since
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; }; <code>
        rollover
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        source
      </code>
      
      : <code>
        "plan"
      </code>
      
       | <code>
        "pack"
      </code>
      
       | <code>
        "grant"
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, { <code>
        balance
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        granted
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }, <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/components/backend/_generated/component.ts" rel="nofollow">
        src/convex/components/backend/_generated/component.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.commerce.grantedTo
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        externalId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/components/backend/_generated/component.ts" rel="nofollow">
        src/convex/components/backend/_generated/component.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.commerce.holdReversal
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        amount?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        kind
      </code>
      
      : <code>
        "refund"
      </code>
      
       | <code>
        "dispute"
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        refundId?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/components/backend/_generated/component.ts" rel="nofollow">
        src/convex/components/backend/_generated/component.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.commerce.lapseSubscriptionGrants
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        subscriptionId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        number
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/components/backend/_generated/component.ts" rel="nofollow">
        src/convex/components/backend/_generated/component.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.commerce.linkCustomer
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        customerId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        provider
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/components/backend/_generated/component.ts" rel="nofollow">
        src/convex/components/backend/_generated/component.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.commerce.linkGrants
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        externalIds
      </code>
      
      : <code>
        string
      </code>
      
      <span>
        
      </span>
      
      ; <code>
        from?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        until?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/components/backend/_generated/component.ts" rel="nofollow">
        src/convex/components/backend/_generated/component.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.commerce.listOrders
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        paginationOpts
      </code>
      
      : { <code>
        cursor
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        endCursor?
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        id?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        maximumBytesRead?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        maximumRowsRead?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        numItems
      </code>
      
      : <code>
        number
      </code>
      
      ; }; }, { <code>
        continueCursor
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        isDone
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        page
      </code>
      
      : { <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        createdAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        provider
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        refundedAmount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        status
      </code>
      
      : <code>
        "refunded"
      </code>
      
       | <code>
        "paid"
      </code>
      
       | <code>
        "partially_refunded"
      </code>
      
       | <code>
        "disputed"
      </code>
      
      ; <code>
        subscriptionId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        taxAmount?
      </code>
      
      : <code>
        number
      </code>
      
      ; }<span>
        
      </span>
      
      ; }, <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/components/backend/_generated/component.ts" rel="nofollow">
        src/convex/components/backend/_generated/component.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.commerce.recordOrder
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        provider
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        subscriptionId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        taxAmount?
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/components/backend/_generated/component.ts" rel="nofollow">
        src/convex/components/backend/_generated/component.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.commerce.refundAttempt
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        refused?
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        number
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/components/backend/_generated/component.ts" rel="nofollow">
        src/convex/components/backend/_generated/component.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.commerce.refundOrder
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        amount?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        refundId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        counted
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        order
      </code>
      
      : { <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        createdAt
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        provider
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        refundedAmount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        status
      </code>
      
      : <code>
        "refunded"
      </code>
      
       | <code>
        "paid"
      </code>
      
       | <code>
        "partially_refunded"
      </code>
      
       | <code>
        "disputed"
      </code>
      
      ; <code>
        subscriptionId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        taxAmount?
      </code>
      
      : <code>
        number
      </code>
      
      ; }; } | <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/components/backend/_generated/component.ts" rel="nofollow">
        src/convex/components/backend/_generated/component.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.commerce.revokeGrant
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        externalId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        number
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/components/backend/_generated/component.ts" rel="nofollow">
        src/convex/components/backend/_generated/component.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.commerce.revokeOrderGrants
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        orderId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        number
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/components/backend/_generated/component.ts" rel="nofollow">
        src/convex/components/backend/_generated/component.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.commerce.setPlanState
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        activeProductIds
      </code>
      
      : <code>
        string
      </code>
      
      <span>
        
      </span>
      
      ; <code>
        benefits
      </code>
      
      : { <code>
        benefitId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        files?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        grantedAt?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        licenseKey?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        metadata?
      </code>
      
      : <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        number
      </code>
      
       | <code>
        boolean
      </code>
      
      >; <code>
        repository?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        type
      </code>
      
      : <code>
        string
      </code>
      
      ; }<span>
        
      </span>
      
      ; <code>
        customerId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/components/backend/_generated/component.ts" rel="nofollow">
        src/convex/components/backend/_generated/component.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.storage?
      </code>
    </td>
    
    <td>
      { <code>
        quotaUsage
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        holder
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        number
      </code>
      
      >>; }
    </td>
    
    <td>
      What the storage module counts by billing quota key (a holder's files and bytes): a quota read adds it to the count the app claims itself, so a quota shows one number. Absent on a component built before it.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.storage.quotaUsage
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        holder
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        number
      </code>
      
      >>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.account?
      </code>
    </td>
    
    <td>
      { <code>
        isDeleting
      </code>
      
      : <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >; }
    </td>
    
    <td>
      Export and erasure: a billing entity an account's erasure is deleting starts no free plan again. Absent on a component built before it.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.account.isDeleting
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        entityId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### EntityProfile

Defined in: [src/convex/integrations/billing/types/setup.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts)

A workspace entity as its provider customer needs it: the team customer is
named after the workspace and owned by its owner, a personal workspace may
adopt its owner's earlier customer, and one trial counts across every
workspace the owner owns.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="name-12">
        
      </a>
      
       <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="personal">
        
      </a>
      
       <code>
        personal
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="owner">
        
      </a>
      
       <code>
        owner
      </code>
    </td>
    
    <td>
      | { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        email
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        name
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        emailVerified
      </code>
      
      : <code>
        boolean
      </code>
      
      ; } | <code>
        null
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="ownedentityids">
        
      </a>
      
       <code>
        ownedEntityIds
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### BillingEntity

Defined in: [src/convex/integrations/billing/types/setup.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts)

Who a billing operation runs for: the entity that owns the subscription and
the credits — a workspace, or a user with `billTo: 'user'` — and the email
the provider customer is created with. `userId` is the entity's id either
way.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="userid-4">
        
      </a>
      
       <code>
        userId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="email-2">
        
      </a>
      
       <code>
        email
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### BillingAccessRule

Defined in: [src/convex/integrations/billing/types/setup.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts)

Who a billing call is for, as each of the package's own functions names
it, and as `billing.requireEntity` takes it from your own:

- `access: 'member'` — any member of the workspace that pays: reading
the plan, the features, the credits and the usage, and spending credits;
- `access: 'manage'` — its owner or an admin, the billing managers:
checkout, the portal, the plan's lifecycle, orders and invoices.

Membership and the workspace role are read fresh from the member table
once per call, and so is the account (a banned one is refused).
`impersonation: 'refused'` (see [CallerRule](https://nuxt-backend.dev/docs/reference/api/functions#callerrule)) also refuses a
session an administrator opened as the caller.

#### Extends

- [`CallerRule`](https://nuxt-backend.dev/docs/reference/api/functions#callerrule)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Inherited from
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="impersonation">
        
      </a>
      
       <code>
        impersonation?
      </code>
    </td>
    
    <td>
      <code>
        "refused"
      </code>
      
       | <code>
        "allowed"
      </code>
    </td>
    
    <td>
      A session an administrator opened by impersonating the caller: <code>
        'allowed'
      </code>
      
       unless refused.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/functions#callerrule">
        <code>
          CallerRule
        </code>
      </a>
      
      .<a href="https://nuxt-backend.dev/docs/reference/api/functions#impersonation">
        <code>
          impersonation
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/access.ts" rel="nofollow">
        src/convex/integrations/access.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="recentsignin">
        
      </a>
      
       <code>
        recentSignIn?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      How recent a sign-in it takes, in seconds since the person signed in to the session (<code>
        RECENT_SIGN_IN_SECONDS
      </code>
      
      , the package's ten minutes, for its own). An older one is refused as <code>
        reauthentication_required
      </code>
      
      , and so is a token that names no session or carries no <code>
        authTime
      </code>
      
      ; an administrator's visit is refused as <code>
        forbidden
      </code>
      
       (reason <code>
        impersonating
      </code>
      
      ): no sign-in of the person's own stands behind it. A mutation's or an action's rule only: a query is not rerun as time passes.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/functions#callerrule">
        <code>
          CallerRule
        </code>
      </a>
      
      .<a href="https://nuxt-backend.dev/docs/reference/api/functions#recentsignin">
        <code>
          recentSignIn
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/access.ts" rel="nofollow">
        src/convex/integrations/access.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="access">
        
      </a>
      
       <code>
        access
      </code>
    </td>
    
    <td>
      <code>
        "member"
      </code>
      
       | <code>
        "manage"
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="reread">
        
      </a>
      
       <code>
        reread?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Read the member table and the account again even when this call already did: after the same call changed the caller's membership or role.
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### BillingEntityCtx

Defined in: [src/convex/integrations/billing/types/setup.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts)

The context [SetupBillingConfig.resolveEntity](#resolveentity) receives: the caller's
auth, and `runQuery` to read the app's own tables. Queries, mutations and
actions all provide both, so one resolver serves the reactive reads and the
provider calls alike. `auth` is always there; an internal call with no
caller has a `null` identity.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="auth">
        
      </a>
      
       <code>
        auth
      </code>
    </td>
    
    <td>
      <code>
        Auth
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="runquery">
        
      </a>
      
       <code>
        runQuery
      </code>
    </td>
    
    <td>
      <<code>
        Query
      </code>
      
      >(<code>
        query
      </code>
      
      , ...<code>
        args
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        FunctionReturnType
      </code>
      
      <<code>
        Query
      </code>
      
      >>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### CommerceConfig

Defined in: [src/convex/integrations/billing/types/setup.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts)

**Experimental**

What billing sells through a provider on the neutral adapters: see
[SetupBillingConfig.commerce](#commerce).

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="definition">
        
      </a>
      
       <code>
        definition
      </code>
    </td>
    
    <td>
      <a href="#billingcatalog">
        <code>
          BillingCatalog
        </code>
      </a>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       The catalog, as <code>
        billing.catalog.ts
      </code>
      
       defines it.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="products-2">
        
      </a>
      
       <code>
        products
      </code>
    </td>
    
    <td>
      <code>
        Partial
      </code>
      
      <<code>
        Record
      </code>
      
      <<code>
        "sandbox"
      </code>
      
       | <code>
        "production"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
      >>>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       Catalog key → the provider's id for what its checkout sells (a product id, or a price id where the provider sells prices), per billing environment: packs by their key, a plan's monthly price by the plan's key and its yearly one as <code>
        <plan>:year
      </code>
      
      . The free plan needs none: it is the app's own.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="onevent-1">
        
      </a>
      
       <code>
        onEvent?
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        event
      </code>
      
      , <code>
        delivery
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       What the app does with each verified event, in neutral words, after the package kept its records: the place for the app's own reaction to a paid order or a subscription's change. It must be idempotent: a provider sends an event again until it gets a 2xx.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### SetupBillingConfig

Defined in: [src/convex/integrations/billing/types/setup.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="email-3">
        
      </a>
      
       <code>
        email
      </code>
    </td>
    
    <td>
      <a href="#billingemail">
        <code>
          BillingEmail
        </code>
      </a>
    </td>
    
    <td>
      The app's <code>
        setupEmail
      </code>
      
       instance. A gift's recipient hears of it through its <code>
        gift
      </code>
      
       template once the purchase is paid; restyle it there, with <code>
        setupEmail(components, { templates: { gift } })
      </code>
      
      . Checked when <code>
        setupBilling
      </code>
      
       runs: an import cycle through <code>
        email.ts
      </code>
      
       can hand it over as <code>
        undefined
      </code>
      
       despite the type, and that fails the deploy instead of the first paid gift.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="audit">
        
      </a>
      
       <code>
        audit?
      </code>
    </td>
    
    <td>
      <a href="#billingaudit">
        <code>
          BillingAudit
        </code>
      </a>
    </td>
    
    <td>
      The app's <code>
        setupAudit
      </code>
      
       instance (<code>
        backend/audit.ts
      </code>
      
      ): billing records its events through it — a checkout opened, the plan changed, a webhook's subscription, order, refund and benefit, a gift, a credit balance at its mark — so they reach its <code>
        onEvent
      </code>
      
       too. Without it they are recorded on the component's own trail. A free plan's own events record nothing.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="paths">
        
      </a>
      
       <code>
        paths?
      </code>
    </td>
    
    <td>
      <code>
        Partial
      </code>
      
      <<a href="https://nuxt-backend.dev/docs/reference/api/auth#backendpaths">
        <code>
          BackendPaths
        </code>
      </a>
      
      >
    </td>
    
    <td>
      The app's paths, from the <code>
        paths.generated.ts
      </code>
      
       the Nuxt module writes from nuxt.config: the plan-pass and renewal emails link billing managers to <code>
        {SITE_URL}{paths.settings}
      </code>
      
       (<code>
        pages.settings
      </code>
      
      , <code>
        /settings
      </code>
      
       by default).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="accesstoken">
        
      </a>
      
       <code>
        accessToken?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Provider access token. Defaults to the required <code>
        BILLING_ACCESS_TOKEN
      </code>
      
       env var.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="webhooksecret">
        
      </a>
      
       <code>
        webhookSecret?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Webhook signature secret. Defaults to the required <code>
        BILLING_WEBHOOK_SECRET
      </code>
      
       env var.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="products-3">
        
      </a>
      
       <code>
        products?
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
      >
    </td>
    
    <td>
      Friendly product keys → provider product ids (<code>
        { pro: '…' }
      </code>
      
      ), so a current subscription reads with its <code>
        productKey
      </code>
      
      . Usually supplied via <code>
        catalog
      </code>
      
      ; an explicit map wins. Not with <code>
        commerce
      </code>
      
      , whose <code>
        products
      </code>
      
       is the map.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="trustedorigins">
        
      </a>
      
       <code>
        trustedOrigins?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      Origins, besides <code>
        SITE_URL
      </code>
      
      's, a checkout, a gift checkout or the customer portal may send the buyer back to (<code>
        ['https://app.example.com']
      </code>
      
      ) — a second domain the app is served from, say. Every other return or embed URL is refused as <code>
        invalid_input
      </code>
      
      . On a <code>
        development
      </code>
      
       <code>
        BACKEND_ENVIRONMENT
      </code>
      
       local origins are trusted too: loopback on any port, and <code>
        .localhost
      </code>
      
       names over https.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="billto">
        
      </a>
      
       <code>
        billTo?
      </code>
    </td>
    
    <td>
      <code>
        "user"
      </code>
      
       | <code>
        "workspace"
      </code>
    </td>
    
    <td>
      Who owns subscriptions and credits: the active workspace (<code>
        'workspace'
      </code>
      
      , the default — members share the workspace's plan and credits) or the individual user (<code>
        'user'
      </code>
      
      , for B2C apps without shared billing). With <code>
        'workspace'
      </code>
      
       the entity is a workspace, and every call checks the caller's membership and role in it, read fresh from the member table: members read and spend, its owner and admins also buy and manage (see <a href="#billingaccessrule">
        BillingAccessRule
      </a>
      
      ). With <code>
        'user'
      </code>
      
       the caller manages their own billing, or whatever entity your <code>
        resolveEntity
      </code>
      
       returns for them.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="resolveentity">
        
      </a>
      
       <code>
        resolveEntity?
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        rule?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<a href="#billingentity">
        <code>
          BillingEntity
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      Resolve the billing entity yourself, in place of the identity claims <code>
        billTo
      </code>
      
       reads. One resolver for every context: the reactive reads (<code>
        getCurrentSubscription
      </code>
      
      , <code>
        getFeatures
      </code>
      
      , <code>
        getCredits
      </code>
      
      ), checkout and the portal, spends and the subscription lifecycle. It is called with every context, signed in or not, so it must return <code>
        null
      </code>
      
       when <code>
        ctx.auth.getUserIdentity()
      </code>
      
       does: reads then answer <code>
        null
      </code>
      
      , and provider operations refuse. With <code>
        billTo: 'workspace'
      </code>
      
       what it returns must be a workspace the caller belongs to: every billing call, the gifts included, reads their membership and role in it fresh; an entity of your own (a team in your own tables) goes with <code>
        billTo: 'user'
      </code>
      
      , where your resolver is the check. When a call checks its caller it hands the resolver its <a href="#billingaccessrule">
        BillingAccessRule
      </a>
      
       too: refuse a caller who may not have that access by throwing a refusal (<code>
        backendError('forbidden', { reason: 'not_billing_manager' })
      </code>
      
      ), which the reads answer as <code>
        null
      </code>
      
      , or by returning <code>
        null
      </code>
      
      . Treat a missing rule as the strictest case: refuse anything but <code>
        access: 'member'
      </code>
      
       to a caller who may only read. <code>
        billing.resolveEntity
      </code>
      
      , which checks nobody, passes none. <strong>
        Guarantee
      </strong>
      
       - Runs: in every billing function's ctx: a query, a mutation or an action - Delivery: on every billing call, the reads included - Order: before the call reads or writes anything - When it throws: a refusal it throws answers the reads with <code>
        null
      </code>
      
       and refuses the rest - Idempotency: a read only; return <code>
        null
      </code>
      
       when there is no identity
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="ratelimiter">
        
      </a>
      
       <code>
        rateLimiter?
      </code>
    </td>
    
    <td>
      <a href="#billingratelimiter">
        <code>
          BillingRateLimiter
        </code>
      </a>
    </td>
    
    <td>
      Throttle every client-callable function that reaches the live provider — <code>
        syncEntitlements
      </code>
      
      , <code>
        syncProducts
      </code>
      
      , checkout, the subscription-lifecycle actions, order history and invoices. Pass your <code>
        setupRateLimiter(...)
      </code>
      
       limiter and each authenticated call is checked against the <code>
        billingSync
      </code>
      
       limit (10/min, keyed by the workspace/user), so a caller can't loop one to amplify the provider fan-out. <code>
        giftCheckout
      </code>
      
       burns the same limit keyed by the purchaser. Omit to leave them unthrottled.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="multiplesubscriptions">
        
      </a>
      
       <code>
        multipleSubscriptions?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Let one billing entity hold several live subscriptions at once (a plan plus add-ons, say). The upstream single-subscription read throws the moment a second one exists, so this switches <code>
        getCurrentSubscription
      </code>
      
       to the subscriptions-array-first shape (<a href="#currentsubscriptions">
        CurrentSubscriptions
      </a>
      
      ) and makes <code>
        subscriptionId
      </code>
      
       the way lifecycle actions pick their target.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="requireadmin">
        
      </a>
      
       <code>
        requireAdmin?
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Gate the admin-tier billing functions (<code>
        refundOrder
      </code>
      
       — moving real money — and the webhook delivery log). Throw from here to refuse. The default requires the <code>
        admin
      </code>
      
       role on the account, read fresh from the user table (the admin plugin's role), so a demoted admin is refused on their next call; supply your own to check permissions, a workspace role, or an allowlist. <code>
        refundOrder
      </code>
      
       refuses an impersonated session before either gate runs. <strong>
        Guarantee
      </strong>
      
       - Runs: in the admin-tier function's ctx (<code>
        refundOrder
      </code>
      
      , the webhook log) - Delivery: on every admin-tier call - Order: after the impersonation refusal, before the call - When it throws: the call is refused - Idempotency: a read only
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="events">
        
      </a>
      
       <code>
        events?
      </code>
    </td>
    
    <td>
      <code>
        Partial
      </code>
      
      <<code>
        WebhookEventHandlers
      </code>
      
      >
    </td>
    
    <td>
      React to billing webhook events, keyed by the provider's own event names (<code>
        'order.paid'
      </code>
      
      , <code>
        'subscription.active'
      </code>
      
      , …). Your handler runs <strong>
        after
      </strong>
      
       the built-in entitlement-cache refresh (and gift fulfilment), so features/credits read fresh inside it. Events outside the built-in refresh set are mounted too. <strong>
        Guarantee
      </strong>
      
       - Runs: in the webhook's HTTP action, after the built-in entitlement refresh and gift fulfilment - Delivery: at least once: a delivery already processed answers 200 without running it again, but one that threw is redelivered - Order: as the provider delivers: no order across events - When it throws: logged as <code>
        handler_error
      </code>
      
      , answered 500, and the provider retries - Idempotency: key what it writes on the event's id
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="cangift">
        
      </a>
      
       <code>
        canGift?
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        input
      </code>
      
      ) => | <code>
        true
      </code>
      
       | <code>
        Promise
      </code>
      
      < | <code>
        true
      </code>
      
       | { <code>
        allowed
      </code>
      
      : <code>
        false
      </code>
      
      ; <code>
        message?
      </code>
      
      : <code>
        string
      </code>
      
      ; }> | { <code>
        allowed
      </code>
      
      : <code>
        false
      </code>
      
      ; <code>
        message?
      </code>
      
      : <code>
        string
      </code>
      
      ; }
    </td>
    
    <td>
      Decide who may receive a gift, before <code>
        giftCheckout
      </code>
      
       opens the purchaser's checkout — only addresses on your own domain, say, or only sandbox addresses on a public demo. It adds to the package's own rules, which always hold: no gift to the purchaser's own address, an earlier paid order of the purchaser's first, and <a href="#giftlimit">
        SetupBillingConfig.giftLimit
      </a>
      
      . Return <code>
        true
      </code>
      
       to allow, or a refusal whose <code>
        message
      </code>
      
       <code>
        giftCheckout
      </code>
      
       throws as a <code>
        ConvexError
      </code>
      
      , so it reaches the purchaser even where production redacts other errors (default: "This address can't receive gifts."). Called with the action ctx, so it can read your own tables; <code>
        recipientEmail
      </code>
      
       is lower-cased, and <code>
        purchaserEntityId
      </code>
      
       is the billing entity that pays. <strong>
        Guarantee
      </strong>
      
       - Runs: in <code>
        giftCheckout
      </code>
      
      's action ctx, after the package's own gift rules - Delivery: once per gift checkout - Order: before the purchaser's checkout opens - When it throws: the error fails the gift checkout; return a refusal instead, whose message reaches the purchaser as <code>
        forbidden
      </code>
      
      , reason <code>
        gift_refused
      </code>
      
       - Idempotency: a read only
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="giftlimit">
        
      </a>
      
       <code>
        giftLimit?
      </code>
    </td>
    
    <td>
      { <code>
        max?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        days?
      </code>
      
      : <code>
        number
      </code>
      
      ; }
    </td>
    
    <td>
      How many gifts one purchaser may buy in a window: <code>
        max
      </code>
      
       paid gifts in <code>
        days
      </code>
      
       days (default 10 in 30). A stolen card that can buy gifts for strangers is a way to cash it out, and a claimed gift can't be taken back, so the cap holds whatever rate limiter the app passes. A further purchase is <code>
        rate_limited
      </code>
      
       (<code>
        limit: 'gifts'
      </code>
      
      ).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        giftLimit.max?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        giftLimit.days?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="checkoutdiscount">
        
      </a>
      
       <code>
        checkoutDiscount?
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        input
      </code>
      
      ) => | <code>
        string
      </code>
      
       | <code>
        Promise
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        null
      </code>
      
       | <code>
        undefined
      </code>
      
      > | <code>
        null
      </code>
      
       | <code>
        undefined
      </code>
    </td>
    
    <td>
      Pick a server-side discount for a plan's checkout: the key of a catalog discount, or <code>
        null
      </code>
      
       for none. It runs on every checkout of a catalog plan that names no discount of its own (no <code>
        discount
      </code>
      
      , <code>
        discountCode
      </code>
      
       or <code>
        discountId
      </code>
      
      ), from <code>
        <PricingTable>
      </code>
      
      , <code>
        useBilling().checkout
      </code>
      
       and <code>
        billing.checkout
      </code>
      
       alike: the place to give a cohort its price, such as founder pricing for accounts made before a launch. It decides who qualifies; the provider still checks the discount's dates, caps and per-customer limit, and one it no longer redeems (ended, used up) is dropped: the checkout opens again without it, at the regular price. A discount that applies to none of the checkout's products is never sent. A key the catalog does not have throws, naming it. <code>
        userId
      </code>
      
       is the person checking out, <code>
        entityId
      </code>
      
       the billing entity that pays (the workspace, with <code>
        billTo: 'workspace'
      </code>
      
      ). <strong>
        Guarantee
      </strong>
      
       - Runs: in the checkout's action ctx, after the caller and every input are checked - Delivery: once per checkout of a catalog plan that names no discount of its own - Order: before the provider checkout is created - When it throws: the checkout fails with the error - Idempotency: a read only
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="credits-2">
        
      </a>
      
       <code>
        credits?
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <a href="#creditmeterconfig">
        <code>
          CreditMeterConfig
        </code>
      </a>
      
      >
    </td>
    
    <td>
      Named credit meters: spend by friendly name (<code>
        spendCredits({ meter: 'credits' })
      </code>
      
      , <code>
        useCredits({ meter: 'credits' })
      </code>
      
      ) instead of provider meter ids. Usually supplied via <code>
        catalog
      </code>
      
      ; explicit entries here win.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="catalog">
        
      </a>
      
       <code>
        catalog?
      </code>
    </td>
    
    <td>
      <code>
        Partial
      </code>
      
      <<code>
        Record
      </code>
      
      <<code>
        "sandbox"
      </code>
      
       | <code>
        "production"
      </code>
      
      , <a href="#billingcatalogids">
        <code>
          BillingCatalogIds
        </code>
      </a>
      
       | <code>
        undefined
      </code>
      
      >>
    </td>
    
    <td>
      The environment-keyed id map generated by <code>
        nuxt-backend billing sync
      </code>
      
       (<code>
        backend/billing.generated.ts
      </code>
      
      ): fills <code>
        products
      </code>
      
       and <code>
        credits
      </code>
      
       for the deployment's billing environment, so provider UUIDs live in exactly one generated file. Explicit <code>
        products
      </code>
      
      /<code>
        credits
      </code>
      
       config wins.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="commerce">
        
      </a>
      
       <code>
        commerce?
      </code>
    </td>
    
    <td>
      <a href="#commerceconfig">
        <code>
          CommerceConfig
        </code>
      </a>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       What billing sells through a provider on the neutral adapters, read when <code>
        BILLING_PROVIDER
      </code>
      
       is <code>
        stripe
      </code>
      
      , <code>
        dodo
      </code>
      
       or <code>
        creem
      </code>
      
       (and refused without it there): the catalog itself (<code>
        billing.catalog.ts
      </code>
      
      's default export), whose plans, packs, features, quotas and credit grants the app keeps where no provider holds them, and the provider's id for each of its products, by catalog key and billing environment. <code>
        billing sync
      </code>
      
       writes Polar's ids only: create the products in the provider's dashboard and name them here. <strong>
        Example
      </strong>
      
       <code>
        import definition from './billing.catalog' setupBilling(components, { email, commerce: { definition, products: { sandbox: { 'studio': 'price_123', 'studio:year': 'price_456', 'credits100': 'price_789' }, }, }, })
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="lifecycle">
        
      </a>
      
       <code>
        lifecycle?
      </code>
    </td>
    
    <td>
      <a href="#billinglifecycle">
        <code>
          BillingLifecycle
        </code>
      </a>
    </td>
    
    <td>
      The billing lifecycle beyond the provider's own: save offers by cancellation reason for the cancel flow, the abandoned-checkout hand-off, the annual renewal reminder for short cycles, and the EU withdrawal button. Each is off until named. <strong>
        Example
      </strong>
      
       <code>
        setupBilling(components, { catalog, email, lifecycle: { saveOffers: { too_expensive: { discount: 'stay30' }, unused: { pause: { months: 2 } } }, abandonedCheckout: true, renewalReminders: true, withdrawal: true, }, })
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="onunknownevent">
        
      </a>
      
       <code>
        onUnknownEvent?
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        event
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Called for an <strong>
        authentic
      </strong>
      
       (signature-verified) webhook event whose type this package's provider SDK cannot parse — e.g. an event newer than the installed package. The delivery is acknowledged with 202 when it returns, so an unknown type never puts the endpoint into a retry loop; a throw answers 500, and the provider redelivers. <strong>
        Guarantee
      </strong>
      
       - Runs: in the webhook's HTTP action, for a verified event of a type this package does not know - Delivery: at least once: answered 202 when it returns, and redelivered when it throws - Order: as the provider delivers: no order across events - When it throws: logged as <code>
        handler_error
      </code>
      
      , answered 500, and the provider retries - Idempotency: key what it writes on the event's id
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### AccountBillingErasureInput

Defined in: [src/convex/integrations/billing/types/surface.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts)

What an account's erasure hands billing: the account, the workspaces that go with it, and the ones it leaves.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="userid-5">
        
      </a>
      
       <code>
        userId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="deleted">
        
      </a>
      
       <code>
        deleted
      </code>
    </td>
    
    <td>
      readonly <code>
        string
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      The workspaces deleted with the account.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="left">
        
      </a>
      
       <code>
        left
      </code>
    </td>
    
    <td>
      readonly <code>
        string
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      The workspaces the account leaves, others staying.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### AccountBillingRecord

Defined in: [src/convex/integrations/billing/types/surface.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts)

One billing entity's part of an account's export.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="entityid-5">
        
      </a>
      
       <code>
        entityId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="subscriptions-1">
        
      </a>
      
       <code>
        subscriptions
      </code>
    </td>
    
    <td>
      <code>
        unknown
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      Its subscriptions, as the app synced them from the provider.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="orders">
        
      </a>
      
       <code>
        orders
      </code>
    </td>
    
    <td>
      | { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        createdAt
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        status
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        currency
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        billingReason
      </code>
      
      : <code>
        string
      </code>
      
      ; }<span>
        
      </span>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      Its newest orders at the provider; <code>
        null
      </code>
      
       when the provider could not be read.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### Billing

Defined in: [src/convex/integrations/billing/types/surface.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="api">
        
      </a>
      
       <code>
        api
      </code>
    </td>
    
    <td>
      <code>
        Pick
      </code>
      
      <{ <code>
        changeCurrentSubscription
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "public"
      </code>
      
      , { <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >>; <code>
        cancelCurrentSubscription
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "public"
      </code>
      
      , { <code>
        revokeImmediately?
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }, <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >>; <code>
        getConfiguredProducts
      </code>
      
      : <code>
        RegisteredQuery
      </code>
      
      <<code>
        "public"
      </code>
      
      , { }, <code>
        Promise
      </code>
      
      <{ [<code>
        key
      </code>
      
      : <code>
        string
      </code>
      
      ]: | { <code>
        benefits?
      </code>
      
      : { <code>
        createdAt
      </code>
      
      : ...; <code>
        deletable
      </code>
      
      : ...; <code>
        description
      </code>
      
      : ...; <code>
        id
      </code>
      
      : ...; <code>
        metadata?
      </code>
      
      : ...; <code>
        modifiedAt
      </code>
      
      : ...; <code>
        organizationId
      </code>
      
      : ...; <code>
        properties?
      </code>
      
      : ...; <code>
        selectable
      </code>
      
      : ...; <code>
        type
      </code>
      
      : ...; }<span>
        
      </span>
      
      ; <code>
        createdAt
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        description
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        isArchived
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        isRecurring
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        medias
      </code>
      
      : { <code>
        checksumEtag
      </code>
      
      : ... | ...; <code>
        checksumSha256Base64
      </code>
      
      : ... | ...; <code>
        checksumSha256Hex
      </code>
      
      : ... | ...; <code>
        createdAt
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        isUploaded
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        lastModifiedAt
      </code>
      
      : ... | ...; <code>
        mimeType
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        name
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        organizationId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        path
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        publicUrl
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        service?
      </code>
      
      : ... | ...; <code>
        size
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        sizeReadable
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        storageVersion
      </code>
      
      : ... | ...; <code>
        version
      </code>
      
      : ... | ...; }<span>
        
      </span>
      
      ; <code>
        metadata?
      </code>
      
      : <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        any
      </code>
      
      >; <code>
        modifiedAt
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        name
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        organizationId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        priceAmount?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        prices
      </code>
      
      : { <code>
        amountType?
      </code>
      
      : ... | ...; <code>
        capAmount?
      </code>
      
      : ... | ... | ...; <code>
        createdAt
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        isArchived
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        maximumAmount?
      </code>
      
      : ... | ... | ...; <code>
        meter?
      </code>
      
      : ... | ...; <code>
        meterId?
      </code>
      
      : ... | ...; <code>
        minimumAmount?
      </code>
      
      : ... | ... | ...; <code>
        modifiedAt
      </code>
      
      : ... | ...; <code>
        presetAmount?
      </code>
      
      : ... | ... | ...; <code>
        priceAmount?
      </code>
      
      : ... | ...; <code>
        priceCurrency?
      </code>
      
      : ... | ...; <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        recurringInterval?
      </code>
      
      : ... | ... | ...; <code>
        seatTiers?
      </code>
      
      : ... | ...; <code>
        source?
      </code>
      
      : ... | ...; <code>
        type?
      </code>
      
      : ... | ...; <code>
        unitAmount?
      </code>
      
      : ... | ...; }<span>
        
      </span>
      
      ; <code>
        recurringInterval?
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        recurringIntervalCount?
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        trialInterval?
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        trialIntervalCount?
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; } | <code>
        undefined
      </code>
      
      ; }>>; <code>
        listAllProducts
      </code>
      
      : <code>
        RegisteredQuery
      </code>
      
      <<code>
        "public"
      </code>
      
      , { }, <code>
        Promise
      </code>
      
      <{ <code>
        benefits?
      </code>
      
      : { <code>
        createdAt
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        deletable
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        description
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        metadata?
      </code>
      
      : ... | ...; <code>
        modifiedAt
      </code>
      
      : ... | ...; <code>
        organizationId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        properties?
      </code>
      
      : <code>
        any
      </code>
      
      ; <code>
        selectable
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        type
      </code>
      
      : <code>
        string
      </code>
      
      ; }<span>
        
      </span>
      
      ; <code>
        createdAt
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        description
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        isArchived
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        isRecurring
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        medias
      </code>
      
      : { <code>
        checksumEtag
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        checksumSha256Base64
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        checksumSha256Hex
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        createdAt
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        isUploaded
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        lastModifiedAt
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        mimeType
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        name
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        organizationId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        path
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        publicUrl
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        service?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        size
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        sizeReadable
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        storageVersion
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        version
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; }<span>
        
      </span>
      
      ; <code>
        metadata?
      </code>
      
      : <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        any
      </code>
      
      >; <code>
        modifiedAt
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        name
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        organizationId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        priceAmount?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        prices
      </code>
      
      : { <code>
        amountType?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        capAmount?
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        createdAt
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        isArchived
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        maximumAmount?
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        meter?
      </code>
      
      : { <code>
        id
      </code>
      
      : ...; <code>
        name
      </code>
      
      : ...; }; <code>
        meterId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        minimumAmount?
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        modifiedAt
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        presetAmount?
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        priceAmount?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        priceCurrency?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        recurringInterval?
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        seatTiers?
      </code>
      
      : ...<span>
        
      </span>
      
      ; <code>
        source?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        type?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        unitAmount?
      </code>
      
      : <code>
        string
      </code>
      
      ; }<span>
        
      </span>
      
      ; <code>
        recurringInterval?
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        recurringIntervalCount?
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        trialInterval?
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        trialIntervalCount?
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; }<span>
        
      </span>
      
      >>; <code>
        listAllSubscriptions
      </code>
      
      : <code>
        RegisteredQuery
      </code>
      
      <<code>
        "public"
      </code>
      
      , { }, <code>
        Promise
      </code>
      
      <{ <code>
        amount
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        cancelAtPeriodEnd
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        canceledAt?
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        checkoutId
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        createdAt
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        currency
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        currentPeriodEnd
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        currentPeriodStart
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        customFieldData?
      </code>
      
      : <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        any
      </code>
      
      >; <code>
        customerCancellationComment?
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        customerCancellationReason?
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        customerId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        discountId?
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        endedAt
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        endsAt?
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        metadata
      </code>
      
      : <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        any
      </code>
      
      >; <code>
        modifiedAt
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        priceId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        product
      </code>
      
      : | { <code>
        benefits?
      </code>
      
      : ...<span>
        
      </span>
      
      ; <code>
        createdAt
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        description
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        isArchived
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        isRecurring
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        medias
      </code>
      
      : { <code>
        checksumEtag
      </code>
      
      : ...; <code>
        checksumSha256Base64
      </code>
      
      : ...; <code>
        checksumSha256Hex
      </code>
      
      : ...; <code>
        createdAt
      </code>
      
      : ...; <code>
        id
      </code>
      
      : ...; <code>
        isUploaded
      </code>
      
      : ...; <code>
        lastModifiedAt
      </code>
      
      : ...; <code>
        mimeType
      </code>
      
      : ...; <code>
        name
      </code>
      
      : ...; <code>
        organizationId
      </code>
      
      : ...; <code>
        path
      </code>
      
      : ...; <code>
        publicUrl
      </code>
      
      : ...; <code>
        service?
      </code>
      
      : ...; <code>
        size
      </code>
      
      : ...; <code>
        sizeReadable
      </code>
      
      : ...; <code>
        storageVersion
      </code>
      
      : ...; <code>
        version
      </code>
      
      : ...; }<span>
        
      </span>
      
      ; <code>
        metadata?
      </code>
      
      : <code>
        Record
      </code>
      
      <..., ...>; <code>
        modifiedAt
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        name
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        organizationId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        prices
      </code>
      
      : { <code>
        amountType?
      </code>
      
      : ...; <code>
        capAmount?
      </code>
      
      : ...; <code>
        createdAt
      </code>
      
      : ...; <code>
        id
      </code>
      
      : ...; <code>
        isArchived
      </code>
      
      : ...; <code>
        maximumAmount?
      </code>
      
      : ...; <code>
        meter?
      </code>
      
      : ...; <code>
        meterId?
      </code>
      
      : ...; <code>
        minimumAmount?
      </code>
      
      : ...; <code>
        modifiedAt
      </code>
      
      : ...; <code>
        presetAmount?
      </code>
      
      : ...; <code>
        priceAmount?
      </code>
      
      : ...; <code>
        priceCurrency?
      </code>
      
      : ...; <code>
        productId
      </code>
      
      : ...; <code>
        recurringInterval?
      </code>
      
      : ...; <code>
        seatTiers?
      </code>
      
      : ...; <code>
        source?
      </code>
      
      : ...; <code>
        type?
      </code>
      
      : ...; <code>
        unitAmount?
      </code>
      
      : ...; }<span>
        
      </span>
      
      ; <code>
        recurringInterval?
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        recurringIntervalCount?
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        trialInterval?
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        trialIntervalCount?
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; } | <code>
        null
      </code>
      
      ; <code>
        productId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        recurringInterval
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        recurringIntervalCount?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        seats?
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        startedAt
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        status
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        trialEnd?
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        trialStart?
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; }<span>
        
      </span>
      
      >>; <code>
        generateCheckoutLink
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "public"
      </code>
      
      , { <code>
        metadata?
      </code>
      
      : <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
      >; <code>
        trialInterval?
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        trialIntervalCount?
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        subscriptionId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        locale?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        productIds
      </code>
      
      : <code>
        string
      </code>
      
      <span>
        
      </span>
      
      ; <code>
        origin
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        successUrl
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        Promise
      </code>
      
      <{ <code>
        url
      </code>
      
      : <code>
        string
      </code>
      
      ; }>>; <code>
        generateCustomerPortalUrl
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "public"
      </code>
      
      , { <code>
        returnUrl?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        Promise
      </code>
      
      <{ <code>
        url
      </code>
      
      : <code>
        string
      </code>
      
      ; }>>; }, <code>
        "getConfiguredProducts"
      </code>
      
      > & { <code>
        getPricing
      </code>
      
      : <code>
        RegisteredQuery
      </code>
      
      <<code>
        "public"
      </code>
      
      , { <code>
        currency?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        discount?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        Promise
      </code>
      
      <<a href="https://nuxt-backend.dev/docs/reference/api/use-pricing#pricing">
        <code>
          Pricing
        </code>
      </a>
      
      >>; <code>
        listAllSubscriptions
      </code>
      
      : <code>
        RegisteredQuery
      </code>
      
      <<code>
        "public"
      </code>
      
      >; <code>
        giftCheckout
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "public"
      </code>
      
      >; <code>
        generateCheckoutLink
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "public"
      </code>
      
      , <a href="#checkoutoptions">
        <code>
          CheckoutOptions
        </code>
      </a>
      
      , <code>
        Promise
      </code>
      
      <{ <code>
        url
      </code>
      
      : <code>
        string
      </code>
      
      ; }>>; <code>
        generateCustomerPortalUrl
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "public"
      </code>
      
      , { <code>
        returnUrl?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        Promise
      </code>
      
      <{ <code>
        url
      </code>
      
      : <code>
        string
      </code>
      
      ; }>>; <code>
        getCurrentSubscription
      </code>
      
      : <code>
        RegisteredQuery
      </code>
      
      <<code>
        "public"
      </code>
      
      >; <code>
        getFeatures
      </code>
      
      : <code>
        RegisteredQuery
      </code>
      
      <<code>
        "public"
      </code>
      
      >; <code>
        getCredits
      </code>
      
      : <code>
        RegisteredQuery
      </code>
      
      <<code>
        "public"
      </code>
      
      >; <code>
        getBillingAccess
      </code>
      
      : <code>
        RegisteredQuery
      </code>
      
      <<code>
        "public"
      </code>
      
      >; <code>
        syncEntitlements
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "public"
      </code>
      
      >; <code>
        syncProducts
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "internal"
      </code>
      
      >; <code>
        startFreePlan
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "internal"
      </code>
      
      >; <code>
        resyncEntitlements
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "internal"
      </code>
      
      >; <code>
        getReceivedGifts
      </code>
      
      : <code>
        RegisteredQuery
      </code>
      
      <<code>
        "public"
      </code>
      
      >; <code>
        claimGift
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "public"
      </code>
      
      >; <code>
        getSentGifts
      </code>
      
      : <code>
        RegisteredQuery
      </code>
      
      <<code>
        "public"
      </code>
      
      >; <code>
        resendGift
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "public"
      </code>
      
      >; <code>
        changeGiftRecipient
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "public"
      </code>
      
      >; <code>
        rescheduleGift
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "public"
      </code>
      
      >; <code>
        cancelGift
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "public"
      </code>
      
      >; <code>
        runGiftSweep
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "internal"
      </code>
      
      >; <code>
        getBillingConsole
      </code>
      
      : <code>
        RegisteredQuery
      </code>
      
      <<code>
        "public"
      </code>
      
      , { <code>
        entityId?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        Promise
      </code>
      
      <<a href="#billingconsole">
        <code>
          BillingConsole
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >>; <code>
        updateSubscription
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "public"
      </code>
      
      >; <code>
        cancelSubscription
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "public"
      </code>
      
      , { <code>
        subscriptionId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        atPeriodEnd?
      </code>
      
      : <code>
        boolean
      </code>
      
      ; <code>
        reason?
      </code>
      
      : <a href="#cancellationreason">
        <code>
          CancellationReason
        </code>
      </a>
      
      ; <code>
        comment?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        offer?
      </code>
      
      : <code>
        false
      </code>
      
      ; }, <code>
        Promise
      </code>
      
      <<a href="https://nuxt-backend.dev/docs/reference/api/use-billing#canceloutcome">
        <code>
          CancelOutcome
        </code>
      </a>
      
      >>; <code>
        getCancelFlow
      </code>
      
      : <code>
        RegisteredQuery
      </code>
      
      <<code>
        "public"
      </code>
      
      , { <code>
        subscriptionId?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        Promise
      </code>
      
      < | <a href="https://nuxt-backend.dev/docs/reference/api/use-billing#cancelflowstate">
        <code>
          CancelFlowState
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >>; <code>
        acceptSaveOffer
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "public"
      </code>
      
      , { <code>
        offerId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        Promise
      </code>
      
      <<code>
        null
      </code>
      
      >>; <code>
        getWithdrawal
      </code>
      
      : <code>
        RegisteredQuery
      </code>
      
      <<code>
        "public"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, <code>
        Promise
      </code>
      
      < | { <code>
        period
      </code>
      
      : | <a href="https://nuxt-backend.dev/docs/reference/api/use-billing#withdrawalperiod">
        <code>
          WithdrawalPeriod
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      ; } | <code>
        null
      </code>
      
      >>; <code>
        withdraw
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "public"
      </code>
      
      , { <code>
        subscriptionId?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        Promise
      </code>
      
      <{ <code>
        withdrawnAt
      </code>
      
      : <code>
        number
      </code>
      
      ; }>>; <code>
        uncancelSubscription
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "public"
      </code>
      
      >; <code>
        cancelPendingChange
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "public"
      </code>
      
      >; <code>
        pauseSubscription
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "public"
      </code>
      
      >; <code>
        resumeSubscription
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "public"
      </code>
      
      >; <code>
        getOrders
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "public"
      </code>
      
      >; <code>
        getInvoiceUrl
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "public"
      </code>
      
      >; <code>
        getUsageHistory
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "public"
      </code>
      
      >; <code>
        refundOrder
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "public"
      </code>
      
      >; <code>
        getRevenue
      </code>
      
      : <code>
        RegisteredAction
      </code>
      
      <<code>
        "public"
      </code>
      
      , { <code>
        since
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        until?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        interval?
      </code>
      
      : <a href="#revenueinterval">
        <code>
          RevenueInterval
        </code>
      </a>
      
      ; }, <code>
        Promise
      </code>
      
      <<a href="#revenuereport">
        <code>
          RevenueReport
        </code>
      </a>
      
      >>; }
    </td>
    
    <td>
      Every client-callable function billing gives your app, the one bag to re-export from <code>
        backend/billing.ts
      </code>
      
      : the composables call each by name. The checkout, portal, price-list and gift functions first. Of the provider's own <code>
        api()
      </code>
      
       only <code>
        getConfiguredProducts
      </code>
      
       (the product of each catalog key) is kept; the rest are this package's, and refuse with catalog codes (see <code>
        backendError
      </code>
      
      ): - <code>
        getPricing
      </code>
      
       is the catalog as a pricing page shows it — plans with their monthly and yearly prices, packs with their price per credit, and a public promotion when asked for one (<code>
        discount
      </code>
      
      , its key or code) — public, so <code>
        /pricing
      </code>
      
       renders on the server for any visitor. - <code>
        generateCheckoutLink
      </code>
      
       sells only the app's catalog, returns only to the site (<code>
        SITE_URL
      </code>
      
       or <code>
        trustedOrigins
      </code>
      
      ), refuses the metadata keys the package reads back, and takes a discount code, a public promotion by key and campaign attribution; the trial, a promotion without a code and a discount by id are <a href="#checkout">
        Billing.checkout
      </a>
      
      's. - <code>
        generateCustomerPortalUrl
      </code>
      
       returns only to the site. - <code>
        giftCheckout
      </code>
      
       gifts a catalog credit pack by its key, or a plan as a pass by its key and a length in months; <code>
        deliverAt
      </code>
      
       dates it. - <code>
        getSentGifts
      </code>
      
      , <code>
        resendGift
      </code>
      
      , <code>
        changeGiftRecipient
      </code>
      
      , <code>
        rescheduleGift
      </code>
      
       and <code>
        cancelGift
      </code>
      
       are the purchaser's side of a gift until it is claimed (a cancel refunds the purchase, behind a recent sign-in); <code>
        runGiftSweep
      </code>
      
       is internal, woken by the component's cron. - <code>
        listAllSubscriptions
      </code>
      
       resolves the billing entity like the reactive reads do: <code>
        null
      </code>
      
       instead of a throw for claimless callers.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="webhookevents">
        
      </a>
      
       <code>
        webhookEvents
      </code>
    </td>
    
    <td>
      <a href="#billingwebhookeventhandlers">
        <code>
          BillingWebhookEventHandlers
        </code>
      </a>
    </td>
    
    <td>
      Typed billing webhook handlers for <code>
        registerBackendRoutes
      </code>
      
       (mounted at <code>
        /billing/events
      </code>
      
      ) that keep the reactive cache fresh (subscriptions, benefit grants, credit balances) and fulfil paid gifts.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="webhookhandler">
        
      </a>
      
       <code>
        webhookHandler
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        request
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        Response
      </code>
      
      >
    </td>
    
    <td>
      The guarded <code>
        /billing/events
      </code>
      
       endpoint <code>
        registerBackendRoutes
      </code>
      
       mounts: fail-closed (503 while the secret is unset, 413 over the size cap, 403 on bad signatures across the rotation list, 200 on redeliveries of processed ids, 202 for authentic-but-unknown types) with every delivery outcome recorded in the component's delivery log.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="getcustomerstate">
        
      </a>
      
       <code>
        getCustomerState
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        args
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<a href="#customerentitlements">
        <code>
          CustomerEntitlements
        </code>
      </a>
      
      >
    </td>
    
    <td>
      Resolve a user's full billing entitlement state (active plans, benefits, and credit-meter balances) live from the provider. Call from an <strong>
        action
      </strong>
      
      ; the ready-made <code>
        syncEntitlements
      </code>
      
       already caches the result for you.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="checkout">
        
      </a>
      
       <code>
        checkout
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        options
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <{ <code>
        url
      </code>
      
      : <code>
        string
      </code>
      
      ; }>
    </td>
    
    <td>
      A checkout for the caller's billing entity, from server code — the <code>
        generateCheckoutLink
      </code>
      
       checks, plus what only the server chooses: a <code>
        trial
      </code>
      
       of at most 30 days (or <code>
        false
      </code>
      
       to remove the product's own), a <code>
        discount
      </code>
      
       of the catalog by key (one without a code included) and a <code>
        discountId
      </code>
      
      . Call it from your own action, after deciding the caller qualifies. A discount the provider no longer redeems is refused as <code>
        invalid_input
      </code>
      
       (<code>
        discount
      </code>
      
      ): check out again without it to sell at the regular price. <strong>
        Example
      </strong>
      
       <code>
        // A 30-day trial for people who came through a partner. The product is // still checked against the catalog, and the URLs against the site. export const partnerCheckout = action({ args: { productId: v.string(), origin: v.string(), successUrl: v.string() }, handler: async (ctx, { productId, ...urls }) => { if (!(await cameThroughPartner(ctx))) throw backendError('forbidden', { reason: 'permission' }) return billing.checkout(ctx, { productIds: [productId], ...urls, trial: { interval: 'day', count: 30 } }) }, })
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="portal">
        
      </a>
      
       <code>
        portal
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        options?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <{ <code>
        url
      </code>
      
      : <code>
        string
      </code>
      
      ; }>
    </td>
    
    <td>
      A customer-portal session for the caller's billing entity, from server code — what <code>
        generateCustomerPortalUrl
      </code>
      
       returns. With workspaces the session is the caller's own member of the workspace's billing customer, and only its owner or a billing manager gets one: anyone else is <code>
        forbidden
      </code>
      
       (reason <code>
        not_billing_manager
      </code>
      
      ). An entity that never paid is <code>
        not_ready
      </code>
      
       (reason <code>
        no_customer
      </code>
      
      ). <code>
        returnUrl
      </code>
      
       must be on the site's own origin or a <code>
        trustedOrigins
      </code>
      
       entry. <strong>
        Example
      </strong>
      
       <code>
        export const openBilling = action({ args: {}, handler: ctx => billing.portal(ctx, { returnUrl:
      </code>
      
      ${process.env.SITE_URL}/app/billing<code>
        }), })
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="spendcredits">
        
      </a>
      
       <code>
        spendCredits
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        event
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Spend prepaid credits — call from your own <strong>
        server
      </strong>
      
       action when a metered feature is used. The billing entity (workspace or user, per <code>
        billTo
      </code>
      
      ) resolves from the caller's identity; pass <code>
        userId
      </code>
      
       to spend for a specific entity. With a configured <code>
        meter
      </code>
      
       (or raw <code>
        meterId
      </code>
      
      ), the spend reserves against the cached balance atomically (strictly prepaid — two concurrent spends can never both pass), ingests the provider event, then settles; a failed run releases the reservation and consumes nothing.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="refundcredits">
        
      </a>
      
       <code>
        refundCredits
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        event
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Give credits back on a <strong>
        sum
      </strong>
      
       meter (compensating negative-value event + optimistic cache re-credit). Count meters cannot be refunded. The cache holds the credit for five minutes, through any read of the provider that does not count the event yet; a second refund under the same <code>
        externalId
      </code>
      
       is dropped by the provider and credits the cache once.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="reservecredits">
        
      </a>
      
       <code>
        reserveCredits
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        event
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<a href="#spendreservation">
        <code>
          SpendReservation
        </code>
      </a>
      
      >
    </td>
    
    <td>
      The reserve step of a spend, alone — for flows that run work between the guard and the charge (<code>
        setupAi().meteredAction
      </code>
      
       / streaming). Atomically reserves against the cached balance (throws when insufficient) and returns serializable addressing data for <a href="#settlespend">
        Billing.settleSpend
      </a>
      
       / <a href="#releasespend">
        Billing.releaseSpend
      </a>
      
      . <code>
        allowRefresh: false
      </code>
      
       skips the cold-cache self-heal (required from mutation contexts — the refresh fetches). <code>
        hold
      </code>
      
      , in ms, keeps the reservation that long instead of ten minutes (a week at most): a queued job's credits, held until it starts.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="settlespend">
        
      </a>
      
       <code>
        settleSpend
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        reservation
      </code>
      
      , <code>
        options?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Ingest the provider event for a reservation and finalize the spend. A refused event releases the reservation and rethrows; with <code>
        keepReservation
      </code>
      
      , it keeps what the settle would have charged held instead, under the same id, and lets only the rest go, in one transaction, for a caller that tries the settle again under the same key: let it go with <a href="#releasespend">
        Billing.releaseSpend
      </a>
      
       once you stop trying.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="releasespend">
        
      </a>
      
       <code>
        releaseSpend
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        reservation
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Undo a reservation whose work failed — nothing is charged.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="reportcost">
        
      </a>
      
       <code>
        reportCost
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        event
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Send what some work cost you to the billing provider's cost insights: one event for the billing entity, with the cost in US cents (sub-cent precision kept) and the model and tokens it used, as a child of the charge it belongs to (<code>
        parentId
      </code>
      
      , that charge's <code>
        externalId
      </code>
      
      ). It moves no credits. The job queue sends one per finished job.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="resolveentity-1">
        
      </a>
      
       <code>
        resolveEntity
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<a href="#billingentity">
        <code>
          BillingEntity
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      Resolve the caller's billing entity the way every billing function does: <code>
        setupBilling
      </code>
      
      's <code>
        resolveEntity
      </code>
      
       when given, else identity claims — the active workspace (<code>
        billTo: 'workspace'
      </code>
      
      ) or the signed-in user. <code>
        null
      </code>
      
       when signed out. Any query, mutation or action context will do. It checks nobody: to act for the entity, check the caller with <a href="#requireentity">
        Billing.requireEntity
      </a>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="requireentity">
        
      </a>
      
       <code>
        requireEntity
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        rule
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<a href="#billingentity">
        <code>
          BillingEntity
        </code>
      </a>
      
      >
    </td>
    
    <td>
      The caller's billing entity, checked the way the package's own functions check it, for a function of yours: signed in, an account not banned, a member of the workspace that pays, its owner or an admin for <code>
        access: 'manage'
      </code>
      
       — each read fresh, once per call (<code>
        reread: true
      </code>
      
       reads again) — and no impersonated session where the rule refuses one. Throws the refusal: <code>
        unauthenticated
      </code>
      
      , <code>
        no_workspace
      </code>
      
      , or <code>
        forbidden
      </code>
      
       with reason <code>
        banned
      </code>
      
      , <code>
        not_member
      </code>
      
      , <code>
        not_billing_manager
      </code>
      
       or <code>
        impersonating
      </code>
      
      . <strong>
        Example
      </strong>
      
       <code>
        // Only the billing managers of the workspace that pays set its invoice // address, and only in person. export const setInvoiceAddress = mutation({ args: { address: v.string() }, handler: async (ctx, { address }) => { const { userId: workspaceId } = await billing.requireEntity(ctx, { access: 'manage', impersonation: 'refused' }) await ctx.db.insert('invoiceAddresses', { workspaceId, address }) }, })
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="launch">
        
      </a>
      
       <code>
        launch
      </code>
    </td>
    
    <td>
      <a href="#billinglaunch">
        <code>
          BillingLaunch
        </code>
      </a>
    </td>
    
    <td>
      Whether billing sells on this deployment yet, read once as the backend loads: <code>
        { launched: false, reason }
      </code>
      
       on a production deployment with no <code>
        BILLING_ACCESS_TOKEN
      </code>
      
       (<code>
        no_access_token
      </code>
      
      ) or no production catalog (<code>
        no_catalog
      </code>
      
      ), <code>
        { launched: true }
      </code>
      
       everywhere else. While it is not, <code>
        getPricing
      </code>
      
       answers <code>
        launched: false
      </code>
      
       and every checkout is refused as <code>
        unavailable
      </code>
      
      , reason <code>
        not_launched
      </code>
      
      . For server code that hides a page or a link of its own. <strong>
        Example
      </strong>
      
       <code>
        export const salesOpen = query({ args: {}, handler: () => billing.launch.launched })
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="startfreeplan">
        
      </a>
      
       <code>
        startFreePlan
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        entityId
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Queue the catalog's free plan for one billing entity: a real subscription at the provider, started through the scaffold's workpool (else the scheduler) by <code>
        billing:startFreePlan
      </code>
      
      . Nothing happens for an entity that holds a plan already, or when the catalog has no free plan. Every workspace (or user, with <code>
        billTo: 'user'
      </code>
      
      ) the auth layer makes is queued — through <code>
        registerBackendRoutes
      </code>
      
       where the auth routes are mounted, by the function's name anywhere else — and a subscription that ends queues it again; call it yourself for a billing entity the auth layer did not make (one your own code writes, or a migration's), or run the backfill, <code>
        npx convex run billing:startFreePlan '{}'
      </code>
      
      . <strong>
        Guarantee
      </strong>
      
       - Runs: in the mutation or action that calls it; the start runs later, as an internal action - Delivery: through the scaffold's workpool, retried up to five attempts until the provider takes it; without one, once through the scheduler (re-run the backfill for any it missed) - Order: after the entity exists; whether it holds a plan is read from the provider, never from the synced table a late webhook leaves behind - When it throws: only when the queue can't be written to; the caller's work is not undone by a failed start - Idempotency: safe to repeat; an entity on a plan, free or paid, is left as it is
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="hasfeature">
        
      </a>
      
       <code>
        hasFeature
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        feature
      </code>
      
      , <code>
        options?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      Whether the billing entity's plan grants <code>
        feature
      </code>
      
      : its catalog key (the <code>
        key
      </code>
      
       in a benefit's metadata), or the benefit id of a benefit that has no key — the one match <code>
        useFeatures().has()
      </code>
      
       makes, read from the same entitlement cache. In any query, mutation or action. Without <code>
        userId
      </code>
      
       it checks the caller's entity, and answers <code>
        false
      </code>
      
       for a caller with none (signed out, no workspace, no member of it) instead of refusing: for a function that shows more to a plan that has more. An empty <code>
        feature
      </code>
      
       is none: <code>
        false
      </code>
      
      . <strong>
        Example
      </strong>
      
       <code>
        export const report = workspace.query({ args: {}, handler: async ctx => ({ totals: await totalsOf(ctx), breakdown: await billing.hasFeature(ctx, 'reports') ? await breakdownOf(ctx) : null, }), })
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="requirefeature">
        
      </a>
      
       <code>
        requireFeature
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        feature
      </code>
      
      , <code>
        options?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Refuse the call unless the billing entity's plan grants <code>
        feature
      </code>
      
       (matched as <a href="#hasfeature">
        Billing.hasFeature
      </a>
      
       matches it): <code>
        feature_required
      </code>
      
      , whose <code>
        plans
      </code>
      
       names the catalog plans on sale that include it, in pricing order, for <code>
        <UpgradePrompt :plans>
      </code>
      
       to offer. Without <code>
        userId
      </code>
      
       the caller is checked first, as <code>
        requireEntity
      </code>
      
       checks a member, and refused as it refuses. An empty <code>
        feature
      </code>
      
       is refused as <code>
        invalid_input
      </code>
      
       (field <code>
        feature
      </code>
      
      ). The <code>
        withFeature(key)
      </code>
      
       tier of <code>
        createFunctions
      </code>
      
       runs it for a whole function. <strong>
        Guarantee
      </strong>
      
       Reads the entitlement cache and the products table only: no provider call, on any path. <strong>
        Guarantee
      </strong>
      
       A caller who may not read the entity's billing is refused for that, never as <code>
        feature_required
      </code>
      
      . <strong>
        Example
      </strong>
      
       <code>
        export const exportReport = action({ args: {}, handler: async (ctx) => { await billing.requireFeature(ctx, 'reports') return await buildExport(ctx) }, })
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="activeplans">
        
      </a>
      
       <code>
        activePlans
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        options?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        string
      </code>
      
      <span>
        
      </span>
      
      >
    </td>
    
    <td>
      The catalog plan keys the billing entity is subscribed to now (<code>
        pro
      </code>
      
      , never <code>
        pro:year
      </code>
      
      ), read from the entitlement cache: retired plans included, products outside the catalog left out. In any query, mutation or action. Without <code>
        userId
      </code>
      
       it reads the caller's entity, checked as <code>
        hasFeature
      </code>
      
       checks it, and answers <code>
        []
      </code>
      
       for a caller with none instead of refusing. What a feature flag's plan targets match (<code>
        setupFlags({ billing })
      </code>
      
      ). <strong>
        Guarantee
      </strong>
      
       Reads the entitlement cache only: no provider call.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="getquota">
        
      </a>
      
       <code>
        getQuota
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        quota
      </code>
      
      , <code>
        options?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<a href="https://nuxt-backend.dev/docs/reference/api/use-features#quotausage">
        <code>
          QuotaUsage
        </code>
      </a>
      
      >
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       How many of <code>
        quota
      </code>
      
       the billing entity's plan allows, and how many it holds: the most any of its grants allows (<code>
        0
      </code>
      
       when none names it, <code>
        'unlimited'
      </code>
      
       when one says so), and the count <code>
        requireQuota
      </code>
      
       and <code>
        releaseQuota
      </code>
      
       keep. In any query, mutation or action. Without <code>
        userId
      </code>
      
       it reads the caller's entity, and answers <code>
        { limit: 0, used: 0 }
      </code>
      
       for a caller with none instead of refusing, as <code>
        hasFeature
      </code>
      
       answers <code>
        false
      </code>
      
      . A quota that counts people (members, seats, users, …) is a <code>
        TypeError
      </code>
      
      : no plan here is priced per seat. <strong>
        Guarantee
      </strong>
      
       Reads the entitlement cache and the counter only: no provider call.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="requirequota">
        
      </a>
      
       <code>
        requireQuota
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        quota
      </code>
      
      , <code>
        amount?
      </code>
      
      , <code>
        options?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<a href="https://nuxt-backend.dev/docs/reference/api/use-features#quotausage">
        <code>
          QuotaUsage
        </code>
      </a>
      
      >
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       Count <code>
        amount
      </code>
      
       (default 1) against the billing entity's <code>
        quota
      </code>
      
      , or refuse the call when it does not fit what the plan allows: <code>
        quota_exceeded
      </code>
      
      , with the <code>
        limit
      </code>
      
      , how many are <code>
        used
      </code>
      
      , the <code>
        amount
      </code>
      
       asked for, and the catalog plans on sale that allow enough (<code>
        plans
      </code>
      
      , in pricing order, for <code>
        <UpgradePrompt :plans>
      </code>
      
       to offer). Call it in the mutation that makes the thing, before writing it: the check, the count and the write are one transaction, so a refused call, or one that fails after it, counts nothing, and two calls at once never overshoot the limit. A quota no grant names allows none. Without <code>
        userId
      </code>
      
       the caller is checked first, as <code>
        requireEntity
      </code>
      
       checks a member. Resolves with the quota as it now stands. Refuses any context but a mutation's with a <code>
        TypeError
      </code>
      
       (an action's read and write could not be one transaction, and a query writes nothing); an empty <code>
        quota
      </code>
      
       or an <code>
        amount
      </code>
      
       that is not a whole number above zero is <code>
        invalid_input
      </code>
      
      . <strong>
        Guarantee
      </strong>
      
       Reads the entitlement cache, the products table and the counter only: no provider call. <strong>
        Guarantee
      </strong>
      
       Counts nothing on a refusal, and a limit is never overshot by calls at once. <strong>
        Example
      </strong>
      
       <code>
        export const createProject = workspace.mutation({ args: { name: v.string() }, handler: async (ctx, { name }) => { await billing.requireQuota(ctx, 'projects') return ctx.db.insert('projects', { name, workspaceId: ctx.workspace.id }) }, })
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="releasequota">
        
      </a>
      
       <code>
        releaseQuota
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        quota
      </code>
      
      , <code>
        amount?
      </code>
      
      , <code>
        options?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<a href="https://nuxt-backend.dev/docs/reference/api/use-features#quotausage">
        <code>
          QuotaUsage
        </code>
      </a>
      
      >
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       Give back <code>
        amount
      </code>
      
       (default 1) of the billing entity's <code>
        quota
      </code>
      
      , in the mutation that removes the thing: the count never goes below zero. Checked like <a href="#requirequota">
        Billing.requireQuota
      </a>
      
      ; resolves with the quota as it now stands. <strong>
        Example
      </strong>
      
       <code>
        export const deleteProject = workspace.mutation({ args: { projectId: v.id('projects') }, handler: async (ctx, { projectId }) => { await ctx.db.delete(projectId) await billing.releaseQuota(ctx, 'projects') }, })
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="forgetentity">
        
      </a>
      
       <code>
        forgetEntity
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        userId
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Forget a billing entity: drop its cached entitlements (plans, benefits, credit balances, in-flight reservations) and its quota counts. The provider's customer record is untouched — this is the app-side erasure step, e.g. from the <code>
        onUserDeleted
      </code>
      
       auth hook with the deleted user's id (<code>
        billTo: 'user'
      </code>
      
      ) or a dissolved workspace's id. A no-op for an unknown entity.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="forgetaccount">
        
      </a>
      
       <code>
        forgetAccount
      </code>
    </td>
    
    <td>
      <a href="#accountbillingerasure">
        <code>
          AccountBillingErasure
        </code>
      </a>
    </td>
    
    <td>
      Billing's part of an account's erasure, which <code>
        setupAccount
      </code>
      
       runs in the app: the provider customer of every billing entity that goes with the account (its personal workspace and any it was the only member of, or the account itself with <code>
        billTo: 'user'
      </code>
      
      ) is deleted and anonymized at the provider, which keeps its orders for its books, and its quota counts and cache are forgotten; in a workspace the account leaves, only its member of the team customer is removed. Safe to run again: a customer or a member already gone is fine.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="exportaccount">
        
      </a>
      
       <code>
        exportAccount
      </code>
    </td>
    
    <td>
      <a href="#accountbillingexport">
        <code>
          AccountBillingExport
        </code>
      </a>
    </td>
    
    <td>
      Billing's part of an account's export, which <code>
        setupAccount
      </code>
      
       runs: the subscriptions and the newest orders of every billing entity the account owns alone. <code>
        orders
      </code>
      
       is <code>
        null
      </code>
      
       when the provider could not be read.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="discounts-2">
        
      </a>
      
       <code>
        discounts
      </code>
    </td>
    
    <td>
      <a href="#billingdiscounts">
        <code>
          BillingDiscounts
        </code>
      </a>
    </td>
    
    <td>
      Discount (coupon) management: <code>
        create
      </code>
      
      , <code>
        list
      </code>
      
      , <code>
        remove
      </code>
      
      . Server-side by design — minting discounts is privileged, so wire it through an <code>
        internalAction
      </code>
      
       or your own admin-tier action.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="applydiscount">
        
      </a>
      
       <code>
        applyDiscount
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        options
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        Subscription
      </code>
      
      >
    </td>
    
    <td>
      Put a catalog discount on a billing entity's subscription, by key, from server code that decided the entity qualifies: a win-back offer, a referral reward, a code a subscriber redeems in your own UI. The provider takes it off from the next payment, replacing any discount the subscription had (one at a time; <code>
        null
      </code>
      
       removes it). It checks the dates, the total cap and the plan, never the per-customer limit: keep your own record of who got it. A <code>
        once
      </code>
      
       discount, or one of 12 months or less, covers a whole yearly payment, and a discount follows the subscription across plan changes. Refused as <code>
        invalid_input
      </code>
      
      : a key the catalog does not have or one that does not apply to the plan (<code>
        discount
      </code>
      
      ), and the free plan (<code>
        subscriptionId
      </code>
      
      , reason <code>
        free_plan
      </code>
      
      ). Call from an action; no client can reach it. <strong>
        Example
      </strong>
      
       <code>
        export const winBack = internalAction({ args: { workspaceId: v.string() }, handler: (ctx, { workspaceId }) => billing.applyDiscount(ctx, { entityId: workspaceId, discount: 'winback' }), })
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="updatesubscription">
        
      </a>
      
       <code>
        updateSubscription
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        options?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        Subscription
      </code>
      
      >
    </td>
    
    <td>
      Switch a subscription to another product (upgrade / downgrade), optionally choosing how the mid-period difference is settled. A switch from a yearly price to a monthly one is scheduled for the paid year's end (<code>
        next_period
      </code>
      
      ) whatever <code>
        proration
      </code>
      
       says: the yearly price granted the year's credits up front, so an immediate switch would refund most of the year while those credits stay spent. Call from an <strong>
        action
      </strong>
      
      ; the ready-made <code>
        updateSubscription
      </code>
      
       function does it for the caller.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="cancelsubscription-1">
        
      </a>
      
       <code>
        cancelSubscription
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        options?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        Subscription
      </code>
      
      >
    </td>
    
    <td>
      Cancel a subscription — at period end by default, immediately with <code>
        atPeriodEnd: false
      </code>
      
      . The reason and comment are the customer's own words and are visible to them; the comment is trimmed and refused as <code>
        invalid_input
      </code>
      
       (<code>
        comment
      </code>
      
      ) over 500 characters. A period-end cancel of a subscription already set to cancel is refused as <code>
        invalid_input
      </code>
      
       (<code>
        subscriptionId
      </code>
      
      , reason <code>
        cancel_scheduled
      </code>
      
      ) before the provider, which takes one cancellation per period, is asked.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="uncancelsubscription-1">
        
      </a>
      
       <code>
        uncancelSubscription
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        options?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        Subscription
      </code>
      
      >
    </td>
    
    <td>
      Undo a scheduled cancellation, putting the subscription back on renewal. Refused as <code>
        invalid_input
      </code>
      
       (<code>
        subscriptionId
      </code>
      
      , reason <code>
        no_cancel_scheduled
      </code>
      
      ) when none is scheduled.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="cancelpendingchange">
        
      </a>
      
       <code>
        cancelPendingChange
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        options?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        Subscription
      </code>
      
      >
    </td>
    
    <td>
      Undo a plan change scheduled for the start of the next period, so the subscription renews on the plan it has. Refused as <code>
        invalid_input
      </code>
      
       (<code>
        subscriptionId
      </code>
      
      , reason <code>
        no_change_scheduled
      </code>
      
      ) when none is scheduled.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="pausesubscription-1">
        
      </a>
      
       <code>
        pauseSubscription
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        options?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        Subscription
      </code>
      
      >
    </td>
    
    <td>
      Pause a subscription at the end of the current period, optionally with an automatic resume date. Pause/resume are newer than the rest of the lifecycle: the provider's <code>
        subscription.paused
      </code>
      
       / <code>
        subscription.resumed
      </code>
      
       webhooks are known to the installed SDK but not confirmed live here, so entitlement reads treat a paused subscription as still live rather than assuming an event will arrive to say so.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="resumesubscription-1">
        
      </a>
      
       <code>
        resumeSubscription
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        options?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        Subscription
      </code>
      
      >
    </td>
    
    <td>
      Resume a paused subscription immediately, starting a new billing period.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="getorders">
        
      </a>
      
       <code>
        getOrders
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        options?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<a href="#billingpage">
        <code>
          BillingPage
        </code>
      </a>
      
      <<a href="#billingorder">
        <code>
          BillingOrder
        </code>
      </a>
      
      > | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      The billing entity's order history, read <strong>
        live
      </strong>
      
       from the provider — this package keeps no local order table (that would be a ledger, and the provider already is one). <code>
        null
      </code>
      
       when no access token is configured. The history lists charges: a subscription's order that charged nothing (a free plan's cycle, a trial's start, a cycle a full discount brought to nothing) is left out, while the provider's pages and <code>
        pagination
      </code>
      
       still count it, so a page may list fewer than <code>
        limit
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="getinvoiceurl">
        
      </a>
      
       <code>
        getInvoiceUrl
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        orderId
      </code>
      
      ) => <code>
        Promise
      </code>
      
      < | { <code>
        url
      </code>
      
      : <code>
        string
      </code>
      
      ; } | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      A URL to one of the entity's own invoices. <code>
        null
      </code>
      
       when no access token is configured, and <code>
        null
      </code>
      
       while the provider is still generating the PDF (the call asks for generation, then the next call returns the URL). Throws if the order belongs to a different billing account.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="getusagehistory">
        
      </a>
      
       <code>
        getUsageHistory
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        options?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<a href="#billingpage">
        <code>
          BillingPage
        </code>
      </a>
      
      <<a href="#usageevent">
        <code>
          UsageEvent
        </code>
      </a>
      
      > | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      The billing entity's metered consumption history, read <strong>
        live
      </strong>
      
       from the provider's events API. There is no local usage ledger by design: the events this package ingests when it spends credits <em>
        are
      </em>
      
       the record, and the provider bills from them. <code>
        null
      </code>
      
       when no access token is configured.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="refundorder-1">
        
      </a>
      
       <code>
        refundOrder
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        options
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<a href="#refundrecord">
        <code>
          RefundRecord
        </code>
      </a>
      
      >
    </td>
    
    <td>
      Refund an order — admin-tier, gated by <code>
        requireAdmin
      </code>
      
       (<a href="#setupbillingconfig">
        SetupBillingConfig
      </a>
      
      ). Omit <code>
        amount
      </code>
      
       to refund whatever is still refundable. Credits are <strong>
        not
      </strong>
      
       reversed here: meter credits come from the provider's own benefit grants, so the refund's <code>
        order.refunded
      </code>
      
       webhook is what reverses them. This package only drops the entity's in-flight spend reservations and re-reads the provider's balance.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts" rel="nofollow">
        src/convex/integrations/billing/types/surface.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### ReferralRefs

Defined in: [src/convex/integrations/referrals.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts)

The component functions the program calls (structural: the generated references satisfy it).

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="codefor">
        
      </a>
      
       <code>
        codeFor
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, { <code>
        code
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        sharePages
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="peekcode">
        
      </a>
      
       <code>
        peekCode
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        code
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        sharePages
      </code>
      
      : <code>
        boolean
      </code>
      
      ; } | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="setsharing">
        
      </a>
      
       <code>
        setSharing
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        share
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }, <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="preview">
        
      </a>
      
       <code>
        preview
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        code
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | { <code>
        inviter
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; } | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="claim">
        
      </a>
      
       <code>
        claim
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        code
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        terms
      </code>
      
      : <a href="#storedterms">
        <code>
          StoredTerms
        </code>
      </a>
      
      ; }, | { <code>
        claimed
      </code>
      
      : <code>
        true
      </code>
      
      ; <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        referrerId
      </code>
      
      : <code>
        string
      </code>
      
      ; } | { <code>
        claimed
      </code>
      
      : <code>
        false
      </code>
      
      ; <code>
        reason
      </code>
      
      : <a href="#claimrefusal">
        <code>
          ClaimRefusal
        </code>
      </a>
      
      ; }>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="mine">
        
      </a>
      
       <code>
        mine
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, { <code>
        claimed
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        held
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        rewarded
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        referrals
      </code>
      
      : <a href="#referralentry">
        <code>
          ReferralEntry
        </code>
      </a>
      
      <span>
        
      </span>
      
      ; }>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="consolerows">
        
      </a>
      
       <code>
        consoleRows
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        referrerId?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <a href="#referralconsolerows">
        <code>
          ReferralConsoleRows
        </code>
      </a>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="resolveflag">
        
      </a>
      
       <code>
        resolveFlag
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        resolution
      </code>
      
      : <code>
        "release"
      </code>
      
       | <code>
        "void"
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="registersweep">
        
      </a>
      
       <code>
        registerSweep
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        wake
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="due">
        
      </a>
      
       <code>
        due
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        now
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        limit?
      </code>
      
      : <code>
        number
      </code>
      
      ; }, { <code>
        ids
      </code>
      
      : <code>
        string
      </code>
      
      <span>
        
      </span>
      
      ; <code>
        more
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="get">
        
      </a>
      
       <code>
        get
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <a href="#duereferral">
        <code>
          DueReferral
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="beginreward">
        
      </a>
      
       <code>
        beginReward
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        now
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        "skip"
      </code>
      
       | <code>
        "capped"
      </code>
      
       | <code>
        "grant"
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="notegrant">
        
      </a>
      
       <code>
        noteGrant
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        grant
      </code>
      
      : { <code>
        discountId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        endsAt?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        done?
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }; }, <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="finishreward">
        
      </a>
      
       <code>
        finishReward
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="deferreward">
        
      </a>
      
       <code>
        deferReward
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        until
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="closeunrewarded">
        
      </a>
      
       <code>
        closeUnrewarded
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        now
      </code>
      
      : <code>
        number
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="voidreferral">
        
      </a>
      
       <code>
        voidReferral
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        "internal"
      </code>
      
      , { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        reason
      </code>
      
      : <code>
        "refunded"
      </code>
      
       | <code>
        "administrator"
      </code>
      
       | <code>
        "account_erased"
      </code>
      
      ; }, <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### ReferralComponents

Defined in: [src/convex/integrations/referrals.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts)

The components `setupReferrals` is given: the app's generated `components`.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="backend-1">
        
      </a>
      
       <code>
        backend
      </code>
    </td>
    
    <td>
      { <code>
        referrals
      </code>
      
      : <a href="#referralrefs">
        <code>
          ReferralRefs
        </code>
      </a>
      
      ; }
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        backend.referrals
      </code>
    </td>
    
    <td>
      <a href="#referralrefs">
        <code>
          ReferralRefs
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### StoredTerms

Defined in: [src/convex/integrations/referrals.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts)

The terms a referral keeps from its claim.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="referred">
        
      </a>
      
       <code>
        referred?
      </code>
    </td>
    
    <td>
      | { <code>
        discount
      </code>
      
      : <code>
        string
      </code>
      
      ; } | { <code>
        trialDays
      </code>
      
      : <code>
        number
      </code>
      
      ; }
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="referrer">
        
      </a>
      
       <code>
        referrer?
      </code>
    </td>
    
    <td>
      | { <code>
        pack
      </code>
      
      : <code>
        string
      </code>
      
      ; } | { <code>
        months
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        plan?
      </code>
      
      : <code>
        string
      </code>
      
      ; }
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="holdms">
        
      </a>
      
       <code>
        holdMs
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="caps">
        
      </a>
      
       <code>
        caps
      </code>
    </td>
    
    <td>
      { <code>
        perReferrer
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        perMonth
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; }
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        caps.perReferrer
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        caps.perMonth
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### ReferralEntry

Defined in: [src/convex/integrations/referrals.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts)

One referral as its referrer reads it: a state and a time, never who the other person is.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="id-9">
        
      </a>
      
       <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="state">
        
      </a>
      
       <code>
        state
      </code>
    </td>
    
    <td>
      <a href="#referralstate">
        <code>
          ReferralState
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="claimedat-1">
        
      </a>
      
       <code>
        claimedAt
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="rewardedat">
        
      </a>
      
       <code>
        rewardedAt
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### DueReferral

Defined in: [src/convex/integrations/referrals.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts)

A referral as the sweep grants it.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="id-10">
        
      </a>
      
       <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="state-1">
        
      </a>
      
       <code>
        state
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="referrerid">
        
      </a>
      
       <code>
        referrerId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="referredid">
        
      </a>
      
       <code>
        referredId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="orderid-4">
        
      </a>
      
       <code>
        orderId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="entityid-6">
        
      </a>
      
       <code>
        entityId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="terms">
        
      </a>
      
       <code>
        terms
      </code>
    </td>
    
    <td>
      <a href="#storedterms">
        <code>
          StoredTerms
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="grant">
        
      </a>
      
       <code>
        grant?
      </code>
    </td>
    
    <td>
      { <code>
        discountId?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        endsAt?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        done?
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        grant.discountId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        grant.endsAt?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        grant.done?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### ReferralConsoleRow

Defined in: [src/convex/integrations/referrals.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts)

One referral row of the admin console.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="id-11">
        
      </a>
      
       <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="referrerid-1">
        
      </a>
      
       <code>
        referrerId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="state-2">
        
      </a>
      
       <code>
        state
      </code>
    </td>
    
    <td>
      <a href="#referralstate">
        <code>
          ReferralState
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="claimedat-2">
        
      </a>
      
       <code>
        claimedAt
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="paidat-1">
        
      </a>
      
       <code>
        paidAt
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="holduntil">
        
      </a>
      
       <code>
        holdUntil
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="rewardedat-1">
        
      </a>
      
       <code>
        rewardedAt
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="flags">
        
      </a>
      
       <code>
        flags
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="released">
        
      </a>
      
       <code>
        released
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="capped">
        
      </a>
      
       <code>
        capped
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="voidedfor">
        
      </a>
      
       <code>
        voidedFor
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### ReferralConsoleRows

Defined in: [src/convex/integrations/referrals.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts)

What the component answers the console.

#### Extended by

- [`ReferralConsole`](#referralconsole)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="totals-1">
        
      </a>
      
       <code>
        totals
      </code>
    </td>
    
    <td>
      { <code>
        claimed
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        held
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        rewarded
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        voided
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        capped
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        flagged
      </code>
      
      : <code>
        number
      </code>
      
      ; }
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        totals.claimed
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        totals.held
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        totals.rewarded
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        totals.voided
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        totals.capped
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        totals.flagged
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="top">
        
      </a>
      
       <code>
        top
      </code>
    </td>
    
    <td>
      { <code>
        referrerId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        name
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        referrals
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        rewarded
      </code>
      
      : <code>
        number
      </code>
      
      ; }<span>
        
      </span>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="flagged">
        
      </a>
      
       <code>
        flagged
      </code>
    </td>
    
    <td>
      <a href="#referralconsolerow">
        <code>
          ReferralConsoleRow
        </code>
      </a>
      
      <span>
        
      </span>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="history">
        
      </a>
      
       <code>
        history
      </code>
    </td>
    
    <td>
      <a href="#referralconsolerow">
        <code>
          ReferralConsoleRow
        </code>
      </a>
      
      <span>
        
      </span>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### ReferralConsole

Defined in: [src/convex/integrations/referrals.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts)

The referrals view of the admin console.

#### Extends

- [`ReferralConsoleRows`](#referralconsolerows)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Inherited from
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="totals-2">
        
      </a>
      
       <code>
        totals
      </code>
    </td>
    
    <td>
      { <code>
        claimed
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        held
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        rewarded
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        voided
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        capped
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        flagged
      </code>
      
      : <code>
        number
      </code>
      
      ; }
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="#referralconsolerows">
        <code>
          ReferralConsoleRows
        </code>
      </a>
      
      .<a href="#totals-1">
        <code>
          totals
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        totals.claimed
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        totals.held
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        totals.rewarded
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        totals.voided
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        totals.capped
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        totals.flagged
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="top-1">
        
      </a>
      
       <code>
        top
      </code>
    </td>
    
    <td>
      { <code>
        referrerId
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        name
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        referrals
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        rewarded
      </code>
      
      : <code>
        number
      </code>
      
      ; }<span>
        
      </span>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="#referralconsolerows">
        <code>
          ReferralConsoleRows
        </code>
      </a>
      
      .<a href="#top">
        <code>
          top
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="flagged-1">
        
      </a>
      
       <code>
        flagged
      </code>
    </td>
    
    <td>
      <a href="#referralconsolerow">
        <code>
          ReferralConsoleRow
        </code>
      </a>
      
      <span>
        
      </span>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="#referralconsolerows">
        <code>
          ReferralConsoleRows
        </code>
      </a>
      
      .<a href="#flagged">
        <code>
          flagged
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="history-1">
        
      </a>
      
       <code>
        history
      </code>
    </td>
    
    <td>
      <a href="#referralconsolerow">
        <code>
          ReferralConsoleRow
        </code>
      </a>
      
      <span>
        
      </span>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="#referralconsolerows">
        <code>
          ReferralConsoleRows
        </code>
      </a>
      
      .<a href="#history">
        <code>
          history
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="program">
        
      </a>
      
       <code>
        program
      </code>
    </td>
    
    <td>
      <a href="#referralprogram">
        <code>
          ReferralProgram
        </code>
      </a>
    </td>
    
    <td>
      The program's terms, as <code>
        setupReferrals
      </code>
      
       was given them.
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### ReferralProgram

Defined in: [src/convex/integrations/referrals.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts)

The program a page describes: what each side gets. `null` for a side with no reward.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="referred-1">
        
      </a>
      
       <code>
        referred
      </code>
    </td>
    
    <td>
      <a href="#referredoffer">
        <code>
          ReferredOffer
        </code>
      </a>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="referrer-1">
        
      </a>
      
       <code>
        referrer
      </code>
    </td>
    
    <td>
      <a href="#referreroffer">
        <code>
          ReferrerOffer
        </code>
      </a>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="holddays">
        
      </a>
      
       <code>
        holdDays
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      The hold, in days.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="caps-1">
        
      </a>
      
       <code>
        caps
      </code>
    </td>
    
    <td>
      { <code>
        perReferrer
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        perMonth
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; }
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        caps.perReferrer
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        caps.perMonth
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### ReferralCodeView

Defined in: [src/convex/integrations/referrals.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts)

A person's own code and the program it belongs to.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="code-3">
        
      </a>
      
       <code>
        code
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The code, <code>
        /r/<code>
      </code>
      
       or <code>
        ?ref=<code>
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="sharepages">
        
      </a>
      
       <code>
        sharePages
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Whether the share pages the person's rows have carry the code.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="program-1">
        
      </a>
      
       <code>
        program
      </code>
    </td>
    
    <td>
      <a href="#referralprogram">
        <code>
          ReferralProgram
        </code>
      </a>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### ReferralsView

Defined in: [src/convex/integrations/referrals.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts)

A person's referrals.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="claimed">
        
      </a>
      
       <code>
        claimed
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="held">
        
      </a>
      
       <code>
        held
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="rewarded">
        
      </a>
      
       <code>
        rewarded
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="referrals">
        
      </a>
      
       <code>
        referrals
      </code>
    </td>
    
    <td>
      <a href="#referralentry">
        <code>
          ReferralEntry
        </code>
      </a>
      
      <span>
        
      </span>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### ReferralPreview

Defined in: [src/convex/integrations/referrals.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts)

What a visitor reads on the page a referral link opens.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="inviter">
        
      </a>
      
       <code>
        inviter
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      The first name of the person who invited them, when they have one.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="program-2">
        
      </a>
      
       <code>
        program
      </code>
    </td>
    
    <td>
      <a href="#referralprogram">
        <code>
          ReferralProgram
        </code>
      </a>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### ReferralsApi

Defined in: [src/convex/integrations/referrals.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts)

The public functions `backend/referrals.ts` re-exports.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="getreferralcode">
        
      </a>
      
       <code>
        getReferralCode
      </code>
    </td>
    
    <td>
      <code>
        RegisteredMutation
      </code>
      
      <<code>
        "public"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, <code>
        Promise
      </code>
      
      <<a href="#referralcodeview">
        <code>
          ReferralCodeView
        </code>
      </a>
      
      >>
    </td>
    
    <td>
      The signed-in person's code, made on the first call, and the program it belongs to.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="getreferrals">
        
      </a>
      
       <code>
        getReferrals
      </code>
    </td>
    
    <td>
      <code>
        RegisteredQuery
      </code>
      
      <<code>
        "public"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, <code>
        Promise
      </code>
      
      <<a href="#referralsview">
        <code>
          ReferralsView
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >>
    </td>
    
    <td>
      The signed-in person's referrals: counts, and each one's state. <code>
        null
      </code>
      
       when signed out.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="claimreferral">
        
      </a>
      
       <code>
        claimReferral
      </code>
    </td>
    
    <td>
      <code>
        RegisteredMutation
      </code>
      
      <<code>
        "public"
      </code>
      
      , { <code>
        code
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        fromSignIn?
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }, <code>
        Promise
      </code>
      
      < | { <code>
        claimed
      </code>
      
      : <code>
        true
      </code>
      
      ; } | { <code>
        claimed
      </code>
      
      : <code>
        false
      </code>
      
      ; <code>
        reason
      </code>
      
      : <a href="#claimrefusal">
        <code>
          ClaimRefusal
        </code>
      </a>
      
      ; }>>
    </td>
    
    <td>
      Claim a code for the signed-in account, the explicit step of a referral. A code that cannot be used is ignored, never an error: <code>
        claimed
      </code>
      
       is <code>
        false
      </code>
      
       and <code>
        reason
      </code>
      
       says why, and the sign-up goes on. <code>
        fromSignIn
      </code>
      
       is the claim a link's page runs on its own after the sign-in it sent the visitor to: it needs a sign-in from the last ten minutes (<code>
        reauthentication_required
      </code>
      
       else), so a crafted link opened by someone signed in earlier claims nothing by itself.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="previewreferral">
        
      </a>
      
       <code>
        previewReferral
      </code>
    </td>
    
    <td>
      <code>
        RegisteredQuery
      </code>
      
      <<code>
        "public"
      </code>
      
      , { <code>
        code
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        Promise
      </code>
      
      <<a href="#referralpreview">
        <code>
          ReferralPreview
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >>
    </td>
    
    <td>
      What a link's code offers, for the page it opens. Anyone may read it. <code>
        null
      </code>
      
       for a code that is none, or of someone who cannot invite.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="setreferralsharing">
        
      </a>
      
       <code>
        setReferralSharing
      </code>
    </td>
    
    <td>
      <code>
        RegisteredMutation
      </code>
      
      <<code>
        "public"
      </code>
      
      , { <code>
        share
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }, <code>
        Promise
      </code>
      
      <<code>
        null
      </code>
      
      >>
    </td>
    
    <td>
      Choose whether share pages carry the signed-in person's code.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="getreferralconsole">
        
      </a>
      
       <code>
        getReferralConsole
      </code>
    </td>
    
    <td>
      <code>
        RegisteredQuery
      </code>
      
      <<code>
        "public"
      </code>
      
      , { <code>
        referrerId?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        Promise
      </code>
      
      <<a href="#referralconsole">
        <code>
          ReferralConsole
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >>
    </td>
    
    <td>
      The admin console's referrals view. <code>
        null
      </code>
      
       for anyone who is not an administrator now.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="resolvereferral">
        
      </a>
      
       <code>
        resolveReferral
      </code>
    </td>
    
    <td>
      <code>
        RegisteredMutation
      </code>
      
      <<code>
        "public"
      </code>
      
      , { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        resolution
      </code>
      
      : <code>
        "release"
      </code>
      
       | <code>
        "void"
      </code>
      
      ; }, <code>
        Promise
      </code>
      
      <{ <code>
        resolved
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }>>
    </td>
    
    <td>
      Release or void a flagged referral's reward. An administrator's, in person, with a recent sign-in.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="runreferralsweep">
        
      </a>
      
       <code>
        runReferralSweep
      </code>
    </td>
    
    <td>
      <code>
        RegisteredAction
      </code>
      
      <<code>
        "internal"
      </code>
      
      , { <code>
        op?
      </code>
      
      : <code>
        "sweep"
      </code>
      
      ; <code>
        referralId?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        Promise
      </code>
      
      <<code>
        null
      </code>
      
      >>
    </td>
    
    <td>
      The sweep that rewards what is due; woken by the component's cron. Internal.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### SetupReferralsOptions

Defined in: [src/convex/integrations/referrals.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts)

What `setupReferrals` takes.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="billing-1">
        
      </a>
      
       <code>
        billing
      </code>
    </td>
    
    <td>
      <a href="#billing">
        <code>
          Billing
        </code>
      </a>
    </td>
    
    <td>
      The app's <code>
        setupBilling
      </code>
      
       instance: it grants the rewards and reports the payments and refunds.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="rewards">
        
      </a>
      
       <code>
        rewards?
      </code>
    </td>
    
    <td>
      <a href="#referralrewards">
        <code>
          ReferralRewards
        </code>
      </a>
    </td>
    
    <td>
      What each side gets. With none, the program still attributes sign-ups.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="hold">
        
      </a>
      
       <code>
        hold?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      How long a reward waits after the first payment (milliseconds). 30 days by default, 14 at the least.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="caps-2">
        
      </a>
      
       <code>
        caps?
      </code>
    </td>
    
    <td>
      <a href="#referralcaps">
        <code>
          ReferralCaps
        </code>
      </a>
    </td>
    
    <td>
      How many rewards one referrer earns, and the program grants in a month.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### Referrals

Defined in: [src/convex/integrations/referrals.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts)

The app's referral program, from [setupReferrals](#setupreferrals).

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="api-1">
        
      </a>
      
       <code>
        api
      </code>
    </td>
    
    <td>
      <a href="#referralsapi">
        <code>
          ReferralsApi
        </code>
      </a>
    </td>
    
    <td>
      The public functions <code>
        backend/referrals.ts
      </code>
      
       re-exports.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="codefor-1">
        
      </a>
      
       <code>
        codeFor
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        userId
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      A person's code, for a page that carries it (a share page's badge). Made on the first call from a mutation or an action; a query reads the code that exists. <code>
        null
      </code>
      
       when the person has none, or turned the code off for their share pages.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="claimfor">
        
      </a>
      
       <code>
        claimFor
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        input
      </code>
      
      ) => <code>
        Promise
      </code>
      
      < | { <code>
        claimed
      </code>
      
      : <code>
        true
      </code>
      
      ; } | { <code>
        claimed
      </code>
      
      : <code>
        false
      </code>
      
      ; <code>
        reason
      </code>
      
      : <a href="#claimrefusal">
        <code>
          ClaimRefusal
        </code>
      </a>
      
      ; }>
    </td>
    
    <td>
      Claim a new account's referral for <code>
        referrerId
      </code>
      
       from server code, in a mutation or an action: what a member's ticket does for the friend it admits (<code>
        access.memberTickets({ referrals })
      </code>
      
      ). The referrer's code is made if they have none. The checks are the claim's own: the first referral claimed wins, an account older than a day is past attribution, an address that is the referrer's is refused, and the reward still waits for the first paid order and the hold. Never an error for a referral that cannot be claimed: <code>
        claimed
      </code>
      
       is <code>
        false
      </code>
      
       and <code>
        reason
      </code>
      
       says why.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="terms-1">
        
      </a>
      
       <code>
        terms
      </code>
    </td>
    
    <td>
      <a href="#referralterms">
        <code>
          ReferralTerms
        </code>
      </a>
    </td>
    
    <td>
      The program's terms as checked, with their defaults.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts" rel="nofollow">
        src/convex/integrations/referrals.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### ReferralRewards

Defined in: [src/convex/referral-rules.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/referral-rules.ts)

The rewards of a program; either side may be left out.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="referred-2">
        
      </a>
      
       <code>
        referred?
      </code>
    </td>
    
    <td>
      <a href="#referredreward">
        <code>
          ReferredReward
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/referral-rules.ts" rel="nofollow">
        src/convex/referral-rules.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="referrer-2">
        
      </a>
      
       <code>
        referrer?
      </code>
    </td>
    
    <td>
      <a href="#referrerreward">
        <code>
          ReferrerReward
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/referral-rules.ts" rel="nofollow">
        src/convex/referral-rules.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### ReferralCaps

Defined in: [src/convex/referral-rules.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/referral-rules.ts)

The caps of a program.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="perreferrer">
        
      </a>
      
       <code>
        perReferrer?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      The most rewards one referrer earns.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/referral-rules.ts" rel="nofollow">
        src/convex/referral-rules.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="permonth">
        
      </a>
      
       <code>
        perMonth?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      The most rewards the program grants in a calendar month.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/referral-rules.ts" rel="nofollow">
        src/convex/referral-rules.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### ReferralTerms

Defined in: [src/convex/referral-rules.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/referral-rules.ts)

A program's terms as `setupReferrals` checks them: the rewards, the hold in milliseconds and the caps (`null` for none).

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="rewards-1">
        
      </a>
      
       <code>
        rewards
      </code>
    </td>
    
    <td>
      <a href="#referralrewards">
        <code>
          ReferralRewards
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/referral-rules.ts" rel="nofollow">
        src/convex/referral-rules.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="holdms-1">
        
      </a>
      
       <code>
        holdMs
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/referral-rules.ts" rel="nofollow">
        src/convex/referral-rules.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="caps-3">
        
      </a>
      
       <code>
        caps
      </code>
    </td>
    
    <td>
      { <code>
        perReferrer
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; <code>
        perMonth
      </code>
      
      : <code>
        number
      </code>
      
       | <code>
        null
      </code>
      
      ; }
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/referral-rules.ts" rel="nofollow">
        src/convex/referral-rules.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        caps.perReferrer
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/referral-rules.ts" rel="nofollow">
        src/convex/referral-rules.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        caps.perMonth
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/referral-rules.ts" rel="nofollow">
        src/convex/referral-rules.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

## Type Aliases

### BillingLaunchReason

```ts
type BillingLaunchReason = "no_access_token" | "no_catalog";
```

Defined in: [src/convex/billing-launch.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/billing-launch.ts)

Why billing sells nothing yet on a production deployment: no provider
token (`no_access_token`), or a catalog `billing sync` has not pushed to
the provider's production (`no_catalog`).

---

### BillingLaunch

```ts
type BillingLaunch = 
  | {
  launched: true;
}
  | {
  launched: false;
  reason: BillingLaunchReason;
};
```

Defined in: [src/convex/billing-launch.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/billing-launch.ts)

Whether billing sells on a deployment. Billing is not launched while a
production deployment has no provider token or no production catalog:
the provider's account review can come after an app opens to its first
people, and until then its pricing reads "Plans open soon" and every
checkout is refused (`unavailable`, reason `not_launched`). On every
other deployment billing runs on the provider's sandbox, and is launched.

---

### CatalogInterval

```ts
type CatalogInterval = "month" | "year";
```

Defined in: [src/convex/catalog.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts)

A billing interval a plan is sold at: a product per interval, each with its own price.

---

### CatalogCurrencyPrices

```ts
type CatalogCurrencyPrices = Record<string, CatalogPlanPrices>;
```

Defined in: [src/convex/catalog.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts)

A plan's prices in several currencies: each lower-case ISO 4217 code to
the plan's prices in it, `{ usd: { month: 2900 }, eur: { month: 2700 } }`.
Every currency prices the same intervals, and one of them is the
catalog's [BillingCatalog.currency](#currency) (the organization's default
presentment currency when that is unset). Each becomes a native
presentment price on the same product, so a visitor pays in their own
currency and the subscription is the same plan.

---

### CatalogPackPrices

```ts
type CatalogPackPrices = Record<string, number>;
```

Defined in: [src/convex/catalog.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts)

A pack's price in several currencies: each lower-case ISO 4217 code to
the price in cents, `{ usd: 2000, eur: 1800 }`. One of them is the
catalog's [BillingCatalog.currency](#currency).

---

### CatalogDiscountDuration

```ts
type CatalogDiscountDuration = 
  | "once"
  | "forever"
  | {
  months: number;
};
```

Defined in: [src/convex/catalog.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts)

How long a discount takes money off: the first payment only (`'once'`),
every payment while the subscription lasts (`'forever'`), or the payments
of the first `months` months. A one-time pack is paid once whatever the
duration. On a yearly price `once` covers the whole first year, and
`months` must be a whole number of years (12, 24, …).

---

### CatalogDiscount

```ts
type CatalogDiscount = CatalogDiscountTerms & (
  | {
  percentOff: number;
  amountOff?: never;
}
  | {
  amountOff: number | Record<string, number>;
  percentOff?: never;
});
```

Defined in: [src/convex/catalog.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts)

A promotion: a discount declared in the catalog and pushed by `billing sync` as the provider's own discount, found again by its key. A
percentage of the price (`percentOff`, up to two decimals), or a fixed
amount in cents (`amountOff`) — one per currency the catalog prices in,
or a number in the catalog's [BillingCatalog.currency](#currency).

#### Example

```ts
discounts: {
  launch: {
    name: 'Launch offer', percentOff: 20, duration: { months: 3 },
    code: 'LAUNCH20', maxRedemptions: 500, perCustomer: 1, endsAt: '2027-01-31T23:59:59Z',
    products: { plans: ['pro'], interval: 'month' },
  },
}
```

---

### BillingAudit

```ts
type BillingAudit = Pick<Audit, "recordBackendEvent">;
```

Defined in: [src/convex/integrations/billing/activity.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/activity.ts)

Records events through the shared event path: the app's `setupAudit` instance, or the component's own.

---

### CommerceEventHandler

```ts
type CommerceEventHandler<Ctx> = (ctx, event, delivery) => Promise<void>;
```

Defined in: [src/convex/integrations/billing/commerce-webhooks.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/commerce-webhooks.ts)

What the app does with a verified, neutral billing event. It must be idempotent: a provider retries until it gets a 2xx.

#### Type Parameters

<table>
<thead>
  <tr>
    <th>
      Type Parameter
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="type-parameter-ctx">
        
      </a>
      
       <code>
        Ctx
      </code>
    </td>
  </tr>
</tbody>
</table>

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        ctx
      </code>
    </td>
    
    <td>
      <code>
        Ctx
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        event
      </code>
    </td>
    
    <td>
      <a href="#neutralbillingevent">
        <code>
          NeutralBillingEvent
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        delivery
      </code>
    </td>
    
    <td>
      { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; }
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        delivery.id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
  </tr>
</tbody>
</table>

#### Returns

`Promise`<`void`>

---

### BillingProviderName

```ts
type BillingProviderName = "polar" | "stripe" | "dodo" | "creem";
```

Defined in: [src/convex/integrations/billing/providers/types.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts)

The merchants of record the package sells through.

---

### ProviderEnvironment

```ts
type ProviderEnvironment = "sandbox" | "production";
```

Defined in: [src/convex/integrations/billing/providers/types.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts)

The provider's environment: its sandbox (test mode) or production (live mode).

---

### NeutralSubscriptionStatus

```ts
type NeutralSubscriptionStatus = "trialing" | "active" | "past_due" | "paused" | "ended" | "incomplete";
```

Defined in: [src/convex/integrations/billing/providers/types.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts)

A subscription's status in neutral words.

---

### NeutralBillingEvent

```ts
type NeutralBillingEvent = 
  | {
  type: "order.paid";
  order: NeutralOrder;
  providerType: string;
}
  | {
  type: "order.refunded";
  refund: NeutralRefund;
  providerType: string;
}
  | {
  type: "order.disputed";
  orderId: string | null;
  subscriptionId: string | null;
  providerType: string;
}
  | {
  type: "subscription.updated";
  subscription: NeutralSubscription;
  providerType: string;
}
  | {
  type: "ignored";
  providerType: string;
};
```

Defined in: [src/convex/integrations/billing/providers/types.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts)

A verified delivery, read into what it means for the app. A provider's
event that changes nothing the package keeps reads as `ignored`, with its
own type kept for the delivery log.

---

### InvoiceAnswer

```ts
type InvoiceAnswer = 
  | {
  kind: "url";
  url: string;
}
  | {
  kind: "pdf";
  bytes: ArrayBuffer;
};
```

Defined in: [src/convex/integrations/billing/providers/types.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/types.ts)

Where a customer reads an order's invoice: a link, or the PDF itself (Dodo serves the bytes).

---

### DiscountInput

```ts
type DiscountInput = Parameters<typeof discountsCreate>[1];
```

Defined in: [src/convex/integrations/billing/types/base.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/base.ts)

Full discount-create payload (derived from the provider SDK) — fixed or percentage.

---

### ProrationBehavior

```ts
type ProrationBehavior = "invoice" | "prorate" | "next_period" | "reset";
```

Defined in: [src/convex/integrations/billing/types/base.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/base.ts)

How the provider settles the money difference when a subscription switches
product mid-period (`proration_behavior`). Omit to use the organization's
configured default.

---

### ClientProrationBehavior

```ts
type ClientProrationBehavior = "invoice" | "prorate";
```

Defined in: [src/convex/integrations/billing/types/base.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/base.ts)

The subset of [ProrationBehavior](#prorationbehavior) a **client** may choose. `invoice`
and `prorate` both settle the difference now; `next_period` and `reset`
hand over the new plan's credits and features immediately while deferring
(or waiving) the charge, so letting a caller pick one is letting them
upgrade themselves for free. Those two stay server-side: pass them from
app code through `billing.updateSubscription(ctx, …)`, or make them the
organization's configured default.

---

### CancellationReason

```ts
type CancellationReason = 
  | "customer_service"
  | "low_quality"
  | "missing_features"
  | "switched_service"
  | "too_complex"
  | "too_expensive"
  | "unused"
  | "other";
```

Defined in: [src/convex/integrations/billing/types/base.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/base.ts)

The provider's churn-reason enum, recorded with a cancellation. Only set it
when the customer actually told you — it surfaces to them in their purchases
library, so it is their words, not an internal note.

---

### RefundReason

```ts
type RefundReason = 
  | "duplicate"
  | "fraudulent"
  | "customer_request"
  | "service_disruption"
  | "satisfaction_guarantee"
  | "other";
```

Defined in: [src/convex/integrations/billing/types/base.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/base.ts)

Why an order was refunded (provider `refunds.create` reason).

---

### SaveOfferRule

```ts
type SaveOfferRule = 
  | {
  pause: {
     months: 1 | 2 | 3;
  };
}
  | {
  downgrade: string;
}
  | {
  discount: string;
};
```

Defined in: [src/convex/integrations/billing/types/lifecycle.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/lifecycle.ts)

The one offer the cancel flow makes for a cancellation reason: a pause of
1 to 3 months at the period's end, a switch to a cheaper plan of the
catalog at the period's end (its key), or a discount of the catalog
without a `code` (its key), put on the subscription by the server.

---

### CurrentSubscriptions

```ts
type CurrentSubscriptions = {
  subscriptions: Record<string, unknown>[];
} & Record<string, unknown>;
```

Defined in: [src/convex/integrations/billing/types/options.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts)

What `getCurrentSubscription` returns once `multipleSubscriptions`
([SetupBillingConfig](#setupbillingconfig)) is on: the array leads,
because with add-ons there is no single "the" subscription. The primary
subscription's own fields are spread alongside it, so single-plan consumers
(`subscription.productId`, `subscription.status`) keep reading exactly as
before. The free plan's subscription is one of them, marked `free: true`.
Still `null` when the entity has no live subscription at all (no free plan
in the catalog, or not started yet).

#### Type Declaration

<table>
<thead>
  <tr>
    <th>
      Name
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        subscriptions
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        unknown
      </code>
      
      ><span>
        
      </span>
    </td>
    
    <td>
      Every live subscription, in the provider's order.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### BillingOrder

```ts
type BillingOrder = {
  id: string;
  createdAt: string;
  status: string;
  totalAmount: number;
  currency: string;
  paid: boolean;
  invoiceNumber: string | null;
  isInvoiceGenerated: boolean;
} & Record<string, unknown>;
```

Defined in: [src/convex/integrations/billing/types/options.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts)

A past charge, normalized for a Convex action's return value: the provider's
`Order` fields with every date rendered as an ISO string (Convex cannot
serialize `Date`). The index signature keeps every other provider field
reachable without a cast.

#### Type Declaration

<table>
<thead>
  <tr>
    <th>
      Name
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        createdAt
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        status
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        totalAmount
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Amount in the currency's minor unit (cents), after discounts and taxes.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        currency
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        paid
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        invoiceNumber
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      Assigned when the invoice is finalized; <code>
        null
      </code>
      
       on draft orders.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        isInvoiceGenerated
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Whether an invoice PDF exists yet — <a href="#getinvoiceurl">
        Billing.getInvoiceUrl
      </a>
      
       needs one.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### UsageEvent

```ts
type UsageEvent = {
  id: string;
  timestamp: string;
  name: string;
  units?: number;
  unit?: MeterUnit;
  metadata?: Record<string, string | number | boolean>;
} & Record<string, unknown>;
```

Defined in: [src/convex/integrations/billing/types/options.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts)

One ingested usage event as the provider's events API returns it, normalized
for a Convex action's return value (dates as ISO strings). `units` is
resolved from the meter's value property — the same property a spend ingests
— and is absent when the meter is unknown or counts events rather than
summing a property. `unit` is what the meter counts, beside `units` when
the catalog names it.

#### Type Declaration

<table>
<thead>
  <tr>
    <th>
      Name
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        timestamp
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        units?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        unit?
      </code>
    </td>
    
    <td>
      <a href="#meterunit">
        <code>
          MeterUnit
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        metadata?
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        number
      </code>
      
       | <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### CheckoutOptions

```ts
type CheckoutOptions = {
  productIds: string[];
  origin: string;
  successUrl: string;
  subscriptionId?: string;
  metadata?: Record<string, string>;
  locale?: string;
  currency?: string;
  customerIpAddress?: string;
  prefill?: CheckoutPrefill;
  customFields?: Record<string, string | number | boolean>;
  requireBillingAddress?: boolean;
  allowDiscountCodes?: boolean;
  discountCode?: string;
  discount?: string;
  utm?: CampaignAttribution;
  emailOptOut?: boolean;
};
```

Defined in: [src/convex/integrations/billing/types/options.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts)

Everything [Billing.api](#api)'s `generateCheckoutLink` accepts from a
client. A type alias rather than an interface so it can type the
registered action itself (Convex's `DefaultFunctionArgs` needs an implicit
index signature, which only aliases get).

What is bought and where the buyer lands are checked on the server: every
product must be in the app's catalog, and `origin` and `successUrl` on
the site's own origin (`SITE_URL`) or one of `trustedOrigins`. The trial
is the product's own, and a discount is the code the customer types,
`discountCode`, or a public promotion of the catalog by its key
(`discount`): a different trial, a promotion only the server applies and
a discount by id are the server's choice, through [Billing.checkout](#checkout).

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="productids">
        
      </a>
      
       <code>
        productIds
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      Provider product ids, each one from the app's catalog.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="origin">
        
      </a>
      
       <code>
        origin
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The origin of the page embedding the checkout (for the iframe handshake).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="successurl-1">
        
      </a>
      
       <code>
        successUrl
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Where the buyer lands after paying.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="subscriptionid-8">
        
      </a>
      
       <code>
        subscriptionId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Upgrade one of the entity's own free subscriptions instead of starting a new one. A plan's checkout upgrades the entity's free plan without it: the server names it.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="metadata-4">
        
      </a>
      
       <code>
        metadata?
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
      >
    </td>
    
    <td>
      The app's own keys: none the package reads back (see <code>
        RESERVED_METADATA_KEYS
      </code>
      
      ).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="locale-1">
        
      </a>
      
       <code>
        locale?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      BCP-47 language tag for the checkout UI.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="currency-5">
        
      </a>
      
       <code>
        currency?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The currency to pay in, lower-case ISO 4217: one the catalog prices every product of the checkout in (<code>
        getPricing
      </code>
      
       lists them), else the checkout is refused as <code>
        invalid_input
      </code>
      
       (<code>
        currency
      </code>
      
      ). Omit for the catalog's own.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="customeripaddress">
        
      </a>
      
       <code>
        customerIpAddress?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The visitor's IP address, for the provider's local pricing: it picks the currency and pre-fills the billing country from the address that creates the checkout, which is otherwise the deployment's. The <code>
        useBilling
      </code>
      
       checkout reads it from the app's server (<code>
        /api/backend/visitor-ip
      </code>
      
      ) and sends it; nothing keeps it.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="prefill">
        
      </a>
      
       <code>
        prefill?
      </code>
    </td>
    
    <td>
      <a href="#checkoutprefill">
        <code>
          CheckoutPrefill
        </code>
      </a>
    </td>
    
    <td>
      Pre-filled customer details.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="customfields-3">
        
      </a>
      
       <code>
        customFields?
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        number
      </code>
      
       | <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      Values for the organization's custom checkout fields, keyed by field slug.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="requirebillingaddress">
        
      </a>
      
       <code>
        requireBillingAddress?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Require the full billing address, not just the country.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="allowdiscountcodes-1">
        
      </a>
      
       <code>
        allowDiscountCodes?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Let the customer type a discount code into the provider's own checkout (default <code>
        true
      </code>
      
      ). The provider validates it against the live catalog.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="discountcode-1">
        
      </a>
      
       <code>
        discountCode?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      A discount code to apply up front: a campaign link's code, say. The provider checks it like one the customer typed, and a code it does not know refuses the checkout as <code>
        invalid_input
      </code>
      
       (<code>
        discountCode
      </code>
      
      ).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="discount-1">
        
      </a>
      
       <code>
        discount?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      A public promotion of the catalog to apply, by its key (<code>
        'launch'
      </code>
      
      ): one with a <code>
        code
      </code>
      
      , for a product it applies to. Any other key is refused as <code>
        invalid_input
      </code>
      
       (<code>
        discount
      </code>
      
      ), and so is one the provider no longer redeems (ended, used up), so the caller can check out without it. One discount per checkout: not beside <code>
        discountCode
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="utm">
        
      </a>
      
       <code>
        utm?
      </code>
    </td>
    
    <td>
      <a href="#campaignattribution">
        <code>
          CampaignAttribution
        </code>
      </a>
    </td>
    
    <td>
      Campaign attribution, stored as <code>
        utm_*
      </code>
      
       metadata.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="emailoptout">
        
      </a>
      
       <code>
        emailOptOut?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      The EU soft opt-in's box, where the checkout showed one (a topic of <code>
        setupEmail
      </code>
      
       has <code>
        softOptIn
      </code>
      
      ): <code>
        true
      </code>
      
       when the person ticked "Don't email me", <code>
        false
      </code>
      
       when they left it. Paid, a checkout with <code>
        false
      </code>
      
       joins the person who opened it to those topics, recorded on the consent ledger with the checkout. Omit it where no box was shown: the order then joins nothing.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### ServerCheckoutOptions

```ts
type ServerCheckoutOptions = CheckoutOptions & {
  trial?: CheckoutTrial | false;
  discountId?: string;
};
```

Defined in: [src/convex/integrations/billing/types/options.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts)

What [Billing.checkout](#checkout) takes from server code: everything a client
may send, plus what only the server chooses. Its `discount` may name any
discount of the catalog, one without a code included.

#### Type Declaration

<table>
<thead>
  <tr>
    <th>
      Name
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        trial?
      </code>
    </td>
    
    <td>
      <a href="#checkouttrial">
        <code>
          CheckoutTrial
        </code>
      </a>
      
       | <code>
        false
      </code>
    </td>
    
    <td>
      The trial for this checkout: <code>
        false
      </code>
      
       removes the product's own, an override grants at most 30 days. Omit to keep the product's own trial.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        discountId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Pre-apply a discount by <strong>
        id
      </strong>
      
       — the form the provider's checkout payload takes, and the server's to choose: a 100% discount minted for one claim must never be a client's to name. Prefer <code>
        discount
      </code>
      
       for a catalog promotion.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/options.ts" rel="nofollow">
        src/convex/integrations/billing/types/options.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### BenefitKind

```ts
type BenefitKind = 
  | "license_key"
  | "download"
  | "community"
  | "repository"
  | "shared_channel"
  | "custom"
  | "credits"
  | "feature"
  | "other";
```

Defined in: [src/convex/integrations/billing/types/records.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts)

What a granted benefit gives, in the package's own words rather than the
provider's benefit types: a license key, file downloads, a role in a
community server, access to a code repository, a shared chat channel, a
perk you deliver yourself (`custom`), prepaid credits, a feature of the
catalog, or `other` for a type newer than the package.

---

### RevenueInterval

```ts
type RevenueInterval = "day" | "week" | "month";
```

Defined in: [src/convex/integrations/billing/types/revenue.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/revenue.ts)

How the periods of a read are cut: per day, week or month, as the provider counts them (in UTC).

---

### RevenueMetric

```ts
type RevenueMetric = 
  | "monthlyRecurringRevenue"
  | "annualRecurringRevenue"
  | "revenue"
  | "netRevenue"
  | "activeSubscriptions"
  | "newSubscriptions"
  | "renewedSubscriptions"
  | "churnedSubscriptions"
  | "canceledSubscriptions"
  | "churnRate"
  | "checkouts"
  | "succeededCheckouts"
  | "checkoutsConversion"
  | "lifetimeValue"
  | "costs"
  | "costPerUser"
  | "grossMargin"
  | "grossMarginPercentage";
```

Defined in: [src/convex/integrations/billing/types/revenue.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/revenue.ts)

One metric a read returns: money in cents, a count, or a rate as a fraction.

---

### RevenueValues

```ts
type RevenueValues = Record<RevenueMetric, number | null>;
```

Defined in: [src/convex/integrations/billing/types/revenue.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/revenue.ts)

A value of every metric; `null` where the provider has none (a margin before any cost was reported).

---

### BillingWebhookEventHandlers

```ts
type BillingWebhookEventHandlers = WebhookEventHandlers;
```

Defined in: [src/convex/integrations/billing/types/setup.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts)

Per-event billing webhook handlers, keyed by the provider's event names
(`'order.paid'`, `'subscription.active'`, …). Service-neutral alias for the
shape `registerBackendRoutes` mounts at `/billing/events`.

---

### BillingEmail

```ts
type BillingEmail = Pick<Email, "sendTemplate"> & {
  preferences?: Pick<Email["preferences"], "softOptIn" | "topics">;
};
```

Defined in: [src/convex/integrations/billing/types/setup.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts)

What billing sends its email through: the app's `setupEmail` instance.

#### Type Declaration

<table>
<thead>
  <tr>
    <th>
      Name
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        preferences?
      </code>
    </td>
    
    <td>
      <code>
        Pick
      </code>
      
      <<a href="https://nuxt-backend.dev/docs/reference/api/email#email-25">
        <code>
          Email
        </code>
      </a>
      
      [<code>
        "preferences"
      </code>
      
      ], <code>
        "softOptIn"
      </code>
      
       | <code>
        "topics"
      </code>
      
      >
    </td>
    
    <td>
      The soft opt-in a paid checkout joins its customer to (<code>
        setupEmail({ topics: { <key>: { softOptIn: true } } })
      </code>
      
      ).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/setup.ts" rel="nofollow">
        src/convex/integrations/billing/types/setup.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### AccountBillingErasure

```ts
type AccountBillingErasure = (ctx, erasure) => Promise<void>;
```

Defined in: [src/convex/integrations/billing/types/surface.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts)

See [Billing.forgetAccount](#forgetaccount).

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        ctx
      </code>
    </td>
    
    <td>
      <code>
        RunWriteCtx
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        erasure
      </code>
    </td>
    
    <td>
      <a href="#accountbillingerasureinput">
        <code>
          AccountBillingErasureInput
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

#### Returns

`Promise`<`void`>

---

### AccountBillingExport

```ts
type AccountBillingExport = (ctx, account) => Promise<AccountBillingRecord[]>;
```

Defined in: [src/convex/integrations/billing/types/surface.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/surface.ts)

See [Billing.exportAccount](#exportaccount).

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        ctx
      </code>
    </td>
    
    <td>
      <code>
        RunQueryCtx
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        account
      </code>
    </td>
    
    <td>
      <code>
        Pick
      </code>
      
      <<a href="#accountbillingerasureinput">
        <code>
          AccountBillingErasureInput
        </code>
      </a>
      
      , <code>
        "userId"
      </code>
      
       | <code>
        "deleted"
      </code>
      
      >
    </td>
  </tr>
</tbody>
</table>

#### Returns

`Promise`<[`AccountBillingRecord`](#accountbillingrecord)<span>



</span>

>

---

### ClaimRefusal

```ts
type ClaimRefusal = 
  | "invalid"
  | "own_code"
  | "already_claimed"
  | "too_late"
  | "self_referral";
```

Defined in: [src/convex/integrations/referrals.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts)

Why a claim recorded nothing.

---

### ReferredOffer

```ts
type ReferredOffer = 
  | {
  kind: "discount";
  name: string;
  percentOff?: number;
  months?: number;
}
  | {
  kind: "trial";
  days: number;
};
```

Defined in: [src/convex/integrations/referrals.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts)

What the person referred gets, in words a page can show.

---

### ReferrerOffer

```ts
type ReferrerOffer = 
  | {
  kind: "pack";
  name: string;
}
  | {
  kind: "months";
  months: number;
};
```

Defined in: [src/convex/integrations/referrals.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts)

What the referrer gets, in words a page can show.

---

### ReferredReward

```ts
type ReferredReward = 
  | {
  discount: string;
}
  | {
  trialDays: number;
};
```

Defined in: [src/convex/referral-rules.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/referral-rules.ts)

What the person referred gets: a catalog discount without a code, or trial days, on their first paid checkout.

---

### ReferrerReward

```ts
type ReferrerReward = 
  | {
  pack: string;
}
  | {
  months: number;
  plan?: string;
};
```

Defined in: [src/convex/referral-rules.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/referral-rules.ts)

What the referrer gets: a credit pack, or free months of their plan.

---

### ReferralState

```ts
type ReferralState = "claimed" | "held" | "rewarded" | "voided";
```

Defined in: [src/convex/referral-rules.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/referral-rules.ts)

The states a referral goes through: claimed, held (first payment made, waiting out the hold), rewarded, voided.

## Variables

### ALL_BILLING_EVENTS

```ts
const ALL_BILLING_EVENTS: readonly ["checkout.created", "checkout.updated", "checkout.expired", "customer.created", "customer.updated", "customer.deleted", "customer.state_changed", "customer_seat.assigned", "customer_seat.claimed", "customer_seat.revoked", "member.created", "member.updated", "member.deleted", "order.created", "order.updated", "order.paid", "order.refunded", "subscription.created", "subscription.updated", "subscription.active", "subscription.canceled", "subscription.uncanceled", "subscription.revoked", "subscription.past_due", "refund.created", "refund.updated", "product.created", "product.updated", "benefit.created", "benefit.updated", "benefit_grant.created", "benefit_grant.cycled", "benefit_grant.updated", "benefit_grant.revoked", "organization.updated", "subscription.paused", "subscription.resumed"];
```

Defined in: [src/convex/integrations/billing/events.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/events.ts)

The provider's full webhook catalog. The composed handler map covers every
one of these, so any verified delivery gets logging, dedupe, and consumer
dispatch — events outside it (a newer provider than this package) land in
`onUnknownEvent` with a 202 instead of an error loop.

---

### PROVIDER_CAPABILITIES

```ts
const PROVIDER_CAPABILITIES: Readonly<Record<BillingProviderName, ProviderCapabilities>>;
```

Defined in: [src/convex/integrations/billing/providers/capabilities.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/capabilities.ts)

**Experimental**

What each provider's API offers, checked against its docs on 2026-11-24.
The doctor and the docs read this table; a call a provider lacks throws
`ProviderUnsupportedError` and the app sends the customer to the portal
(or the seller to the dashboard) instead.

- Stripe Managed Payments: docs.stripe.com/payments/managed-payments
- Dodo Payments: docs.dodopayments.com/api-reference
- Creem: docs.creem.io/api-reference. No refund or invoice endpoint is
documented: refunds are made in the dashboard (the `refund.created`
webhook still reaches the app) and Creem emails every receipt.

---

### DIGITAL_CONTENT_CONSENT_VERSION

```ts
const DIGITAL_CONTENT_CONSENT_VERSION: "2026-11-24" = '2026-11-24';
```

Defined in: [src/convex/integrations/billing/providers/consent.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/consent.ts)

**Experimental**

The version of the wording below: bump it whenever the text changes, so a record names what was shown.

---

### DIGITAL_CONTENT_CONSENT_TEXT

```ts
const DIGITAL_CONTENT_CONSENT_TEXT: "I want access to start right away, and I understand that I lose my right to withdraw from this purchase once it starts." = 'I want access to start right away, and I understand that I lose my right to withdraw from this purchase once it starts.';
```

Defined in: [src/convex/integrations/billing/providers/consent.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/consent.ts)

**Experimental**

The checkbox's text, in English. Translate it with the app's labels; the record keeps the hash of what was shown.

## Functions

### defineBillingCatalog()

```ts
function defineBillingCatalog<Catalog>(catalog): Catalog;
```

Defined in: [src/convex/catalog.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/catalog.ts)

Declare the billing catalog (typed identity: its keys stay literal, so
`keyof typeof catalog.discounts` names its promotions). Push it with
`npx nuxt-backend billing sync`.

#### Type Parameters

<table>
<thead>
  <tr>
    <th>
      Type Parameter
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="type-parameter-catalog">
        
      </a>
      
       <code>
        Catalog
      </code>
      
       <em>
        extends
      </em>
      
       <a href="#billingcatalog">
        <code>
          BillingCatalog
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        catalog
      </code>
    </td>
    
    <td>
      <code>
        Catalog
      </code>
    </td>
  </tr>
</tbody>
</table>

#### Returns

`Catalog`

#### Example

```ts
export default defineBillingCatalog({
  meters: { credits: {} },
  plans: {
    pro: { name: 'Pro', prices: { month: 2900, year: 29000 },
      credits: { meter: 'credits', units: 500 }, features: ['priority_support'],
      trial: { interval: 'day', count: 14 },
      usage: [{ meter: 'credits', unitAmount: 5 }] },
  },
  packs: {
    credits500: { name: '500 credits', price: 2000, credits: { meter: 'credits', units: 500 } },
  },
  features: { priority_support: { description: 'Priority support' } },
})
```

---

### setupBilling()

```ts
function setupBilling(components, config): Billing;
```

Defined in: [src/convex/integrations/billing.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing.ts)

Configure billing for subscriptions, discounts, prepaid credits, and gift
purchases — linked to your auth users and cached reactively inside the
`backend` component (so consumers add nothing to their own schema).

Subscription / feature / credit reads return `null`/empty until the provider
has synced, so a mid-configuration deployment degrades gracefully; checkout /
portal / credit / discount operations need the required
`BILLING_ACCESS_TOKEN` env var.

Billing follows the tenant: with the default `billTo: 'workspace'` the
active workspace owns the subscription and credits (every member shares
them); with `billTo: 'user'` each user is their own customer. Either way
the entity resolves from identity claims — zero wiring — unless
`resolveEntity` says otherwise.

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        components
      </code>
    </td>
    
    <td>
      <a href="#billingcomponents">
        <code>
          BillingComponents
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        config
      </code>
    </td>
    
    <td>
      <a href="#setupbillingconfig">
        <code>
          SetupBillingConfig
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

#### Returns

[`Billing`](#billing)

#### Example

```ts
import { setupBilling } from 'nuxt-backend/billing'
import { components } from './_generated/api'
import { email } from './email'

const billing = setupBilling(components, { email })

export const {
  generateCheckoutLink, generateCustomerPortalUrl, getConfiguredProducts, getPricing, giftCheckout,
  getCurrentSubscription, getFeatures, getCredits, syncEntitlements,
  startFreePlan, resyncEntitlements, getReceivedGifts, claimGift,
} = billing.api
```

---

### createCommerceWebhookHandler()

```ts
function createCommerceWebhookHandler<Ctx>(__namedParameters): (ctx, request) => Promise<Response>;
```

Defined in: [src/convex/integrations/billing/commerce-webhooks.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/commerce-webhooks.ts)

**Experimental**

The handler an app passes as `billing.webhookHandler` to `registerBackendRoutes`
for an adapter provider. `BILLING_PROVIDER` does not mount it.

#### Type Parameters

<table>
<thead>
  <tr>
    <th>
      Type Parameter
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="type-parameter-ctx-2">
        
      </a>
      
       <code>
        Ctx
      </code>
    </td>
  </tr>
</tbody>
</table>

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        __namedParameters
      </code>
    </td>
    
    <td>
      <a href="#commercewebhookoptions">
        <code>
          CommerceWebhookOptions
        </code>
      </a>
      
      <<code>
        Ctx
      </code>
      
      >
    </td>
  </tr>
</tbody>
</table>

#### Returns

(`ctx`, `request`) => `Promise`<`Response`>

---

### recordDigitalContentConsent()

```ts
function recordDigitalContentConsent(input): Promise<DigitalContentConsent>;
```

Defined in: [src/convex/integrations/billing/providers/consent.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/consent.ts)

**Experimental**

The proof for a checkout of digital content, from what the page sent: it
refuses unless `accepted` is the literal `true` (a pre-ticked box or a
missing field is no consent), and hashes the text the page showed.

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        input
      </code>
    </td>
    
    <td>
      { <code>
        accepted
      </code>
      
      : <code>
        unknown
      </code>
      
      ; <code>
        text?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        version?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        now?
      </code>
      
      : <code>
        number
      </code>
      
      ; }
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        input.accepted
      </code>
    </td>
    
    <td>
      <code>
        unknown
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        input.text?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        input.version?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        input.now?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
  </tr>
</tbody>
</table>

#### Returns

`Promise`<[`DigitalContentConsent`](#digitalcontentconsent)>

---

### consentMetadata()

```ts
function consentMetadata(consent): Record<string, string>;
```

Defined in: [src/convex/integrations/billing/providers/consent.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/consent.ts)

**Experimental**

The proof as checkout metadata.

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        consent
      </code>
    </td>
    
    <td>
      <a href="#digitalcontentconsent">
        <code>
          DigitalContentConsent
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

#### Returns

`Record`<`string`, `string`>

---

### consentFromMetadata()

```ts
function consentFromMetadata(metadata): DigitalContentConsent | null;
```

Defined in: [src/convex/integrations/billing/providers/consent.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/consent.ts)

**Experimental**

The proof an order's metadata carries back in a webhook, or `null` when the checkout had none.

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        metadata
      </code>
    </td>
    
    <td>
      <code>
        Readonly
      </code>
      
      <<code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
      >>
    </td>
  </tr>
</tbody>
</table>

#### Returns

[`DigitalContentConsent`](#digitalcontentconsent) | `null`

---

### billingProviderName()

```ts
function billingProviderName(value): BillingProviderName;
```

Defined in: [src/convex/integrations/billing/providers/index.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/index.ts)

**Experimental**

The provider `BILLING_PROVIDER` names, `polar` when it is unset. A name
the package does not know is refused, so a typo never sells through the
wrong provider.

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        value
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
    </td>
  </tr>
</tbody>
</table>

#### Returns

[`BillingProviderName`](#billingprovidername-3)

---

### createCommerceProvider()

```ts
function createCommerceProvider(name, options): CommerceProvider;
```

Defined in: [src/convex/integrations/billing/providers/index.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/index.ts)

**Experimental**

The adapter for `name`.

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        "stripe"
      </code>
      
       | <code>
        "dodo"
      </code>
      
       | <code>
        "creem"
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options
      </code>
    </td>
    
    <td>
      <a href="#provideroptions">
        <code>
          ProviderOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

#### Returns

[`CommerceProvider`](#commerceprovider)

---

### commerceProviderFromEnv()

```ts
function commerceProviderFromEnv(
   env, 
   environment, 
   fetchImpl?
): CommerceProvider | null;
```

Defined in: [src/convex/integrations/billing/providers/index.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/index.ts)

**Experimental**

The adapter the deployment's env names: `BILLING_PROVIDER`, the key in
`BILLING_ACCESS_TOKEN`, and the provider's sandbox everywhere but
production. `null` for Polar, which the component path serves.

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        env
      </code>
    </td>
    
    <td>
      <code>
        Readonly
      </code>
      
      <<code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        environment
      </code>
    </td>
    
    <td>
      <a href="#providerenvironment">
        <code>
          ProviderEnvironment
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        fetchImpl?
      </code>
    </td>
    
    <td>
      { (<code>
        input
      </code>
      
      , <code>
        init?
      </code>
      
      ): <code>
        Promise
      </code>
      
      <<code>
        Response
      </code>
      
      >; (<code>
        input
      </code>
      
      , <code>
        init?
      </code>
      
      ): <code>
        Promise
      </code>
      
      <<code>
        Response
      </code>
      
      >; }
    </td>
  </tr>
</tbody>
</table>

#### Returns

[`CommerceProvider`](#commerceprovider) | `null`

---

### webhookSecretsFromEnv()

```ts
function webhookSecretsFromEnv(env): string[];
```

Defined in: [src/convex/integrations/billing/providers/index.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/providers/index.ts)

**Experimental**

The webhook secrets the env accepts: a rotation list, first entry primary.

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        env
      </code>
    </td>
    
    <td>
      <code>
        Readonly
      </code>
      
      <<code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >>
    </td>
  </tr>
</tbody>
</table>

#### Returns

`string`<span>



</span>



---

### setupReferrals()

```ts
function setupReferrals(components, options): Referrals;
```

Defined in: [src/convex/integrations/referrals.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/referrals.ts)

Set the referral program up in its own backend file (`backend/referrals.ts`).
Each person gets a code of their own, made the first time they ask. A
visitor who signs up through it claims the referral; the person's first
paid order, on the billing entity they pay for, starts the hold, and a
refund during it voids the referral. When the hold ends the program checks
the order again, applies the caps and grants the rewards: the referrer's
pack or free months here, and the person referred already had theirs at
checkout (a catalog discount, locked on, or trial days).

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        components
      </code>
    </td>
    
    <td>
      <a href="#referralcomponents">
        <code>
          ReferralComponents
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options
      </code>
    </td>
    
    <td>
      <a href="#setupreferralsoptions">
        <code>
          SetupReferralsOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

#### Returns

[`Referrals`](#referrals-1)

#### Example

```ts
import { setupReferrals } from 'nuxt-backend/billing'
import { DAY } from 'nuxt-backend/rate-limit'
import { components } from './_generated/api'
import { billing } from './billing'

export const referrals = setupReferrals(components, {
  billing,
  rewards: { referred: { discount: 'friend' }, referrer: { pack: 'credits100' } },
  hold: 30 * DAY,
  caps: { perReferrer: 20, perMonth: 500 },
})

export const { getReferralCode, getReferrals, claimReferral } = referrals.api
```

## References

### PricedCredits

Re-exports [PricedCredits](https://nuxt-backend.dev/docs/reference/api/use-pricing#pricedcredits)

---

### PricedTrial

Re-exports [PricedTrial](https://nuxt-backend.dev/docs/reference/api/use-pricing#pricedtrial)

---

### PricedPlanPrice

Re-exports [PricedPlanPrice](https://nuxt-backend.dev/docs/reference/api/use-pricing#pricedplanprice)

---

### PricedPlan

Re-exports [PricedPlan](https://nuxt-backend.dev/docs/reference/api/use-pricing#pricedplan)

---

### PricedPack

Re-exports [PricedPack](https://nuxt-backend.dev/docs/reference/api/use-pricing#pricedpack)

---

### PricedOffer

Re-exports [PricedOffer](https://nuxt-backend.dev/docs/reference/api/use-pricing#pricedoffer)

---

### PricedPromotion

Re-exports [PricedPromotion](https://nuxt-backend.dev/docs/reference/api/use-pricing#pricedpromotion)

---

### Pricing

Re-exports [Pricing](https://nuxt-backend.dev/docs/reference/api/use-pricing#pricing)

---

### QuotaUsage

Re-exports [QuotaUsage](https://nuxt-backend.dev/docs/reference/api/use-features#quotausage)

---

### CancelFlowState

Re-exports [CancelFlowState](https://nuxt-backend.dev/docs/reference/api/use-billing#cancelflowstate)

---

### CancelOutcome

Re-exports [CancelOutcome](https://nuxt-backend.dev/docs/reference/api/use-billing#canceloutcome)

---

### SaveOffer

Re-exports [SaveOffer](https://nuxt-backend.dev/docs/reference/api/use-billing#saveoffer)

---

### WithdrawalPeriod

Re-exports [WithdrawalPeriod](https://nuxt-backend.dev/docs/reference/api/use-billing#withdrawalperiod)


## Sitemap

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