---
title: "Gift a plan as a pass"
description: "Let a customer buy a plan once as a gift: the recipient's free workspace gets the plan for 1, 3 or 12 months, with every benefit the plan grants, no card and no renewal, and a notice before it ends. Experimental."
canonical_url: "https://nuxt-backend.dev/docs/build/growth/offers/plan-passes"
---
# Gift a plan as a pass

> Let a customer buy a plan once as a gift: the recipient's free workspace gets the plan for 1, 3 or 12 months, with every benefit the plan grants, no card and no renewal, and a notice before it ends. Experimental.

Version: nuxt-backend 0.6.x · Tab: Build · Kind: how-to · Status: stable

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

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

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

A plan pass lets someone give a whole plan, not only credits: three months of Pro for a friend who started making comic strips in Panels last week, say. The purchaser pays once, on their own account, for 1, 3 or 12 months of a plan. The recipient claims it into a workspace on the free plan, which then holds the plan for that time: its features, its quotas and its monthly credits. Nobody is asked for a card, and nothing renews. When the time is up, the workspace is back on the free plan, unless someone chose to keep the plan and pay for it. The same pass also runs a [reverse trial](#run-a-reverse-trial). Plan passes are experimental.

- **Natively:** Polar sells one-time and recurring products, grants a plan's benefits every cycle, and switches between two free products at once with no charge. It schedules a product change one cycle ahead at most, and its trials collect a card up front (checked on 2026-10-25).
- **The package adds:** the private pass products `billing sync` makes, the gift purchase and claim, the end date a pass keeps across several cycles, the notice before it ends, and the reverse trial on the same machinery.

## Before you start

- A [free plan](https://nuxt-backend.dev/docs/build/billing/catalog#the-free-plan) in the catalog: a pass replaces it for its time, and gives way to it at the end.
- Gifts working for packs: [Send and receive gifts](https://nuxt-backend.dev/docs/build/growth/offers/gifts).

## Offer a plan as a gift

Say which lengths a plan can be gifted for, beside its prices:

```ts [backend/billing.catalog.ts]
plans: {
  free: { name: 'Free', prices: { month: 0 }, credits: { meter: 'credits', units: 20 } },
  pro: {
    name: 'Pro',
    prices: { month: 1200, year: 12000 },
    credits: { meter: 'credits', units: 500 },
    features: ['hd_export'],
    gift: { months: [1, 3, 12] },
  },
},
```

`gift.months` lists any of 1, 3 and 12, and the catalog needs a free plan to return to (`billing sync` refuses it otherwise). `npx nuxt-backend billing sync` then makes two kinds of private product for the plan. Neither shows on the pricing page, in `<UpgradePrompt>` or among what a checkout may sell:

- **A purchase product per length**, one-time, with none of the plan's benefits. Its price comes from the plan: the months at the monthly price, and 12 months at the yearly price when the plan has one.
- **One pass product**, free and monthly, carrying the plan's own benefits: its features, its quotas and its monthly credit grant. `billing.generated.ts` lists both under `passes`, by plan key.

## Send a pass

A pass is sent like a pack, with the plan's key and a length:

```ts
await useGifts().send('pro', { months: 3, recipientEmail: 'friend@example.com' })
```

The purchase follows the gift flow: the purchaser pays on their own account and gets the receipt, the recipient is told by email, signs in to prove the address, and claims. Every gift rule holds, a date and a cancel included, and a length the plan does not offer is refused as `invalid_input` (field `months`); so is a plan that is not offered, as `plan`. The [gifts page](https://nuxt-backend.dev/docs/build/growth/offers/gifts#manage-gifts) lists passes beside packs.

## What the claim does

A pass goes only to a workspace without a paid subscription, one the recipient manages (`claim(giftId, { workspaceId })`). The claim switches the workspace's free-plan subscription to the pass product. Both are free, so the provider applies the switch at once with no charge, and then grants the plan's benefits every monthly cycle, as it does for any subscriber. The first month runs from the claim, so every cycle and the end date fall on the same day of the month.

A workspace on a paid plan can't take a pass, nor one that holds another pass: the claim is refused as `forbidden` (reason `already_subscribed`). The recipient claims it into another workspace they manage, or later. The claim holds the gift before anything switches, so a second claim at the same moment, a cancel or a refund is refused (`gift_claimed`) instead of leaving a pass nothing follows. A claim that fails half way switches the workspace back to the free plan. `useBilling().pass` reads the pass a workspace holds, and `isFree` is `false` while it does.

## How the pass ends

Polar schedules a product change one billing cycle ahead at most (a `next_period` change), so it can't hold a three-month end date by itself. The package keeps the end date:

1. Once the pass's last monthly cycle has begun, it schedules the return to the free plan as a `next_period` change, which the provider applies when that cycle ends. Never in the cycle before, however short the last one is: the pass would end a month early.
2. A sweep on the package's own crons checks every pass each hour, so a missed step leaves a plan running at most an hour past its end: at the end date the sweep switches the workspace back itself.

## Before it ends

Seven days before the end, the workspace's billing managers are told, in the app and by email (the `gift_pass_ending` notification kind), with one offer: keep the plan (the `gift.pass_ending` event, and the `giftPassEnding` [email template](https://nuxt-backend.dev/docs/build/email/templates)). Keeping it is an ordinary checkout of the plan. It moves the pass subscription to the paid plan in place, which replaces the scheduled return. Not keeping it needs nothing: the workspace returns to the free plan and keeps what it holds. A [quota](https://nuxt-backend.dev/docs/build/billing/subscriptions/quotas#after-a-downgrade) above the free plan's then refuses new claims until it fits again.

The billing section of `/settings` reads a pass as gifted until its end date (`data-state="gifted"`), with the same keep button, and offers no cancel: there is no card to cancel. The `gift.pass_started` and `gift.pass_ended` events (`outcome` `returned` or `kept`) are on the [activity trail](https://nuxt-backend.dev/docs/build/billing/events#on-the-activity-trail).

## Run a reverse trial

A reverse trial gives every new workspace the paid plan for a while, with no card, then drops it to the free plan. People try what the paid plan does before they decide, and keep their work either way. Mark a plan's trial as a pass:

```ts [backend/billing.catalog.ts]
plans: {
  free: { name: 'Free', prices: { month: 0 }, credits: { meter: 'credits', units: 20 }, quotas: { strips: 3 } },
  pro: {
    name: 'Pro',
    prices: { month: 1200, year: 12000 },
    credits: { meter: 'credits', units: 500 },
    quotas: { strips: 100 },
    trial: { interval: 'day', count: 14, pass: true },
  },
},
```

- **Started at sign-up.** A workspace's first free-plan subscription becomes a pass for `pro` for 14 days. Nobody is asked for a card, and nothing is charged at the end.
- **One per person.** The pass goes to the first workspace an account creates, at its first free plan. An address seen before, once plus tags and dots are taken out of its local part, gets none: the package keeps a hash of that form, not the address. Outside production, an email provider sandbox address counts whole, tag and all, so each `delivered+<label>@resend.dev` identity gets its own reverse trial; production strips the tag of those too.
- **Told before it ends.** The billing managers get the notice of a gifted pass, three days ahead, saying the trial ends, with the same keep button: an ordinary checkout of the plan. `useBilling().pass` reads it with `trial: true`, and `billing.trial_pass_started` records its start.
- **Then the free plan.** The workspace keeps everything it made. A quota above the free plan's refuses new items until it fits, as after any [downgrade](https://nuxt-backend.dev/docs/build/billing/subscriptions/quotas#after-a-downgrade).

A plan with `pass: true` sells at checkout with no trial of its own: the pass was the trial. Polar's own trial, the card-up-front kind, stays the default for `trial` without `pass`. It converts to paid on its own, and Polar's "Prevent trial abuse" setting stops repeat trials by email alias and card fingerprint. A reverse trial has no card to fingerprint, so the package's one-per-address rule does that job.

## Why it never renews

A pass carries no card, so it can't turn into a charge nobody agreed to: there is no free-to-paid conversion and no renewal notice to owe. A gift is never money either: the recipient can't cash a pass in or move it to someone else.

## What happens when…

- **A length the plan does not offer:** `send` is refused as [`invalid_input`](https://nuxt-backend.dev/docs/reference/backend/errors#invalid_input) on `months`.
- **The recipient's workspace is on a paid plan:** the claim is refused as [`forbidden`](https://nuxt-backend.dev/docs/reference/backend/errors#forbidden) with reason `already_subscribed`. They claim it into another workspace they manage, or later.
- **The recipient manages no free workspace:** the claim asks them to pick or create one first.
- **The purchase is refunded before the claim:** the pass is `refunded` and can't be claimed, like any gift.
- **The sweep misses a run:** the scheduled `next_period` change still returns the workspace to the free plan at the end of the last month.

## Limits

- **Monthly cycles only.** A pass grants the plan's monthly allowance each month, even for 12 months: the yearly grant never applies.
- **Up to an hour late.** The sweep runs every hour, so a plan can run at most an hour past its end.
- **No transfer and no cash value.** A claimed pass stays with its workspace.
- **Polar's renewal and trial reminders don't apply.** A pass has no card and no charge, so the package's own notice is the only one.

## Test it

Buy a pass on Polar's sandbox with the test card `4242 4242 4242 4242`, sign in as the recipient, and claim it. The billing section of `/settings` then reads the plan as gifted until its end date. In a backend test, check that a claim of an unknown gift is refused:

```ts [backend/passes.test.ts]
import { asUser, defineBackendTestApp } from 'nuxt-backend/test'
import { expect, test } from 'vitest'
import { api } from './_generated/api'
import schema from './schema'

const testApp = defineBackendTestApp(schema, import.meta.glob('./**/*.ts'))

test('an unknown gift is refused', async () => {
  const mo = await asUser(testApp(), { email: 'mo@panels.example' })
  await expect(mo.action(api.billing.claimGift, { giftId: 'missing' })).rejects.toMatchObject({ data: { code: 'forbidden', reason: 'not_recipient' } })
})
```

## Related

- [Polar](https://nuxt-backend.dev/docs/services/polar): the account, the sandbox and the trial settings.
- [Send, receive and manage gifts](https://nuxt-backend.dev/docs/build/growth/offers/gifts): the purchase and the claim a pass shares with packs.
- [Run a referral program](https://nuxt-backend.dev/docs/build/growth/offers/referrals): free months for a referrer, built on passes.
- [Manage subscriptions](https://nuxt-backend.dev/docs/build/billing/subscriptions): the states the billing section shows.


## Sitemap

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