---
title: "Polar"
description: "Set up Polar, the billing provider and merchant of record: the sandbox organization, the access token, the webhook, and the move to production."
canonical_url: "https://nuxt-backend.dev/docs/services/polar"
---
# Polar

> Set up Polar, the billing provider and merchant of record: the sandbox organization, the access token, the webhook, and the move to production.

Version: nuxt-backend 0.6.x · Tab: Services · 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.

Polar runs checkout, subscriptions, credits and discounts, and sells to your customers as the merchant of record. You need it for billing. Its sandbox is free.

<table>
<thead>
  <tr>
    <th>
      You need
    </th>
    
    <th>
      Time
    </th>
    
    <th>
      Cost to start
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      A Polar sandbox account now, a production account before launch
    </td>
    
    <td>
      10 minutes for the sandbox; up to 14 days for the production review
    </td>
    
    <td>
      Free. Production takes a fee per transaction
    </td>
  </tr>
</tbody>
</table>

## What it powers

<table>
<thead>
  <tr>
    <th>
      Capability
    </th>
    
    <th>
      What Polar gives
    </th>
    
    <th>
      Build pages
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        billing
      </code>
    </td>
    
    <td>
      Products, checkout, subscriptions, the customer portal and invoices
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/build/billing/setup">
        Set up billing
      </a>
      
      , <a href="https://nuxt-backend.dev/docs/build/billing/subscriptions">
        Manage subscriptions
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billing
      </code>
    </td>
    
    <td>
      Meters and credit grants, the balance behind credits
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/build/billing/credits">
        Sell credits and top-ups
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billing
      </code>
    </td>
    
    <td>
      Discounts and checkout links
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/build/growth/offers">
        Run a promotion
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        ai
      </code>
    </td>
    
    <td>
      The credit meters each metered model call spends
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/build/ai/metered-actions">
        Meter an AI action
      </a>
    </td>
  </tr>
</tbody>
</table>

The package keeps a copy of each customer's plans, features and balances in Convex, fed by Polar's webhook, so your pages never wait on Polar ([React to billing events](https://nuxt-backend.dev/docs/build/billing/events)).

## Create the account

Polar runs two separate servers: the sandbox for development and production for real money. Each has its own accounts, organizations and tokens. A token from one never works on the other.

<steps level="3">

### Sign up in the sandbox

Open [sandbox.polar.sh/start](https://sandbox.polar.sh/start), sign in with GitHub, Google or an email address, and create an organization. Name it after your app: customers see the name at checkout.

### Create an organization access token

In the organization's **Settings**, scroll to **Developers** and choose **New Token**. Give it a name, an expiry and every scope: `billing sync` creates products, benefits, meters, discounts and the webhook endpoint. Workspaces need its `members:write` and `customer_sessions:write` scopes, for team customers and each member's portal. Copy the token: Polar shows it once.

### Sign up for production when you are ready to sell

At [polar.sh/signup](https://polar.sh/signup), create the production organization the same way. Then open **Finance**, **Account**, and complete the review: your business details, the owner's identity check through Stripe Identity, and a payout account through Stripe Connect. Polar reviews within 14 days, often within 7 ([Account reviews](https://polar.sh/docs/merchant-of-record/account-reviews)). Read the [acceptable use policy](https://polar.sh/legal/acceptable-use-policy) first: Polar decides what it will sell for you.

</steps>

**Who should own it.** The person who answers for the company's money owns the production organization and its payout account. Invite the developers as members. A sandbox organization can belong to anyone on the team.

## Sandbox and test mode

The sandbox runs the same API as production, with no real money. Check out with the card `4242 4242 4242 4242`, any future expiry date and any CVC.

<table>
<thead>
  <tr>
    <th>
      <code>
        BACKEND_ENVIRONMENT
      </code>
    </th>
    
    <th>
      Polar server
    </th>
    
    <th>
      What differs
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        development
      </code>
      
      , <code>
        preview
      </code>
      
      , <code>
        sandbox
      </code>
    </td>
    
    <td>
      The sandbox, <code>
        sandbox-api.polar.sh
      </code>
    </td>
    
    <td>
      No money moves. Polar's own emails reach only members of the organization, <code>
        +
      </code>
      
       aliases included. The API allows 100 requests a minute
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        production
      </code>
    </td>
    
    <td>
      Production, <code>
        api.polar.sh
      </code>
    </td>
    
    <td>
      Real cards, real payouts, 500 requests a minute
    </td>
  </tr>
</tbody>
</table>

A sandbox organization has ids of its own, so `billing sync` writes the sandbox's and production's ids side by side in `backend/billing.generated.ts`. [Develop on real sandboxes](https://nuxt-backend.dev/docs/develop/sandboxes#billing-on-polars-sandbox) walks the first checkout.

## Keys and environment

<table>
<thead>
  <tr>
    <th>
      Variable
    </th>
    
    <th>
      Where to find it
    </th>
    
    <th>
      Dev
    </th>
    
    <th>
      Prod
    </th>
    
    <th>
      Secret
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        BILLING_ACCESS_TOKEN
      </code>
    </td>
    
    <td>
      <strong>
        Settings
      </strong>
      
      , <strong>
        Developers
      </strong>
      
      , <strong>
        New Token
      </strong>
      
      , in the organization of that server
    </td>
    
    <td>
      The sandbox organization's token, in <code>
        .env.local
      </code>
    </td>
    
    <td>
      The production organization's token, on the production deployment and in your shell for the sync
    </td>
    
    <td>
      Yes
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        BILLING_WEBHOOK_SECRET
      </code>
    </td>
    
    <td>
      Stored on the deployment by <code>
        billing sync
      </code>
      
       when it creates the endpoint
    </td>
    
    <td>
      Set by the sync
    </td>
    
    <td>
      Set by the sync
    </td>
    
    <td>
      Yes
    </td>
  </tr>
</tbody>
</table>

Both live on the Convex deployment. The Nuxt app needs neither.

## Link it

<steps level="3">

### Push the token

```bash [.env.local]
BILLING_ACCESS_TOKEN=your_sandbox_access_token
```

```bash
npx nuxt-backend env push
```

### Create the catalog and the webhook

```bash
npx nuxt-backend billing sync
```

It creates the meters, benefits, plans and credit packs of `backend/billing.catalog.ts` in the sandbox organization, and writes their ids to `backend/billing.generated.ts`. It also creates a webhook endpoint at the deployment's `/billing/events`, subscribed to every event the package handles, and stores its signing secret as `BILLING_WEBHOOK_SECRET` ([Define and sync your catalog](https://nuxt-backend.dev/docs/build/billing/catalog)).

### Reach a local deployment through a tunnel

Polar cannot reach a deployment on your machine. A cloud dev deployment needs nothing more. For a local one, run a tunnel to its HTTP origin and pass its URL:

```bash
npx nuxt-backend billing sync --webhook https://your-tunnel-host/billing/events
```

</steps>

Polar signs deliveries with Standard Webhooks for secrets created on or after 2026-09-08, and with its own HMAC before that. The package accepts both, so an older secret keeps working ([Register webhooks](https://nuxt-backend.dev/docs/ship/security/webhooks)).

## Check it

```bash
npx nuxt-backend doctor --only billing
```

<table>
<thead>
  <tr>
    <th>
      Finding
    </th>
    
    <th>
      What it checks
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/cli/diagnostics#billing-access">
        <code>
          billing-access
        </code>
      </a>
    </td>
    
    <td>
      The token in your shell reaches the organization
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/cli/diagnostics#deployment-billing-access-token">
        <code>
          deployment-billing-access-token
        </code>
      </a>
    </td>
    
    <td>
      The deployment holds a token
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/cli/diagnostics#billing-webhook-secret">
        <code>
          billing-webhook-secret
        </code>
      </a>
      
      , <a href="https://nuxt-backend.dev/docs/reference/cli/diagnostics#billing-webhook-route">
        <code>
          billing-webhook-route
        </code>
      </a>
    </td>
    
    <td>
      The endpoint exists, and the deployment's route answers it
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/cli/diagnostics#billing-team-customers">
        <code>
          billing-team-customers
        </code>
      </a>
    </td>
    
    <td>
      Workspaces bill as team customers, with the scopes they need
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/cli/diagnostics#billing-trial-abuse">
        <code>
          billing-trial-abuse
        </code>
      </a>
      
      , <a href="https://nuxt-backend.dev/docs/reference/cli/diagnostics#billing-portal">
        <code>
          billing-portal
        </code>
      </a>
      
      , <a href="https://nuxt-backend.dev/docs/reference/cli/diagnostics#billing-proration">
        <code>
          billing-proration
        </code>
      </a>
    </td>
    
    <td>
      The organization settings your catalog relies on. Each only warns
    </td>
  </tr>
</tbody>
</table>

The organization settings, and what `doctor --fix` will set, are on the [Service map](https://nuxt-backend.dev/docs/services#recommended-settings).

## Go to production

<steps level="3">

### Finish the account review

Polar holds payouts until the review passes. Start it a week or two before launch.

### Set production's token

```bash
npx convex env set --prod BILLING_ACCESS_TOKEN
```

It asks for the value. Export the same token in your shell for the next step.

### Sync the catalog to production

With the production `CONVEX_DEPLOY_KEY` in your shell:

```bash
npx nuxt-backend billing sync --env production
```

It writes the `production` ids beside the sandbox's, creates production's webhook endpoint and stores its secret. Commit `backend/billing.generated.ts` and deploy it.

### Check it

```bash
npx nuxt-backend doctor --prod
```

</steps>

Leave Polar's customer emails on: receipts, renewal reminders, failed payments and cancellations come from Polar, not from the package ([Customer emails and notifications](https://nuxt-backend.dev/docs/build/billing/events/customer-emails)).

## Costs and limits

Checked on 2026-10-25 against [Polar's fees](https://polar.sh/docs/merchant-of-record/fees):

<table>
<thead>
  <tr>
    <th>
      Plan
    </th>
    
    <th>
      Monthly
    </th>
    
    <th>
      Per transaction
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      Starter
    </td>
    
    <td>
      $0
    </td>
    
    <td>
      5% + 50¢
    </td>
  </tr>
  
  <tr>
    <td>
      Pro
    </td>
    
    <td>
      $20
    </td>
    
    <td>
      3.8% + 40¢
    </td>
  </tr>
  
  <tr>
    <td>
      Growth
    </td>
    
    <td>
      $100
    </td>
    
    <td>
      3.6% + 35¢
    </td>
  </tr>
  
  <tr>
    <td>
      Scale
    </td>
    
    <td>
      $400
    </td>
    
    <td>
      3.4% + 30¢
    </td>
  </tr>
</tbody>
</table>

- **Extra fees:** cards issued outside the US add 1.5%. A dispute costs $15 whatever its outcome. A refund does not return the fee.
- **Payouts:** Stripe's own fees apply: $2 per active month, 0.25% + 25¢ per payout, and 0.25% to 1% for currency conversion.
- **Organizations created before 2026-05-27** keep the early-member rate of 4% + 40¢, plus 0.5% on subscriptions.
- **API rate limits:** 500 requests a minute per organization in production, 100 in the sandbox. Past it, Polar answers `429` with `Retry-After`.
- **Webhooks:** Polar retries a failed delivery up to 10 times, and disables an endpoint after 10 failures in a row. `doctor` reports a disabled one, and you can [replay what it missed](https://nuxt-backend.dev/docs/ship/operate/replay).

## Data and compliance

- **Role:** Polar is the merchant of record. It sells to your customer, collects the payment and remits VAT, GST and US sales tax ([Merchant of record](https://polar.sh/docs/merchant-of-record/introduction)). You still owe your own income tax.
- **What it holds:** each customer's name, email address, billing address, payment details (through Stripe), orders, subscriptions and invoices.
- **Region:** its [privacy policy](https://polar.sh/legal/privacy) says data may be stored in the US, Canada or elsewhere outside the EEA and the UK. There is no region to choose.
- **DPA:** Polar publishes no DPA at a stable address as of 2026-10-25. Ask Polar for one before you sign customers in the EU.
- **Erasure and export:** deleting an account deletes its Polar customer with `anonymize=true`, which cancels its subscriptions and anonymizes its personal data ([Export and delete an account](https://nuxt-backend.dev/docs/build/auth/accounts/data)). Customers can export their own data from Polar's customer portal.

Name Polar in your privacy policy, and link its terms at checkout ([Privacy, GDPR and cookies](https://nuxt-backend.dev/docs/ship/compliance/privacy)). This is not legal advice.

## Related

- [Set up billing](https://nuxt-backend.dev/docs/build/billing/setup): `setupBilling`, and who may buy for a workspace.
- [Define and sync your catalog](https://nuxt-backend.dev/docs/build/billing/catalog): what `billing sync` creates.
- [Develop on real sandboxes](https://nuxt-backend.dev/docs/develop/sandboxes): the first checkout with the test card.
- [Register webhooks](https://nuxt-backend.dev/docs/ship/security/webhooks): how deliveries are verified.
- [Service map](https://nuxt-backend.dev/docs/services#recommended-settings): the organization settings `doctor` checks.


## Sitemap

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