/polar:polar-migrationfrom Polar
Guides migration to Polar from Stripe Billing, Paddle, or Lemon Squeezy. Covers assisted migrations, product/pricing mapping, webhook updates, and sandbox testing.
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.
Read when SKILL.md points to them.
Polar's migration guide is the source of truth; read it before recommending anything. This skill covers what the application has to do.
Start with a plan. Before changing code, creating resources or touching billing, follow Migration plan and wait for the user to approve it.
/v1/merchant-migrations are internal to the dashboard: they are not in the API reference or the SDKs, and the application must not call them.webhook-id header under a unique constraint and make handlers idempotent. Never deduplicate on data.id: it identifies the resource, so real updates share it.external_id (passed as external_customer_id at checkout). Not email, and not the old provider's ID unless that's already the app's canonical ID. An external_id can't be changed once set.The dashboard handles connecting Stripe, importing the catalog, copying cards and switching subscriptions. The application handles the first and last stages and the events in between.
Integrate Polar checkout and webhooks first (polar-integration), passing external_customer_id on every checkout. New customers then subscribe on Polar while existing subscriptions keep renewing on Stripe. Keep the Stripe IDs in your database until nothing renews there.
During coexistence, access checks must accept a valid entitlement from either provider, and cancellations or plan changes go to whichever system bills that subscription.
The import creates or reuses Polar customers, but Polar can't know your application's customer IDs. Match each imported customer once on an exact, unique email, then set your ID on customers whose external_id is still empty. Send missing, duplicate or changed emails for review instead of guessing. Treat skipped customers and Stripe ID conflicts as unresolved: a finished import does not mean every selected customer was mapped.
import { polar } from "./polar"; // client from polar-integration
const customer = await polar.customers.get(polarCustomerId);
if (customer.external_id === null) {
await polar.customers.update(polarCustomerId, { external_id: appCustomerId });
}
Imported products are new Polar products. Map each internal plan to its new Polar product and price IDs explicitly, never by name. Imported products don't expose their Stripe IDs, so ask the user for the pairing when the code doesn't have it, and check it by interval, currency and amount. Benefits aren't imported: attach them to the imported products before the switch if access depends on them.
Polar stops each switched subscription on Stripe by canceling it immediately, without proration or a final invoice. Before switching:
Turn off Stripe's canceled-subscription email (Settings → Billing → Subscriptions and emails) and pause any Stripe automation triggered by a cancellation.
Make the Stripe customer.subscription.deleted handler ignore switched subscriptions, so it doesn't revoke access or send a cancellation email:
if (subscription.cancellation_details?.comment?.startsWith("Migrated to Polar")) {
return; // billing moved to Polar; reconcile through subscription.migrated instead
}
Handle Polar's subscription.migrated event as the cutover signal. It carries provider and provider_subscription_id. Treat it as an idempotent upsert: store the Polar subscription ID against the Stripe subscription and record Polar as the system that bills next. Don't grant or revoke access from it, and don't send a welcome email:
case "subscription.migrated":
await recordMigratedSubscription({
stripeSubscriptionId: event.provider_subscription_id,
polarSubscriptionId: event.data.id,
});
break;
Expect subscription.updated, subscription.migrated and customer.state_changed per switched subscription, in any order, and Stripe's and Polar's events can arrive in either order too. Don't treat the Stripe cancellation as churn while its migration is still being reconciled. Migration sends no subscription.created, subscription.active or subscription.resumed, there is no merchant_migration.* webhook, and the import sends no product.created, customer.created or member.created.
benefit_grant.* events follow the switch. Seat-based products grant benefits only when seats are claimed.cancel_at_period_end and ends_at set and no subscription.canceled event, because it was canceled on Stripe. At its end Polar sends subscription.canceled and subscription.revoked as usual.customer.updated followed by customer.state_changed can arrive: when the import fills in billing details on a customer you already had, when a billing address is edited during review, or when a copied card becomes the default payment method. These are not a switch. Don't grant access or record Polar as the billing system from them: subscription.migrated is the only cutover signal.Run the switch from the dashboard. It can't be undone, and subscriptions renewing within 24 hours stay on Stripe until the next attempt. While a subscription is switching, make no plan change, cancellation, pause or resume on it. Before recording Polar as the system that bills next, compare the subscription's status and current period with Stripe's. Skipped or failed subscriptions keep billing on Stripe.
Afterwards, check that every moved subscription bills only in Polar and maps to one customer and entitlement, and that paid periods, trial ends and payment methods carried over. Retire Stripe checkout and subscription code only once the cleanup gates in the migration plan are met.
Limits to know up front: Stripe accounts in India can't use the automated flow, and for a Stripe Connect platform only the subscriptions on its own account move. Subscriptions sold through Stripe Managed Payments, and those with more than one item (except a plan with one add-on), a quantity above 1, or a past-due, unpaid or paused status, need attention or stay on Stripe. Only cards are copied, real card copies need live Stripe accounts, and the Stripe key mode must match the Polar environment. Give the Stripe key only the restricted permissions the migration guide lists. A price the migration can't move is not a dead end: send the merchant to Polar support.
Follow Polar's Lemon Squeezy guide. The rules above apply. Move new sales to Polar only once the catalog is imported, the benefits are set up and the application checks license keys with Polar, so new customers buy the same products as existing subscribers. Map every Lemon Squeezy variant the application references to its imported Polar product, checked by interval, currency and amount.
The application's part differs from Stripe in three ways:
POST /v1/customer-portal/license-keys/validate with the key and the Polar organization_id. A 200 is valid. A 404 whose detail is License key is no longer active. or License key has expired. is invalid: don't ask Lemon Squeezy, because after a refund on Polar the key often still works there. Any other 404 means Polar doesn't have the key yet, so run the existing Lemon Squeezy check. Treat any other answer as an outage, not an invalid key. A saved Lemon Squeezy instance_id works as Polar's activation_id. Record which provider answered each check, so the team can see when Lemon Squeezy stops being used. Never issue new license keys to existing customers, and never import keys or activations yourself: the migration keeps each customer's key, its expiry and its activations. Keep the Lemon Squeezy fallback until every subscription has switched and Lemon Squeezy has stopped processing payments.subscription_cancelled and subscription_expired handlers ignore switched subscriptions. Handle Polar's subscription.migrated (provider is lemon_squeezy) as the cutover signal, as for Stripe.benefit_grant.created. Don't treat those as new sales.Subscriptions renewing within 24 hours stay on Lemon Squeezy; switch them again after that renewal. PayPal, Link and Cash App Pay can't move, and India-issued cards move without their mandate. Those subscriptions still switch. Polar uses another copied card for the customer if there is one; otherwise the first renewal fails and Polar asks the customer for new payment details. Never ask them to check out again.
The billing interval belongs to the product, and a product has one fixed price per currency. Monthly and yearly billing are two products:
await polar.products.create({
name: "Pro (Monthly)",
recurring_interval: "month",
prices: [{ amount_type: "fixed", price_amount: 2900, price_currency: "usd" }],
});
await polar.products.create({
name: "Pro (Yearly)",
recurring_interval: "year",
prices: [{ amount_type: "fixed", price_amount: 29000, price_currency: "usd" }],
});
Recreate benefits (license keys, file downloads, Discord roles and others) and attach them with polar.products.updateBenefits(productId, { benefits: [benefitId] }).
Create customers ahead of time if you want them in Polar before they check out:
await polar.customers.create({ external_id: appCustomerId, email, name });
Paid subscriptions can't be created through the API, and saved cards can't move between processors outside Stripe's copy. Each customer checks out on Polar, where they enter their card. Send them a checkout link created with external_customer_id.
To avoid charging twice for the same period, schedule the old subscription to cancel at the end of its period, and give the Polar checkout a trial that covers the days left, using trial_interval: "day" and trial_interval_count. Check this approach with Polar support for your case.
License keys can't be imported. Keep validating existing keys against the old provider during the transition; new purchases get Polar keys.
Run the migration in Polar's sandbox with a Stripe test-mode account first. Sandbox verifies the application side (customer mapping, subscription.migrated handling, access checks), but can't copy real cards. See polar-testing for sandbox setup and local webhook testing.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub polarsource/agent-toolkit --plugin polar6 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-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.
/setup-polarInteractive onboarding wizard to set up Polar payment integration from scratch. Use this skill when: (1) User wants to "set up Polar" or "integrate Polar" in their project; (2) User is starting fresh with Polar and needs guided setup; (3) User asks "how do I get started with Polar"; (4) User wants to add payments/subscriptions/checkout to their app using Polar; (5) User needs help creating their first Polar product and checkout. This skill walks through MCP installation, authentication, product creation, and generates framework-specific integration code.
2 plugins ship this exact skill · first indexed Dec 3, 2026