Skip to content
Get the kit

Polar

Polar is a merchant of record: it is the legal seller in each transaction and owns global sales tax, VAT, and GST, registration, filing, and remittance included. There is no tax configuration on your side, which makes it a strong choice for a solo developer selling worldwide.

Pick polar at the wizard’s Payment provider question (--payments polar): your clone then keeps the Polar code next to Stripe’s. The wizard removes it on any other answer; to add Polar to a clone configured for another provider, copy its files back from the kit first (Switch providers lists them).

  1. Create the sandbox organization at sandbox.polar.sh. It is separate from production; the real organization comes later with its own token.
  2. Get the access token. Dashboard → Settings → create an Organization Access Token (it starts with polar_oat_).

The wizard’s payments step does the rest, except creating the webhook: it prints the webhook URL, you add it in the dashboard (Settings → Webhooks, format Raw), and the step stores the secret you paste. It stops with the same command when the token or the Blaze plan is missing (what it asks):

Terminal window
pnpm create extstart --payments-setup

By hand, from backend/functions:

Terminal window
cp .env.example .env

In that .env, replace <your-project-id> with your Firebase project id. Then select Polar, on the sandbox while you test:

backend/functions/.env
PAYMENT_PROVIDER=polar
POLAR_SANDBOX=true

Without PAYMENT_PROVIDER=polar the deploy runs Stripe and asks for Stripe’s secrets.

Terminal window
firebase functions:secrets:set POLAR_ACCESS_TOKEN
Terminal window
pnpm seed:polar

Create the webhook. Dashboard → Settings → Webhooks → add your function URL ending in /api/billing/webhook, format Raw. The function URL is https://us-central1-<project-id>.cloudfunctions.net/api. Copy the endpoint secret, store it, deploy:

Terminal window
firebase functions:secrets:set POLAR_WEBHOOK_SECRET
Terminal window
pnpm firebase:deploy

Polar has no lookup-key field, so the script stores the kit’s plan keys (premium_monthly, premium_yearly, …) in each product’s metadata and the backend resolves them from there. One product per billing cadence is Polar’s model; the seed creates six. Change prices freely in the dashboard; the metadata keys are what must stay.

Trials are product configuration. The seed gives the recurring plans a trial of BILLING_TRIAL_DAYS days (from the environment, or backend/functions/.env on the Firebase stack), and none when it is 0, the default. Keep it equal to the days of a trial: { days, card: true } in paywall.config.ts. Checkout offers a product’s trial only while BILLING_TRIAL_DAYS is above 0, so a product that already carries one gives no trial when the paywall offers none. The backend also enforces trial-once per user, and Polar adds its own trial-abuse prevention on top.

  • Checkout is a Polar-hosted page; the extension just opens the URL the backend returns. No provider code ships in the extension.
  • The customer portal resolves by your user’s id, and Polar answers 422 until a first purchase creates the customer; the kit maps this to its own 409 (no billing account).
  • The test card 4242 4242 4242 4242 works in the sandbox.
  • Going live: create the production organization, mint its token, seed again, add the production webhook, and remove POLAR_SANDBOX.