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

# Type Reference

> Reference for types used in the library

## User

### Properties

| Property          | Type                                           | Description                                                                                                                                                                    |
| ----------------- | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `email`           | `string`                                       | Email address of the user.                                                                                                                                                     |
| `paid`            | `boolean`                                      | True if the user has comped access, an active lifetime purchase, or a recurring subscription in `active`, `trialing`, or `past_due` status whose current period has not ended. |
| `trial_available` | `boolean`                                      | True if the user can still start a free trial for this extension.                                                                                                              |
| `plans`           | [`UserPlan[]`](/guides/library/types#userplan) | Array of plans the user has purchased.                                                                                                                                         |

### Example

```typescript theme={null}
{
    email: "user@example.com",
	paid: true,
	trial_available: false,
	plans: [
		{
			id: "tp_12345",
			name: "Pro",
			billing_cycle: "monthly",
			price: 19.99,

			status: "active",
			paid_at: "2023-10-01T12:00:00Z",
			trial_end: null,
			period_start: "2023-10-01T12:00:00Z",
			period_end: "2023-11-01T12:00:00Z",
			canceled_at: null,
		},
        ...
	]
}
```

## UserPlan

### Properties

| Property        | Type                                                                                                                 | Description                                                                           |
| --------------- | -------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| `id`            | `string`                                                                                                             | Unique identifier for the tier price.                                                 |
| `name`          | `string`                                                                                                             | Name of the price, or the tier name when the price does not have its own name.        |
| `billing_cycle` | `"once" \| "monthly" \| "yearly"`                                                                                    | Billing cycle for this plan.                                                          |
| `price`         | `number`                                                                                                             | Price in dollars (for example, `19.99`).                                              |
| `status`        | `"active" \| "trialing" \| "past_due" \| "canceled" \| "unpaid" \| "incomplete" \| "incomplete_expired" \| "paused"` | Current plan status.                                                                  |
| `paid_at`       | `string \| null`                                                                                                     | ISO timestamp for when the plan was paid for, or null if not applicable.              |
| `trial_end`     | `string \| null`                                                                                                     | ISO timestamp for when the trial ends, or null if the plan is not trialing.           |
| `period_start`  | `string \| null`                                                                                                     | ISO timestamp for when the current billing period started, or null if not applicable. |
| `period_end`    | `string \| null`                                                                                                     | ISO timestamp for when the current billing period ends, or null if not applicable.    |
| `canceled_at`   | `string \| null`                                                                                                     | ISO timestamp for when the plan was canceled, or null if not applicable.              |

For recurring plans, `paid` can remain `true` while a subscription is `past_due`, but only until `period_end`. If Stripe leaves the subscription `past_due` after that point, `paid` becomes `false`.

### Examples

```typescript theme={null}
{
    id: "tp_003",
    name: "Lifetime",
    billing_cycle: "once",
    price: 99.99,

    status: "active",
    paid_at: "2023-10-01T12:00:00Z",
    trial_end: null,
    period_start: null,
    period_end: null,
    canceled_at: null,
}
```

```typescript theme={null}
{
    id: "tp_001",
    name: "Pro",
    billing_cycle: "monthly",
    price: 19.99,

    status: "canceled",
    paid_at: "2023-10-01T12:00:00Z",
    trial_end: null,
    period_start: "2023-10-01T12:00:00Z",
    period_end: "2023-10-15T12:00:00Z",
    canceled_at: "2023-10-15T12:00:00Z",
}
```

```typescript theme={null}
{
    id: "tp_001",
    name: "Pro",
    billing_cycle: "monthly",
    price: 19.99,

    status: "trialing",
    paid_at: null,
    trial_end: "2023-10-14T12:00:00Z",
    period_start: "2023-10-01T12:00:00Z",
    period_end: "2023-10-14T12:00:00Z",
    canceled_at: null,
}
```

## Tier

### Properties

| Property      | Type                                             | Description                                                                        |
| ------------- | ------------------------------------------------ | ---------------------------------------------------------------------------------- |
| `id`          | `string`                                         | Unique identifier for the tier.                                                    |
| `name`        | `string`                                         | Name of the tier.                                                                  |
| `description` | `string \| null`                                 | Description of the tier, null if not applicable.                                   |
| `rank`        | `number`                                         | Position of the tier in your pricing structure.                                    |
| `trial_days`  | `number \| null`                                 | Number of free trial days for recurring prices, or null if no trial is configured. |
| `prices`      | [`TierPrice[]`](/guides/library/types#tierprice) | Pricing variants for this tier.                                                    |

### Examples

```typescript theme={null}
{
    id: "tier_12345",
    name: "Pro",
    description: "Access to all premium features.",
    rank: 2,
    trial_days: 14,
    prices: [
        {
            id: "tp_001",
            billing_cycle: "monthly",
            price: 19.99,
        },
        {
            id: "tp_002",
            billing_cycle: "yearly",
            price: 199.99,
        },
    ]
}
```

```typescript theme={null}
{
    id: "tier_67890",
    name: "Lifetime",
    description: "One-time purchase for lifetime access.",
    rank: 1,
    trial_days: null,
    prices: [
        {
            id: "tp_003",
            billing_cycle: "once",
            price: 99.99,
        },
    ]
}
```

## TierPrice

### Properties

| Property        | Type                              | Description                              |
| --------------- | --------------------------------- | ---------------------------------------- |
| `id`            | `string`                          | Unique identifier for the tier price.    |
| `billing_cycle` | `"once" \| "monthly" \| "yearly"` | Billing cycle for this price.            |
| `price`         | `number`                          | Price in dollars (for example, `19.99`). |
