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.
Set up
Section titled “Set up”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).
- Create the sandbox organization at sandbox.polar.sh. It is separate from production; the real organization comes later with its own token.
- 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):
pnpm create extstart --payments-setupBy hand, from backend/functions:
cp .env.example .envIn that .env, replace <your-project-id> with your Firebase project
id. Then select Polar, on the sandbox while you test:
PAYMENT_PROVIDER=polarPOLAR_SANDBOX=trueWithout PAYMENT_PROVIDER=polar the deploy runs Stripe and asks for
Stripe’s secrets.
firebase functions:secrets:set POLAR_ACCESS_TOKENpnpm seed:polarCreate 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:
firebase functions:secrets:set POLAR_WEBHOOK_SECRETpnpm firebase:deployHow the catalog maps
Section titled “How the catalog maps”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.
Good to know
Section titled “Good to know”- 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 4242works in the sandbox. - Going live: create the production organization, mint its token, seed
again, add the production webhook, and remove
POLAR_SANDBOX.