/polar:setup-polarfrom Polar
Interactive wizard that guides users through setting up Polar payment integration, including MCP installation, authentication, product creation, and framework-specific code generation.
Ships in Polar. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Interactive setup guide to get Polar payments working in your project.
Ask these three questions before anything else, and wait for the answers.
1. Do you already have a Polar organization?
POST /v1/organizations/ (a name and a slug); if the slug is taken, pick another and say which. Skip Steps 1, 2 and 4. In Step 5, create the product through the API with your access token, or in the config file if that is what the user chooses below. Start the claim before Step 6: the app's access token and the webhooks need it. To start it, ask the user for the email address they will sign in to Polar with. Keep working on what doesn't need the claim while you poll for it, and once it succeeds use the access token it returns, because the one you had stops working. When you start the claim, put the full verification_uri and the user_code in your reply to the user, copied exactly. Tool and command output is often collapsed or hidden, so the link only reaches the user if you write it in your message, and they can't claim the organization without it. Until the claim succeeds the user can't open the organization in the dashboard (it shows a 404), so don't give them a dashboard link before then. Only if the user asks to create the organization themselves, send them to https://sandbox.polar.sh/start for sandbox or https://polar.sh/start for production, and continue with Step 1 once they have it.2. Sandbox or production?
Suggest sandbox. It is a separate copy of Polar where checkout takes test cards, so you can make a test purchase and check the whole flow end to end (checkout, webhook, access) before real money is involved. Start in production only when the user asks for it; Step 9 covers going live.
3. Dashboard or config file?
There are two ways to manage products, prices and benefits, and the user chooses. Suggest the dashboard and offer the config file as the second option. If the project already has a polar.config.ts or polar.config.json, it uses a config file: don't ask.
For a config file, use the polar-config skill in place of Step 5, and refer to products by their external ID from then on.
Follow these steps in order:
First, check if the Polar MCP server is available by listing organizations: call execute with GET /v1/organizations/, or organizations_list where the server exposes one tool per operation.
If MCP tools work: Skip to Step 3.
If MCP not available: Continue to Step 2.
Polar plugin installed: the plugin already configures the Polar server (polar, plus polar-sandbox where available). Ask the user to sign in to it, preferring polar-sandbox: in Claude Code with /mcp, in Codex with codex mcp login <server>, in Cursor or Antigravity from their MCP settings, in Gemini CLI with /mcp auth <server>, and in ChatGPT when prompted to connect. Then continue with the verification below.
Otherwise, set it up with the Polar CLI. Install it with npm install -g @polar-sh/cli, then run:
polar agent setup --json
It installs the Polar plugin, with the MCP server and these skills, for Claude Code, Codex and Cursor. Run from inside one of them, it sets up only that agent and asks nothing. steps lists what it did, each with an outcome (installed, updated, unchanged or failed). polar agent setup --status --json shows what is set up without changing anything.
For any other agent, connect the MCP server by following the Polar MCP guide.
The user then signs in, preferring polar-sandbox where it is available: in Claude Code after a restart with /mcp, in Codex with codex mcp login <server>, and in Cursor from its MCP settings. The sandbox server signs in at sandbox.polar.sh and the production server at polar.sh.
Once authenticated, verify MCP works by listing organizations.
Ask the user:
Framework: What framework are you using?
Product type: What are you selling?
From here on, work in the environment chosen at the start: use the polar-sandbox server's tools for sandbox and the polar server's tools for production. With an organization you created yourself, keep calling the API with your access token instead. If only polar is available (as in ChatGPT), create sandbox products in the sandbox dashboard or with the Polar CLI instead.
List the organizations with MCP. If there are several, ask which one to use. Note its id, slug and default_presentment_currency. Signing in to the MCP server already asks a user without an organization to create one; without MCP, they can create one at:
If the user chose a config file at the start, or the project has a polar.config.ts or polar.config.json, the catalog is managed in that file and Polar rejects products created any other way. Add the product with the polar-config skill instead, and pass its external ID, not a product ID, on to Step 6.
Otherwise, create the product with MCP (POST /v1/products/). The price must be in the organization's default_presentment_currency, and the billing interval is fixed per product. Example for a monthly subscription:
{
"organization_id": "<organization id from Step 4>",
"name": "Pro Plan",
"recurring_interval": "month",
"prices": [{ "amount_type": "fixed", "price_amount": 2900, "price_currency": "<default_presentment_currency>" }]
}
Omit recurring_interval for a one-time purchase. "Both", or monthly and yearly billing, means separate products. Show the user the server, organization, name, price, currency and interval, and create the product once they confirm.
Store the returned product ID for checkout integration.
Hand off to the polar-integration skill to generate the Checkout, Customer Portal, and Webhooks endpoints for the framework selected in Step 3. Step 7 says when the Webhooks endpoint can be left out. That skill has the canonical, framework-agnostic recipes plus per-framework variations.
Before invoking it, make sure the user has these environment variables ready (use whatever loader their framework provides):
POLAR_ACCESS_TOKEN= # organization access token, created below
POLAR_WEBHOOK_SECRET= # created in Step 7
POLAR_ENVIRONMENT=sandbox # omit or set to "production" when going live
The quickest way to create the access token is the Polar CLI. Install it with npm install -g @polar-sh/cli, then ask the user to run:
polar auth login --sandbox
token=$(polar auth token --scope checkouts:write --scope customer_sessions:write) && echo "POLAR_ACCESS_TOKEN=$token" >> .env
polar auth token opens the token page in a browser with those scopes preselected, waits for the user to create the token, and prints it, so this saves it to .env without showing it. Add --scope events:write when the app sends usage events, --scope customer_meters:read when it reads a customer's balance and --scope benefits:read when it checks benefit grants.
If you created the organization yourself, do this after the claim and run it yourself, with your access token in place of a login: POLAR_ACCESS_TOKEN=<access token> POLAR_ENVIRONMENT=sandbox polar auth token --scope .... Give the user the link it prints to approve in their browser. The token belongs to the active organization and its environment: polar auth whoami --json shows which one that is, and polar auth org changes it.
Without the CLI, create the token in the sandbox or production dashboard: Settings → Access Tokens → Create token.
Pass along the product ID from Step 5, or the product's external ID with a config file, so checkout links can be tested in Step 8.
Not every app needs webhooks. They keep the app's own copy of billing state in sync: a plan column, access flags, credits stored in its database. An app that reads the customer's subscriptions, benefits or meter balance from Polar whenever it needs them has nothing to sync: leave out the Webhooks endpoint in Step 6, skip this step and the webhook check in Step 8, and tell the user why.
Start the dev server, then follow polar-testing ("Local Webhook Testing") to forward webhooks to it with the Polar CLI. It needs no tunnel and no dashboard endpoint:
polar auth login --sandbox, which opens a browser..env with polar webhook listen --print-secret, then restart the dev server.polar webhook listen <port>/<webhook-path> in the background, using the path from the route generated in Step 6. Pass --org <id from Step 4> if the account has several organizations.polar webhook trigger order.paid --json. Success is exit 0 with a 2xx delivery.status. On a failure it exits with status 1, and delivery.body or delivery.failure says why; fix the handler and repeat. If there is no delivery, check the listen output.When deploying, create a webhook endpoint for the public URL in the dashboard (Settings → Webhooks) or with MCP (url, format: "raw" and the events: order.paid, subscription.created and subscription.canceled). Use that endpoint's secret as POLAR_WEBHOOK_SECRET in the deployed environment. The MCP response contains the secret, so tell the user where to copy it rather than repeating it.
4242 4242 4242 4242 and an email address on a real domain. Polar rejects @example.com and other addresses that can't receive mail.polar webhook listen shows order.paid with a 2xx status from the handler.Once basic setup works, suggest:
external_customer_id from the logged-in user when creating checkouts.POLAR_ENVIRONMENT=production. Then submit the organization for review in the dashboard; checkouts are blocked until it can accept payments.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
6 skills in this plugin
/polar-configManage a Polar catalog as code with a billing config file (polar.config.ts or polar.config.json) and the "polar config" commands of the Polar CLI. Use this skill whenever the user wants to: (1) create or edit a Polar billing config; (2) add or change meters, benefits, products or prices in it; (3) write the config from their app's pricing; (4) check what would change, save it to the draft or publish it with polar config validate, draft or publish; (5) fix an issue those commands report; (6) retire a meter, benefit or product with deprecated and polar config prune; (7) generate the config's names for application code with polar config generate. To run these commands from CI, use the polar-config-ci skill.
/polar-config-ciSet up CI for a Polar billing config (polar.config.ts or polar.config.json). Use this skill whenever the user wants to: (1) show the changes a pull request makes to the config as a comment on it, with polar config validate --pr-comment; (2) save the config to the draft or publish it when a pull request merges; (3) create the access tokens and repository secrets CI needs for that; (4) fix a config workflow that fails in GitHub Actions or Buildkite.
/polar-integrationAdd Polar billing to a TypeScript/JavaScript app using the @polar-sh/sdk package. Use this skill whenever the user wants to add a Checkout endpoint, a Customer Portal endpoint, or a Webhooks endpoint for Polar to any framework — Next.js, Express, Hono, Astro, SvelteKit, Remix, TanStack Start, Nuxt, Fastify, Elysia, Deno, Supabase Edge Functions, Cloudflare Workers, Bun, etc./polar-migrationGuide for migrating to Polar from other payment platforms (Stripe Billing, Paddle, Lemon Squeezy). Use this skill when: (1) Planning a migration from another payment provider to Polar; (2) Moving customers, subscriptions and saved cards with Polar's Stripe or Lemon Squeezy migration; (3) Running both billing systems during the transition; (4) Mapping products and pricing between platforms; (5) Updating webhook and access handling for migrated subscriptions; (6) Communicating the migration to customers; (7) Testing the migration in sandbox first.
/polar-testingGuide for testing Polar payment integrations using the sandbox environment. Use this skill when: (1) Setting up the Polar sandbox for development; (2) Testing checkout flows without real payments; (3) Using Stripe test cards with Polar; (4) Writing integration tests for payment flows; (5) Testing webhooks locally with the Polar CLI (`polar webhook listen`, `polar webhook trigger`) and generating webhook fixtures; (6) Mocking Polar in unit tests; (7) Setting up CI/CD pipelines with Polar sandbox; (8) Debugging payment issues in sandbox.
npx claudepluginhub polarsource/agent-toolkit-source --plugin polar2 plugins ship this exact skill · first indexed Dec 3, 2026