# Analytics Source: https://polar.sh/docs/features/analytics Understand how every metric in your dashboard is calculated. Polar ships with a built-in analytics dashboard so you can stay focused on growing the business rather than wiring up reporting. Each section below maps to one of the dashboards on the **Analytics** page and walks through what its metrics actually mean. ## How metrics are bucketed When you pick a date range, Polar splits it into equal-width **intervals** — one hour, one day, one week, one month, or one year each — and aggregates every metric inside each interval. Each interval (sometimes called a "bucket") is one point on the chart and one row in the API response. ## Subscriptions * **Monthly Recurring Revenue (MRR)** — Sum of every ongoing subscription's net amount, normalized to a monthly rate (yearly plans are divided by 12). Trialing subscriptions are excluded. Paused and past-due subscriptions are included: a subscriber counts towards MRR until their subscription actually ends. * **Committed MRR** — MRR restricted to subscriptions still inside a committed billing period. Subscriptions that have been canceled but are running out the clock until period end are excluded. As with MRR, paused and past-due subscriptions are included. * **Trial MRR Including Canceled Trials** — Monthly-normalized amount of every subscription currently in a trial, including trials that have already been canceled. * **Trial Committed MRR** — Trial MRR for trials still inside their committed billing period (i.e. canceled trials are excluded). * **Active Subscriptions** — Count of ongoing subscriptions at the end of each interval, based on when each subscription started and ended rather than its current status. A subscription counts until it actually ends: those that have been canceled but are running out the clock until period end, as well as paused and past-due subscriptions, are all still included. * **New Subscriptions** — Subscriptions whose first paid order falls inside the interval. Each subscription is counted once, at creation. * **Committed Subscriptions** — Active subscriptions that have not been canceled, or whose cancellation date is after the interval. These are the subscriptions you can reasonably expect to renew. * **Renewed Subscriptions** — Number of orders with billing reason `subscription_cycle` in the interval — i.e. renewals on existing subscriptions. * **Average Revenue Per User (ARPU)** — MRR divided by the count of distinct paying subscribers in the interval (trials excluded). Returns 0 when there are no paying subscribers. * **Lifetime Value (LTV)** — Estimated revenue per customer over their lifetime: `(ARPU - cost per user) / churn rate`. Returns 0 when churn rate is 0. * **New Subscriptions Revenue** — Gross revenue from the first paid order on every new subscription created in the interval. * **Renewed Subscriptions Revenue** — Gross revenue from subscription renewal orders in the interval. ## Cancellations * **Canceled Subscriptions** — Subscriptions where the customer triggered a cancellation in the interval. The subscription itself may still be active until the end of the paid period. * **Churned Subscriptions** — Subscriptions whose paid period actually ended inside the interval. This is "real" churn — the moment access stops. * **Churn Rate** — Churned subscriptions in the interval divided by the active subscription base at the start of the interval, expressed as a percentage. * **Active Subscriptions** — Same definition as in the [Subscriptions](#subscriptions) dashboard. Shown here to contextualise churn against the underlying base. * **Committed Subscriptions** — Same definition as in the [Subscriptions](#subscriptions) dashboard. * **Cancellation reasons** — Stacked chart of canceled subscriptions broken down by the reason the customer picked at cancellation: *too expensive*, *missing features*, *switched service*, *unused*, *customer service*, *low quality*, *too complex*, or *other* (free-form or no reason given). ## One-Time Products * **One-Time Products** — Number of completed orders for non-recurring products in the interval. Subscription orders are not included. * **One-Time Products Revenue** — Gross revenue (subtotal before fees) from those one-time product orders. ## Orders * **Revenue** — Gross revenue from every completed order in the interval: one-time purchases, new subscription orders, and renewal orders. Computed on the order subtotal, before Polar fees and tax. * **Orders** — Total number of completed orders in the interval, regardless of billing reason. * **Average Order Value (AOV)** — Revenue divided by the number of orders. Returns 0 when there are no orders. * **Cumulative Revenue** — Running total of revenue from the start of the selected range up to and including the current interval. ## Checkouts * **Checkouts Conversion** — Succeeded checkouts divided by total checkouts created, as a percentage. Returns 0 when no checkouts were created. * **Checkouts** — Every checkout session created in the interval, regardless of outcome (succeeded, expired, or abandoned). * **Succeeded Checkouts** — Checkouts that reached the `succeeded` status, meaning they resulted in an order. ## Net Revenue * **Net Revenue** — Revenue after deducting Polar's platform fee and the payment processor's fee on each order. This is the amount actually paid out to you. * **Net Average Order Value** — Net revenue divided by the number of orders in the interval. * **Net Cumulative Revenue** — Running total of net revenue from the start of the selected range up to the current interval. * **New Subscriptions Net Revenue** — Net revenue from the first paid order on every new subscription. Shown when your organization sells recurring products. * **Renewed Subscriptions Net Revenue** — Net revenue from subscription renewal orders. Shown when your organization sells recurring products. * **One-Time Products Net Revenue** — Net revenue from one-time product orders. Shown when your organization sells one-time products. ## Costs The Costs dashboard is powered by [Cost Insights](/docs/features/cost-insights/introduction) — you'll only see data here once you start sending events with a `_cost` annotation. * **Costs** — Total operating costs ingested via Cost Insights in the interval. Stored at sub-cent precision so per-event costs (e.g. token-level inference costs) aren't rounded away. * **Cost Per User** — Cumulative costs in the selected range divided by the count of active subscribers. Returns 0 when there are no active subscribers. * **Gross Margin** — Cumulative revenue minus cumulative costs over the selected range. * **Gross Margin %** — Gross margin expressed as a percentage of cumulative revenue. Returns 0 when cumulative revenue is 0. * **Cashflow** — Revenue minus costs for the interval itself (not cumulative). Useful for spotting periods where costs outpaced revenue. # Credits Benefit Source: https://polar.sh/docs/features/benefits/credits Create your own Credits benefit The Credits benefit allows you to credit a customer's Usage Meter balance. ![](https://mintcdn.com/polar/Ut0vPUvE1pIdMcH2/assets/features/benefits/credits/credits.light.png?fit=max\&auto=format\&n=Ut0vPUvE1pIdMcH2\&q=85\&s=95a964aa562069bd58a551e44c757459) ## Crediting Usage Meter Balance The Credits benefit will credit a customer's Usage Meter balance at different points in time depending on the type of product purchased. ### Subscription Products The customer will be credited the amount of units specified in the benefit at the beginning of every subscription cycle period — monthly or yearly. If the product has a [meter cycle](/docs/features/usage-based-billing/billing#meter-cycle), credits are granted at the start of every meter period instead. For example, a yearly plan with a monthly meter cycle grants credits every month. ### One-Time Products The customer will be credited the amount of units specified in the benefit once at the time of purchase. ## Rollover unused credits You can choose to rollover unused credits to the next billing cycle. This means that if a customer doesn't use all of their credits in a given billing cycle, the remaining credits will be added to their balance for the next billing cycle. With a [meter cycle](/docs/features/usage-based-billing/billing#meter-cycle), unused credits roll over to the next meter period. To enable this feature, check the "Rollover unused credits" checkbox when creating or editing the Credits benefit. > [!NOTE] > > If you change the rollover setting for a benefit, it will only apply to new > credits issued after the change. Existing credits will not be affected. # Custom Benefit Source: https://polar.sh/docs/features/benefits/custom Create your own Custom benefit You can add a simple, custom benefit, which allows you to attach a note to paying customers. ## **Custom Notes** Secret message only customers can see, e.g [Cal.com](http://Cal.com) link, private email for support etc. For custom integrations you can also distinguish benefits granted to customers to offer even more bespoke user benefits. ## Sharing links and instructions after purchase Because the **Private note** supports Markdown, a Custom benefit is the simplest way to deliver post-purchase content without writing any code: * A private link (Calendly, Notion, …) * Onboarding instructions or a welcome message * A coupon code for a partner service Set the **Description** to the title customers will see (e.g. *"Your onboarding link"*), put the link or instructions in **Private note**, and attach the benefit to a product. The rendered Markdown appears on the checkout success page, in the purchase confirmation email, and in the [Customer Portal](/docs/features/customer-portal). > [!NOTE] > > Previously, we recommended using a Custom benefit without a note as a way to > grant access to software or SaaS features — decoupling entitlements from > checking directly on products. We now recommend the > [Feature Flag](/docs/features/benefits/feature-flags) benefit for this purpose, as > it's purpose-built for feature gating and supports key-value metadata. # Automate Discord Invites & Roles Source: https://polar.sh/docs/features/benefits/discord-access Sell Discord access & roles with ease ![](https://mintcdn.com/polar/Ut0vPUvE1pIdMcH2/assets/features/benefits/discord/hero.png?fit=max\&auto=format\&n=Ut0vPUvE1pIdMcH2\&q=85\&s=184ffa11c392303eecdec13a1c91ae5e) Automating Discord server invites and roles for customers or subscribers is super easy and powerful with Polar. * Fully automated Discord server invitations * You can even setup multiple Discord servers, or... * Offer different roles for different subscription tiers or products ## Create Discord Benefit ![](https://mintcdn.com/polar/Ut0vPUvE1pIdMcH2/assets/features/benefits/discord/create.light.png?fit=max\&auto=format\&n=Ut0vPUvE1pIdMcH2\&q=85\&s=e2045a8cbc6eb7bac1168682a29456dd) Click on `Connect your Discord server`. You'll be redirected to Discord where you can grant the Polar App for your desired server. Next, you'll be prompted to approve the permissions our app requires to function. It needs all of them. ### **Manage Roles** Access to your Discord roles. You'll be able to select which ones to grant to your customers later. ### **Kick Members** Ability to kick members who have this benefit and connected Discord with Polar. ### **Create Invite** Ability to invite members who purchase a product or subscribes to a tier with this benefit. You're now redirected back to Polar and can finish setting up the Discord benefit on our end. ### **Connected Discord server** The Discord server you connected cannot be changed. However, you can create multiple benefits and connect more Discord servers if you want. ### **Granted role** Which Discord role do you want to grant as part of this benefit? ## Adding Benefit to Product Head over to the product you want to associate this new Discord benefit with. You should be able to toggle the benefit in the bottom of the Edit Product form. # Feature Flag Benefit Source: https://polar.sh/docs/features/benefits/feature-flags Gate access to features using simple, API-driven feature flags The Feature Flag benefit is a lightweight way to grant feature access to customers without any external service integration. If a customer has the benefit grant, they have access — it's that simple. ## Use Cases * Gate premium features behind a subscription tier * Offer early access or beta features to select customers * Differentiate access levels across product tiers * Control API rate limit tiers or usage quotas in your application ## Create Feature Flag Benefit 1. Go to [`Benefits`](https://polar.sh/to/dashboard/products/benefits) 2. Click `+ New Benefit` to create a new benefit 3. Choose `Feature Flag` as the `Type` 4. Give it a short description (e.g. "Premium Features" or "Beta Access") ### Metadata You can optionally attach key-value metadata to a feature flag benefit. This is useful for passing additional context to your application, for example: * `role` → `editor` * `max_upload_size` → `10` * `priority` → `elevated` Metadata can be configured when creating or editing the benefit in the dashboard using the **Add Metadata** button. ## Integration The recommended way to check if a customer has a feature flag benefit is through the [Customer State](/docs/integrate/customer-state) API or the [`customer.state_changed`](/docs/api-reference/current/customer_state_changed) webhook. The customer state object includes all granted benefits. Simply check if the customer has a benefit grant for your feature flag benefit to determine access. ### Lifecycle * **Subscriptions**: The feature flag is granted at the start of each subscription cycle and automatically revoked when the subscription is cancelled. * **One-time purchases**: The feature flag is granted at the time of purchase with lifetime access. # Automate Customer File Downloads Source: https://polar.sh/docs/features/benefits/file-downloads Offer digital file downloads with ease ![](https://mintcdn.com/polar/Ut0vPUvE1pIdMcH2/assets/features/benefits/file-downloads/hero.png?fit=max\&auto=format\&n=Ut0vPUvE1pIdMcH2\&q=85\&s=ddcefae9f5a02b807dd50dda51fa18cc) ## Sell Digital Products You can easily offer customers and subscribers access to downloadable files with Polar. * Up to 10GB per file * Upload any type of file - from ebooks to full-fledged applications * SHA-256 checksum validation throughout for you and your customers (if desired) * Customers get a signed & personal downloadable URL ## Create Downloadable Benefit 1. Go to [`Benefits`](https://polar.sh/to/dashboard/products/benefits) 2. Click `+ Add Benefit` to create a new benefit 3. Choose `File Downloads` as the `Type` You can now upload the files you want to offer as downloadables for customers. 1. Drag & drop files to the dropzone (`Feed me some bytes`) 2. Or click on that area to open a file browser ### Change filename Click on the filename to change it inline. ### Change order of files You can drag and drop the files in the order you want. ### Review SHA-256 checksum Click on the contextual menu dots and then `Copy SHA-256 Checksum` ### Delete a file Click on the contextual menu dots and then `Delete` in the menu. **Active subscribers & customers will lose access too!** Deleting a file permanently deletes it from Polar and our S3 buckets except for the metadata. Disable the file instead if you don't want it permanently deleted. ### Disable & Enable Files You can disable files at any point to prevent new customers getting access to it. **Existing customers retain their access** Customers who purchased before the file was disabled will still have access to legacy files. Only new customers will be impacted. **Enabling or adding files grants access retroactively** In case you add more files or re-enable existing ones, all current customers and subscribers with the benefit will be granted access. ## Flagged Files Polar scans every uploaded file for malware. If a scan detects a threat, the file is marked with a **Malicious file detected** badge in your dashboard and every member of your organization receives an email. > [!WARNING] > > **Customers lose access to flagged files** > > A flagged file is hidden from the customer portal and can no longer be downloaded, by your customers or by you. Other files in the benefit are not affected. ### What you can do Most detections are false positives on legitimate software, often unsigned installers, packed executables or tools that modify other programs. Start by finding out which case you are in. 1. **Check the detection.** The email names the detected threat. Copy the file's SHA-256 checksum from the contextual menu and look it up on a multi-engine scanner such as [VirusTotal](https://www.virustotal.com) to see which antivirus engines flag it. 2. **If the file may really be infected**, rebuild it on a clean machine, upload the new version and delete the flagged file. Every upload is scanned again. 3. **If you believe it is a false positive**, report the file to the antivirus vendors that flag it through their false positive forms. Signing your executables with a code signing certificate also makes false positives less likely. Once a vendor clears the file, upload it again. 4. **Contact [Polar support](mailto:support@polar.sh)** with the file name and checksum. We can request a review of the scan result from our malware scanning provider. > [!NOTE] > > Uploading the exact same file again usually gets it flagged again, until the antivirus vendors have updated their detections. # Automate Private GitHub Repo(s) Access Source: https://polar.sh/docs/features/benefits/github-access Sell premium GitHub repository access with ease ![](https://mintcdn.com/polar/Ut0vPUvE1pIdMcH2/assets/features/benefits/github/hero.png?fit=max\&auto=format\&n=Ut0vPUvE1pIdMcH2\&q=85\&s=12d4147b094c8f5b3d002d600757ceb0) ## Sell GitHub Repository Access With Polar you can seamlessly offer your customers and subscribers automated access to private GitHub repositories. * Fully automated collaborator invites * Unlimited repositories (via multiple benefits) from your organization(s) * Users get access upon subscribing & removed on cancellation * Or get lifetime access upon paying a one-time price (product) ### **Use cases** * Sponsorware * Access to private GitHub discussions & issues for sponsors * Early access to new feature development before upstream push * Premium educational materials & code * Self-hosting products * Courses, starter kits, open core software & more... ## Create GitHub Repository Benefit 1. Go to [`Benefits`](https://polar.sh/to/dashboard/products/benefits) 2. Click `+ New Benefit` to create a new benefit 3. Choose `GitHub Repository Access` as the `Type` You first need to `Connect your GitHub Account` and install a dedicated Polar App for this benefit across the repositories you want to use it with. * Click `Connect your GitHub Account` > [!NOTE] > > **Why do I need to connect GitHub again and install a separate app?** > > This feature requires permission to manage repository collaborators. GitHub Apps does not support progressive permission scope requests. So instead of requesting this sensitive permission from all users (unnecessarily) in our core GitHub Login this feature uses a standalone app instead. Once you've authorized our dedicated GitHub App for this feature you'll be redirected back to Polar and the benefit form - now connected and updated. ### **Repository** Select the desired repository you want to automate collaborator invites for. > [!NOTE] > > **Why can I only connect organization repositories vs. personal ones?** > > GitHub does not support granular permissions for collaborators on personal repositories - granting them all write permissions instead. Since collaborators would then be able to push changes, releases and more, we do not support personal repositories by default.Want this still? Reach out to us and we can enable it. ### **Role** Select the role you want to grant collaborators. * **Read (Default & Highly recommended)** * Triage * Write * Maintain * Admin Read access (read-only) is what 99.9% of cases should use and the others are highly discouraged unless you have special use cases & absolutely know the impact of these permissions. Checkout the [GitHub documentation](https://docs.github.com/en/organizations/managing-user-access-to-your-organizations-repositories/managing-repository-roles/repository-roles-for-an-organization#permissions-for-each-role) for reference. > [!NOTE] > > Anyone with read access to a repository can create a pull request [(source)](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request). > [!NOTE] > > **Additional Costs for Paid GitHub Organizations** > > GitHub treats collaborators as a seat and they will incurr charges accordingly to your billing unless you're using a free GitHub organization plan. So make sure to confirm you're on a free plan OR charge sufficiently to offset the costs you'll need to pay to GitHub. # Automated Benefits Source: https://polar.sh/docs/features/benefits/introduction Polar offers built-in benefit (entitlements) automation for common upsells within the developer & designer ecosystem with more to come. * [**Credits**](/docs/features/benefits/credits). A simple benefit that allows you to credit a customer's Usage Meter balance. * [**License Keys**](/docs/features/benefits/license-keys). Software license keys that you can customize the branding of. * [**Feature Flags**](/docs/features/benefits/feature-flags). Simple, API-driven feature access flags with optional metadata. * [**File Downloads**](/docs/features/benefits/file-downloads). Downloadable files of any kind up to 10GB each. * [**GitHub Repository Access**](/docs/features/benefits/github-access). Automatically invite subscribers to private GitHub repo(s). * [**Discord Invite**](/docs/features/benefits/discord-access). Automate invitations and granting of roles to subscribers and customers. * [**Shared Slack Channel**](/docs/features/benefits/slack-shared-channel). Give customers a shared Slack channel via Slack Connect. ## Product & Subscription Benefits Product and subscription benefits are standalone resources in Polar - connected to one or many products or subscription tiers. This approach is a bit different from other platforms, but offers many advantages: * Easy to enable the same benefit across multiple products & subscriptions * You can change a benefit in one place vs. many * No duplicate data or work (error prone) * More intuitive UI for you and your customers **How customers get access to benefits:** * ✅ Active subscribers of tiers with the benefit enabled * ✅ Customers who bought a product with the benefit (lifetime access) * ❌ Subscribers with an expired subscription (cancelled) * ❌ Users who are not customers ## Creating & Managing Benefits You can manage benefits in two ways: 1. Directly within a product create/edit form 2. Or via `Benefits` in your dashboard # Automate Customer License Key Management Source: https://polar.sh/docs/features/benefits/license-keys Sell license key access to your service, software or APIs with ease ![](https://mintcdn.com/polar/Ut0vPUvE1pIdMcH2/assets/features/benefits/license-keys/hero.jpeg?fit=max\&auto=format\&n=Ut0vPUvE1pIdMcH2\&q=85\&s=179f2df948e4835f6e8e160b31507c3a) You can easily sell software license keys with Polar without having to deal with sales tax or hosting an API to validate them in real-time. License keys with Polar come with a lot of powerful features built-in. * Brandable prefixes, e.g `POLAR_*****` * Expiration after `N` days, months or years for one-time purchases * Automatic revocation when a subscription ends * Limited number of user activations, e.g devices * Custom validation conditions * Usage quotas per license key ## Create License Key Benefit 1. Go to [`Benefits`](https://polar.sh/to/dashboard/products/benefits) 2. Click `+ New Benefit` to create a new benefit 3. Choose `License Keys` as the `Type` ### Custom Branding Make your license keys standout with brandable prefixes, e.g `MYAPP_` ### Expiration How long a license key stays valid depends on how the customer got it: * **One-time purchases:** if you enable expiration on the benefit, the key expires `N` days, months or years after the purchase. * **Subscriptions:** the expiration setting is ignored. Keys granted through a subscription have no `expires_at`, stay valid for as long as the subscription is active, and are revoked when it ends. This means the same benefit can produce keys with an expiry date (one-time products) and keys without one (subscription products). > [!NOTE] > > For subscription products, check the key's `status` when validating rather than `expires_at`. A revoked key fails validation. > [!WARNING] > > Polar manages `expires_at`. Whenever the benefit or the customer's grant is updated, Polar re-applies the benefit's expiration to the key, or removes it for subscription keys. A manual change to `expires_at` through the API will be overwritten. ### Activation Limits You can require license keys to be activated before future validation. A great feature in case you want to limit license key usage to a certain number of devices, IPs or other conditions. **Enable user to deactivate instances via Polar.** Instead of building your own custom admin for customers to manage their activation instances - leave it to Polar instead. ### Usage Limit Offering OpenAI tokens or anything else with a variable usage cost? You can set a custom usage quota per license key and increment usage upon validation. ## Customer Experience Once customers buy your product or subscribes to your tier, they will automatically receive a unique license key. It's easily accessible to them under their purchases page. Customers can: * View & copy their license key * See expiration date (if applicable) * See usage left (if applicable) * Deactivate activations (if enabled) * Rotate their license key if it is exposed or compromised ### Rotate License Keys If a key is exposed or compromised, merchants can rotate it from the benefit license keys page in the dashboard, or via `POST /v1/license-keys/{id}/rotate`. Customers can rotate their own key from the customer portal, or via `POST /v1/customer-portal/license-keys/{id}/rotate`. Only keys in `granted` or `disabled` status can be rotated; rotating a revoked key returns a `400` error. Rotation generates a new key string on the same license key record. The previous key stops validating immediately. Status, usage, limits, expiry, and activations are preserved. After rotating, copy the new key from the customer portal or share it from the dashboard. ## Integrate API It's super easy and straightforward to integrate Polar license keys into your application, library or API. ### Activate License Keys (Optional) In case you've setup license keys to have a maximum amount of activation instances, e.g user devices. You'll then need to create an activation instance prior to validating license keys / activation. **No activation limit?** You can skip this step. ```bash Terminal theme={null} curl -X POST https://api.polar.sh/v1/customer-portal/license-keys/activate -H "Content-Type: application/json" -d '{ "key": "1C285B2D-6CE6-4BC7-B8BE-ADB6A7E304DA", "organization_id": "fda84e25-7b55-4d67-916d-60ead04ff61f", "label": "hello", "conditions": { "major_version": 1 }, "meta": { "ip": "84.19.145.194" } }' ``` **key** `string` *required* Replace with the users license key (from input in your app). **organization_id** `string` *required* Replace with your organization ID here found in your settings. **label** `string` *required* Set a label to associate with this specific activation. **conditions** `object` JSON object with custom conditions to validate against in the future, e.g IP, mac address, major version etc. **meta** `object` JSON object with metadata to store for the users activation. #### **Response (200 OK)** ```json theme={null} { "id": "b6724bc8-7ad9-4ca0-b143-7c896fcbb6fe", "license_key_id": "508176f7-065a-4b5d-b524-4e9c8a11ed63", "label": "hello", "meta": { "ip": "84.19.145.194" }, "created_at": "2024-09-02T13:48:13.251621Z", "modified_at": null, "license_key": { "id": "508176f7-065a-4b5d-b524-4e9c8a11ed63", "organization_id": "fda84e25-7b55-4d67-916d-60ead04ff61f", "user_id": "d910050c-be66-4ca0-b4cc-34fde514f227", "benefit_id": "32a8eda4-56cf-4a94-8228-792d324a519e", "key": "1C285B2D-6CE6-4BC7-B8BE-ADB6A7E304DA", "display_key": "****-E304DA", "status": "granted", "limit_activations": 3, "usage": 0, "limit_usage": 100, "validations": 0, "last_validated_at": null, "expires_at": "2026-08-30T08:40:34.769148Z" } } ``` ### Validate License Keys For each session of your premium app, library or API, we recommend you validate the users license key via the [`/v1/customer-portal/license-keys/validate`](/docs/api-reference/current/customer_portal/validate-license-key) endpoint. ```bash Terminal theme={null} curl -X POST https://api.polar.sh/v1/customer-portal/license-keys/validate -H "Content-Type: application/json" -d '{ "key": "1C285B2D-6CE6-4BC7-B8BE-ADB6A7E304DA", "organization_id": "fda84e25-7b55-4d67-916d-60ead04ff61f", "activation_id": "b6724bc8-7ad9-4ca0-b143-7c896fcbb6fe", "conditions": { "major_version": 1 }, "increment_usage": 15 }' ``` **key** `string` *required* Replace with the users license key (from input in your app). **organization_id** `string` *required* Replace with your organization ID here found in your settings. **activation_id** `string` The activation ID to validate - required in case activations limit is enabled and used (above). **conditions** `object` In case of activation instances. Same exact JSON object as upon registration of the activation. **increment_usage** `integer` In case you want to increment usage upon validation. #### **Response (200 OK)** ```json theme={null} { "id": "508176f7-065a-4b5d-b524-4e9c8a11ed63", "organization_id": "fda84e25-7b55-4d67-916d-60ead04ff61f", "user_id": "d910050c-be66-4ca0-b4cc-34fde514f227", "benefit_id": "32a8eda4-56cf-4a94-8228-792d324a519e", "key": "1C285B2D-6CE6-4BC7-B8BE-ADB6A7E304DA", "display_key": "****-E304DA", "status": "granted", "limit_activations": 3, "usage": 15, "limit_usage": 100, "validations": 5, "last_validated_at": "2024-09-02T13:57:00.977363Z", "expires_at": "2026-08-30T08:40:34.769148Z", "activation": { "id": "b6724bc8-7ad9-4ca0-b143-7c896fcbb6fe", "license_key_id": "508176f7-065a-4b5d-b524-4e9c8a11ed63", "label": "hello", "meta": { "ip": "84.19.145.194" }, "created_at": "2024-09-02T13:48:13.251621Z", "modified_at": null } } ``` Validate `benefit_id` in case of multiple license keys We require `organization_id` to be provided to avoid cases of Polar license keys being used across Polar organizations erroneously. Otherwise, a valid license key for one organization could be used on another.However, you are required to validate and scope license keys more narrowly within your organization if necessary. Offering more than one type of license key? Be sure to validate their unique benefit_id in the responses. # Shared Slack Channel Source: https://polar.sh/docs/features/benefits/slack-shared-channel Give customers a shared Slack channel via Slack Connect The Shared Slack Channel benefit automatically provisions a dedicated Slack channel for each customer and shares it with their workspace through [Slack Connect](https://slack.com/connect). * A new channel is created in your Slack workspace for every customer who gets the benefit * The channel is shared with the customer's own workspace — no need for them to join yours * Channels can be archived automatically when the benefit is revoked > [!NOTE] > > The Shared Slack Channel benefit is currently in preview. If you're on a paid plan, you'll be able > to create a Shared Slack Channel benefit. ## Create Shared Slack Channel Benefit 1. Go to [`Benefits`](https://polar.sh/to/dashboard/products/benefits) 2. Click `+ New Benefit` to create a new benefit 3. Choose `Shared Slack Channel` as the `Type` ### **Connect your Slack workspace** The first time you create this benefit, you'll be prompted to connect the Slack workspace where channels should be created. You can reuse the same workspace across multiple benefits. ### **Channel name template** Channel names are generated from a template, so every customer's channel follows the same naming convention. The template supports the following placeholders: * `{customer_name}` — the customer's name * `{customer_email_local}` — the local part of the customer's email (everything before the `@`) * `{metadata.}` — any value stored in the customer's metadata, e.g. `{metadata.company}` For example, `support-{customer_email_local}` produces a channel like `support-jane` for `jane@acme.com`. ### **Other options** * **Private channel** — create the channel as private. Recommended, and enabled by default. * **Welcome message** — an optional message posted to the channel right after it's created. * **Team invitees** — members of your Slack workspace to automatically invite to every channel created for this benefit. * **Archive on revoke** — archive the channel when the benefit is revoked (for example, when a subscription is canceled). Enabled by default. ## Customer Experience When a customer is granted the benefit, they're asked for the email address of an admin in their own Slack workspace. Polar creates the channel, invites your team members, posts your welcome message, and sends a Slack Connect invitation to that admin. Once they accept, the shared channel appears in their workspace and you can start talking right away. # Embedded Checkout Source: https://polar.sh/docs/features/checkout/embed Embed our checkout directly on your site ![](https://polar.sh/docs/assets/features/checkout/embed/demo.png) You can either copy and paste our code snippet to get up and running in a second or use our JavaScript library for more advanced integrations. Our embedded checkout allows you to provide a seamless purchasing experience without redirecting users away from your site. ## Code Snippet The code snippet can be used on any website or CMS that allows you to insert HTML. First, create a [Checkout Link](/docs/features/checkout/links) as described in the previous section. The code snippet can directly be copied from there by clicking on `Copy Embed Code`. The snippet looks like this: ```typescript theme={null} Purchase ``` This will display a `Purchase` link which will open an inline checkout when clicked. You can style the trigger element any way you want, as long as you keep the `data-polar-checkout` attribute. ## Import Library If you have a more advanced project in JavaScript, like a React app, adding the ` ``` The same script also powers embedded checkout triggers — one tag covers every Polar embed. | Attribute | Value | Description | | - | - | - | | `data-polar-payment-method` | `string` | **Required.** The session token. Clicking the element opens the modal. | | `data-polar-payment-method-theme` | `light \| dark` | Optional theme override. | | `data-polar-payment-method-set-as-default` | `true \| false` | Optional. Default `true`. Pass `"false"` to add the card without overriding the existing default. | | `data-polar-payment-method-return-url` | `string` | Optional. Return URL for redirect-based payment methods. Defaults to the current page. | | `data-polar-payment-method-locale` | `string` | Optional. BCP47 locale (e.g. `'en'`, `'fr-FR'`). Unsupported locales fall back to English. | ## Localization The embed is fully localized, pass a BCP47 code via the `locale` option (or `data-polar-payment-method-locale` attribute): ```ts theme={null} const embed = await PolarEmbedPaymentMethod.create({ sessionToken: session.token, locale: "fr-FR", }); ``` When omitted, the embed defaults to English. Unsupported locales also fall back to English. See [Localization](/docs/features/checkout/localization) for the full list of supported languages. ## Events All events are dispatched as cancelable `CustomEvent`s on the `embed` instance. Call `event.preventDefault()` to opt out of the SDK's default action. | Event | Detail | Default action | | - | - | - | | `loaded` | — | Removes the loader spinner once the iframe is ready. | | `close` | — | Tears down the iframe (unless locked by a pending `confirmed`). | | `confirmed` | — | Marks the modal as non-closable while Stripe is processing. | | `success` | `{ paymentMethodId: string }` | **Auto-closes the modal.** Call `preventDefault()` to keep it open. | | `error` | `{ code: 'invalid_request' \| 'unauthorized' \| 'processing_failed' \| 'unknown' }` | Re-enables closing the modal after a failure. | ## Redirect-based payment methods Some payment methods authorise on the provider's own site. The browser navigates the whole tab away and back to `returnUrl` (defaults to the page the SDK was opened from), so the modal can't survive the round-trip. Read the outcome on the returned page with the static `getRedirectResult()`: ```ts theme={null} import { PolarEmbedPaymentMethod } from "@polar-sh/checkout/payment-method"; const result = PolarEmbedPaymentMethod.getRedirectResult(); // result: { status: 'succeeded' | 'failed' } | null if (result?.status === "succeeded") { // refresh the customer's payment methods } ``` In React, use the `usePaymentMethodRedirectResult` hook to avoid writing your own effect: ```tsx theme={null} import { usePaymentMethodRedirectResult } from "@polar-sh/checkout/react/payment-method"; usePaymentMethodRedirectResult({ onSuccess: () => console.log("Payment method added"), onError: () => console.error("Could not add payment method"), }); ``` Either way, the status query param is stripped from the URL so a refresh won't surface a stale result. Card payments (3DS) complete inside the modal and never trigger this path. # Checkout Links Source: https://polar.sh/docs/features/checkout/links Persistent URLs that create a Checkout Session on visit This is the simplest way to start selling. Configure once in the dashboard, share the URL anywhere (your website, social media, email, a button in your app), and Polar handles the rest. > [!TIP] > > If you need to create Checkout Sessions programmatically (e.g. with per-customer data computed by your backend), use the [Checkout API](/docs/features/checkout/session) directly instead. ## How it works A Checkout Link is a long-lived URL tied to your organization. The link itself doesn't expire, and you can share it indefinitely. When a customer visits the link: 1. Polar reads the link's configuration (products, preset discount, metadata, etc.). 2. A new, short-lived Checkout Session is created from that configuration. 3. The customer is redirected to the session's checkout page to complete the purchase. Each visit produces a brand new Checkout Session. Always share the Checkout Link URL itself, never the URL of a generated Checkout Session, since those are temporary and will expire. ## Create a Checkout Link Checkout Links are managed from the [**Checkout Links**](https://polar.sh/to/dashboard/products/checkout-links) page. Click on **New Link** to create one. ### Products You can select one or several products. With several products, customers can switch between them on the checkout page before paying. Products are shown in the order you list them. > [!NOTE] > > Customers always purchase a single product per checkout. Selecting multiple products on a Checkout Link gives the customer a choice between them; it doesn't bundle them together. True multi-product checkout (multiple products in the same order) isn't supported yet. ### Discount You can preset a discount on the link. It will be **automatically applied** when the customer lands on the checkout page, with no action required from them. Useful for running promotions or offering special pricing through specific links. If **Allow discount codes** is enabled, customers can still manually enter another discount code during checkout. > [!TIP] > > Discounts without a code can only be applied through Checkout Link presets or the [Checkout API](/docs/features/checkout/session). Learn more in the [Discounts documentation](/docs/features/discounts). ### Success URL URL where the customer is redirected after a successful payment. If left empty, the customer stays on the Polar-hosted confirmation page. You can add the `checkout_id={CHECKOUT_ID}` query parameter to the Success URL and Polar will substitute it with the actual Checkout Session ID at redirect time. This is handy to fetch the order details from your backend on the confirmation page. ### Return URL URL for the back button shown on the checkout page. When the customer clicks it, they're sent back to this URL (typically your pricing page or the previous page on your site). If not set, no back button is shown. ### Trial If the link's products are subscriptions, you can configure a trial period directly on the Checkout Link. When set, this trial **overrides** the default trial configured on the products themselves, but only for sessions created from this link. This is useful for running campaigns with longer (or shorter) trials than your default, without having to duplicate the product. If left empty, the product's own trial configuration is used. ### Seats If the link's products use seat-based pricing, you can preconfigure a fixed number of seats. When set, the checkout session is locked to that seat count—the customer cannot change it. This is useful for creating links with a predetermined team size. If the products no longer support the configured seat count when the link is opened (e.g., tier limits changed), the value is ignored and the customer can select freely. ### Metadata An optional key-value object for storing extra information. Metadata set on the link is copied to the generated Checkout Session, and propagates to the resulting Order and/or Subscription on success. ## Query parameters Append query parameters to a Checkout Link URL to override or extend its preset configuration on a per-visit basis. ### Preselect a product When a link is configured with several products, point the customer directly to one of them using `product_id`. The customer can still switch products on the checkout page. **product_id** `string` ID of the product to preselect. Must be one of the products configured on the Checkout Link. ### Prefill fields **customer_email** `string` Prefill the customer email. **customer_name** `string` Prefill the customer name. **discount_code** `string` Prefill the discount code input. Only works with discounts that have a code set. See the [Discounts documentation](/docs/features/discounts) for details. This is different from presetting a discount on the link. A preset discount is silently applied, whereas `discount_code` only fills the input field so the customer can see it. **amount** `string` Prefill the amount when the product uses Pay-What-You-Want pricing. **locale** `string` Force the checkout page language, given as an IETF BCP 47 language tag (e.g. `en`, `fr`, `pt-BR`). If omitted, the language is detected from the customer's browser. Checkout localization is in beta. See [Checkout Localization](/docs/features/checkout/localization) for details. **custom_field_data.\{slug}** `string` Prefill custom field data, where `{slug}` is the slug of the custom field. **theme** `string` Force the checkout page theme. Accepts `light` or `dark`. If omitted, the theme follows the customer's system preference. ### Attribution and reference metadata These parameters are automatically attached to the generated Checkout Session [`metadata`](/docs/api-reference/current/checkouts/get-checkout-session#response-metadata). **reference_id** `string` Your own reference ID for the Checkout Session. **utm_source** `string` UTM source of the Checkout Session. **utm_medium** `string` UTM medium of the Checkout Session. **utm_campaign** `string` UTM campaign of the Checkout Session. **utm_content** `string` UTM content of the Checkout Session. **utm_term** `string` UTM term of the Checkout Session. # Checkout Localization Source: https://polar.sh/docs/features/checkout/localization Serve checkout in your customer's preferred language > [!NOTE] > > Checkout localization is currently in **beta**. To enable it, turn on the feature flag for your > organization. ## How it works When checkout localization is enabled for your organization, the checkout page automatically detects the customer's preferred language from their browser settings and displays the checkout in that language. This includes translated labels, placeholders, and descriptions for all standard checkout fields. ## Overriding the language via API You can explicitly set the checkout language by passing the `locale` parameter when creating a checkout session via the API: ```bash theme={null} curl -X POST https://api.polar.sh/v1/checkouts/ \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "locale": "fr" }' ``` When a `locale` is set explicitly, it takes precedence over the browser's language preference. ## Overriding the language via querystring You can append `?locale=` to any checkout link and that will take precedence over the browser's language preference. ## Supported languages * English (en) (default) * Dutch (nl) * Spanish (es) * French (fr) * Swedish (sv) * German (de) * Hungarian (hu) * Italian (it) * Portuguese (Brazil) (pt) * Portuguese (Portugal) (pt-PT) * Korean (ko) * Japanese (ja) * Turkish (tr) * Polish (pl) * Chinese (Traditional, Taiwan) (zh-TW) Want to help us review translations for an upcoming language? Reach out at [translations@polar.sh](mailto:translations@polar.sh). ## Known limitations During the beta period, localization is scoped to the checkout page itself: * **Error messages** are displayed in English * **Transactional emails** (receipts, confirmations) are sent in English * There is **no language selector** on the checkout page — language is determined automatically from the browser, via the API `locale` parameter or via a querystring `?locale`. ## Feedback We'd love to hear your feedback on checkout localization: * Open an issue on [GitHub](https://github.com/polarsource/polar) * Email us at [translations@polar.sh](mailto:translations@polar.sh) # Payment Methods Source: https://polar.sh/docs/features/checkout/payment-methods Payment methods supported by Polar Checkout Polar automatically shows the payment methods available for each checkout. The options a customer sees depend on their location, the checkout currency, the type of purchase, and their device or browser. You don't need to enable individual payment methods. ## Cards and wallets | Payment method | Availability | | - | - | | Credit and debit cards | Worldwide, in every supported currency. One-time purchases and recurring subscriptions | | Apple Pay | Shown in Safari on an Apple device signed in to an Apple account with Apple Pay configured | | Google Pay | Shown in Google Chrome when signed in to a Google account with Google Pay configured | | Link | Shown to customers who saved their details with Stripe Link, which autofills their payment and address details | | Amazon Pay | Customers in the United States and Germany, for checkouts priced in USD | | Cash App Pay | Customers in the United States, for checkouts priced in USD | | WeChat Pay | Customers in mainland China, Hong Kong, and Macao, for checkouts priced in USD or CNY. One-time purchases only | > [!NOTE] > > **On Polar's hosted checkout, wallets need no setup.** They're enabled by default and appear automatically whenever the customer's device and browser support them. > > Domain validation is only required for [Embedded Checkout](/docs/features/checkout/embed#enable-wallets-in-embedded-checkout), where the checkout runs on your own domain. ## Local payment methods | Payment method | Customer location | Currency | Purchase type | | - | - | - | - | | Bancontact | Belgium | EUR | One-time purchases | | EPS | Austria | EUR | One-time purchases | | iDEAL / Wero | Netherlands | EUR | One-time purchases | | UPI | India | INR | One-time purchases and recurring subscriptions | | Kakao Pay | South Korea | KRW | One-time purchases and recurring subscriptions | | Naver Pay | South Korea | KRW | One-time purchases and recurring subscriptions | | Samsung Pay | South Korea | KRW | One-time purchases | ## Other payment methods The list above is everything we support today. There's no setting or plan that unlocks more, and payment methods can't be enabled per organization. PayPal is by far the most common thing people ask about. We don't have a timeline to share. # Checkout API Source: https://polar.sh/docs/features/checkout/session Create checkout sessions programmatically for complete control If you want to integrate more deeply the checkout process with your website or application, you can use our dedicated API. The first step is to [create a Checkout session](/docs/api-reference/current/checkouts/create-checkout-session). For this you'll need at least your **Product ID**. You can retrieve your Product ID from Products in your dashboard, click on "context-menu" button in front of your product and click on Copy Product ID. The API will return you an object containing all the information about the session, including **an URL where you should redirect your customer** so they can complete their order. > [!TIP] > > You can force the checkout page theme by appending `?theme=dark` or `?theme=light` to the session URL. Without it, the theme follows the customer's system preference. ## Multiple products You can create a checkout session with multiple products. This is useful if you want to allow your customers to choose between different products before they checkout. Products are shown in the order you pass them in the `products` array. ![](https://mintcdn.com/polar/Ut0vPUvE1pIdMcH2/assets/features/checkout/session/checkout_multiple_products.light.png?fit=max\&auto=format\&n=Ut0vPUvE1pIdMcH2\&q=85\&s=36f88ae4e5e70735484c068f3605b713) ## Ad-hoc prices For advanced use cases where you need complete control over pricing, you can create ad-hoc prices directly when creating a checkout session. Ad-hoc prices are temporary prices that exist only for that specific checkout session and don't appear in your product's catalog. This is useful when you need to: * Apply dynamic pricing based on user-specific factors * Create custom pricing tiers for specific customers * Implement usage-based or calculated pricing that varies per checkout * Test pricing variations without modifying your product catalog When creating a checkout session, you can pass a `prices` parameter that maps product IDs to an array of price definitions. These prices will be created on-the-fly and associated with the checkout session. > [!NOTE] > > Ad-hoc prices are marked with `source: "ad_hoc"` in the API response, while catalog prices have `source: "catalog"`. Ad-hoc prices are temporary and specific to the checkout session. ### Example ```ts TypeScript theme={null} import { createPolar } from "@polar-sh/sdk/2026-10"; const polar = createPolar({ accessToken: process.env.POLAR_ACCESS_TOKEN!, }); async function run() { const checkout = await polar.checkouts.create({ products: ["productId"], prices: { "productId": [ { amount_type: "fixed", price_amount: 10000, // $100.00 price_currency: "usd", } ] } }); console.log(checkout.url); } run(); ``` ```py Python theme={null} from polar.v2026_10 import Polar with Polar("") as polar: checkout = polar.checkouts.create( products=[""], prices={ "": [ { "amount_type": "fixed", "price_amount": 10000, # $100.00 "price_currency": "usd", } ] }, ) print(checkout.url) ``` ### Price types Ad-hoc prices support all the same price types as catalog prices: * **Fixed**: A fixed amount price * **Custom**: Pay-what-you-want pricing * **Free**: No charge * **Seat-based**: Pricing based on number of seats * **Metered**: Usage-based pricing tied to a meter For the complete schema of each price type, refer to the [Checkout API reference](/docs/api-reference/current/checkouts/create-checkout-session). ## External Customer ID Quite often, you'll have your own users management system in your application, where your customer already have an ID. To ease reconciliation between Polar and your system, you can inform us about your customer ID when creating a checkout session through the [`external_customer_id`](/docs/api-reference/current/checkouts/create-checkout-session) field. After a successful checkout, we'll create a Customer on Polar with the external ID you provided. It'll be provided through the `customer.external_id` property in webhooks you may have configured. > [!NOTE] > > When `customer_id` or `external_customer_id` is set, the customer's email is pre-filled and the email field is **disabled** on the checkout page. This ensures the order is always linked to the authenticated customer in your system. ## Customer IP address When you create a checkout session, Polar uses the IP address of the request to detect the customer's country. This drives features like: * **Currency auto-detection** for [products with multiple payment currencies](/docs/features/products) * **Pre-filling the billing country** on the checkout page, which is also used to compute taxes If you use [checkout links](/docs/features/checkout/links), this works automatically. But if you create sessions through the API from a **backend, proxy, or edge function** (e.g. your own API, a Cloudflare Worker, a Next.js route handler), Polar will see *your server's* IP — not the customer's — and the detection will be wrong. In that case, forward the customer's IP address as `customer_ip_address` in the request body: ```ts TypeScript theme={null} import { createPolar } from "@polar-sh/sdk/2026-10"; const polar = createPolar({ accessToken: process.env.POLAR_ACCESS_TOKEN!, }); const checkout = await polar.checkouts.create({ products: ["productId"], customer_ip_address: request.headers.get("CF-Connecting-IP") ?? undefined, }); ``` ```py Python theme={null} from polar.v2026_10 import Polar with Polar("") as polar: checkout = polar.checkouts.create( products=[""], customer_ip_address=request.headers.get("True-Client-IP") or request.client.host, ) ``` The exact way to read the connecting IP depends on your runtime — for example, `CF-Connecting-IP` on Cloudflare Workers, `x-forwarded-for` behind most proxies, or `True-Client-IP`/`request.client.host` in FastAPI. > [!NOTE] > > When `customer_ip_address` is provided, you don't need to set `customer_billing_address.country` yourself — Polar will derive both the country and the currency from the IP. ## SDK examples Using our SDK, creating a checkout session is quite straightforward. ```ts TypeScript theme={null} import { createPolar } from "@polar-sh/sdk/2026-10"; const polar = createPolar({ accessToken: process.env.POLAR_ACCESS_TOKEN!, }); async function run() { const checkout = await polar.checkouts.create({ products: ["productId"] }); console.log(checkout.url) } run(); ``` ```py Python theme={null} from polar.v2026_10 import Polar with Polar("") as polar: checkout = polar.checkouts.create( allow_discount_codes=True, products=[""], ) print(checkout.url) ``` # Cost Events Source: https://polar.sh/docs/features/cost-insights/cost-events Track costs by adding cost metadata to your ingested events Cost Insights works by allowing you to add a special `_cost` property to any event you ingest through Polar's Event Ingestion API. These costs are then aggregated and made available through the Metrics API alongside revenue metrics. ## The `_cost` Property ### Basic Structure To track costs, add a `_cost` property to your event's metadata when ingesting events. ```typescript icon="square-js" TypeScript (SDK) theme={null} import { createPolar } from "@polar-sh/sdk/2026-10"; const polar = createPolar({ accessToken: process.env.POLAR_ACCESS_TOKEN!, }); await polar.events.ingest({ events: [ { name: "llm.inference", external_customer_id: "user_123", metadata: { _cost: { amount: 0.025, currency: "usd", }, }, }, ], }); ``` ```json cURL theme={null} POST https://api.polar.sh/v1/events/ingest Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN { "events": [ { "name": "llm.inference", "external_customer_id": "user_123", "metadata": { "_cost": { "amount": 0.025, "currency": "usd" } } } ] } ``` ### Cost Metadata Schema The `_cost` property has the following structure: * **`amount`** (required): The cost amount in cents as a decimal number * Example: `0.025` for \$0.00025 (a fraction of a cent) * Example: `150` for \$1.50 * Supports up to 17 digits with 12 decimal places for precision * **`currency`** (required): The currency code * Currently only `"usd"` is supported > [!NOTE] > > **Amount must be in cents**: The `amount` field represents the cost in cents, > not dollars. For example, `100 = \$1.00`, `0.5 = \$0.005` (half a cent), and > `0.001 = \$0.00001` (one hundredth of a cent). ## Use Cases ### AI/LLM Applications Track the cost of LLM API calls per customer: ```typescript icon="square-js" TypeScript theme={null} import { createPolar } from "@polar-sh/sdk/2026-10"; import OpenAI from "openai"; const polar = createPolar({ accessToken: process.env.POLAR_ACCESS_TOKEN!, }); const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY, }); // Make LLM API call const completion = await openai.chat.completions.create({ model: "gpt-4", messages: [{ role: "user", content: "Hello!" }], }); if (!completion.usage) { throw new Error("OpenAI did not return token usage"); } // Calculate cost (example: $0.03 per 1K input tokens, $0.06 per 1K output tokens) const inputCost = (completion.usage.prompt_tokens / 1000) * 3; // in cents const outputCost = (completion.usage.completion_tokens / 1000) * 6; // in cents const totalCost = inputCost + outputCost; // Track the cost in Polar await polar.events.ingest({ events: [ { name: "gpt4.completion", customer_id: "cus_abc123", metadata: { _cost: { amount: totalCost, currency: "usd", }, _llm: { vendor: "openai", model: "gpt-4", input_tokens: completion.usage.prompt_tokens, output_tokens: completion.usage.completion_tokens, total_tokens: completion.usage.total_tokens, }, }, }, ], }); ``` ### Infrastructure Costs Track compute, storage, or API costs: ```json theme={null} { "events": [ { "name": "video.processing", "external_customer_id": "user_123", "metadata": { "_cost": { "amount": 45.5, // $0.455 "currency": "usd" }, "duration_seconds": 120, "resolution": "1080p" } } ] } ``` ### Third-Party Service Costs Track costs from external services: ```json theme={null} { "events": [ { "name": "email.sent", "external_customer_id": "user_123", "metadata": { "_cost": { "amount": 0.0001, // $0.000001 "currency": "usd" }, "provider": "sendgrid", "recipients": 1 } } ] } ``` ## Best Practices ### Track Costs in Real-Time Ingest cost events as they occur to maintain accurate, up-to-date metrics: ```typescript icon="square-js" TypeScript theme={null} import { createPolar } from "@polar-sh/sdk/2026-10"; const polar = createPolar({ accessToken: process.env.POLAR_ACCESS_TOKEN!, }); // When making an LLM API call const completion = await openai.chat.completions.create({ model: "gpt-4", messages: [{ role: "user", content: "Hello!" }], }); const cost = calculateCost(completion.usage); // Cost should be in cents await polar.events.ingest({ events: [ { name: "llm.completion", external_customer_id: "user_123", metadata: { _cost: { amount: cost, currency: "usd", }, }, }, ], }); ``` ### Use Precise Amounts The `amount` field supports up to 12 decimal places, perfect for tracking micro-costs: ```json theme={null} { "_cost": { "amount": 0.000125, // $0.00000125 "currency": "usd" } } ``` ### Add Context with Additional Metadata Combine `_cost` with other metadata to understand cost drivers: ```json theme={null} { "metadata": { "_cost": { "amount": 0.05, // $0.0005 "currency": "usd" }, "model": "gpt-4-turbo", "tokens": 1000, "feature": "chatbot" } } ``` # Cost Traces Source: https://polar.sh/docs/features/cost-insights/cost-traces Aggregate events by user sessions to calculate costs Cost Traces is a feature that allows you to define session boundaries and calculate costs for each session. Coming soon. # Introduction to Cost Insights Source: https://polar.sh/docs/features/cost-insights/introduction Track costs, profits, and customer lifetime value with event-based cost tracking ![](https://mintcdn.com/polar/lA614ZvRwurqvmze/assets/features/cost/ingestion.light.png?fit=max\&auto=format\&n=lA614ZvRwurqvmze\&q=85\&s=92ccae14e7ee0573454e268f316764f2) Cost Insights is a powerful feature that enables you to calculate business-centric metrics like Costs, Profits, and Customer Lifetime Value (LTV) by annotating your events with cost data. ## Overview While Polar automatically tracks revenue from orders and subscriptions, Cost Insights allows you to track the costs associated with delivering your product or service. By combining revenue and cost data, you can gain deep insights into profitability on a per-customer basis. ## How It Works Cost Insights works in three simple steps: 1. **Ingest events with cost data**: Add a `_cost` property to events metadata when ingesting them through Polar's Event Ingestion API 2. **Automatic aggregation**: Polar automatically aggregates costs alongside your revenue data 3. **Query and analyze**: Use the Metrics API, or the Polar Dashboard to retrieve costs, profits, and customer LTV ### Quick Example ```json theme={null} { "events": [ { "name": "llm.inference", "external_customer_id": "user_123", "metadata": { "_cost": { "amount": 0.025, // $0.00025 in cents "currency": "usd" } } } ] } ``` ## Common Use Cases * **AI/LLM Applications**: Track the cost of API calls to OpenAI, Anthropic, or other LLM providers * **Infrastructure Costs**: Monitor compute, storage, or bandwidth costs per customer * **Third-Party Services**: Track costs from email providers, SMS gateways, or other external services * **Customer Profitability**: Calculate profit margins and LTV for each customer ## Documentation > [card] [Cost Events](/docs/features/cost-insights/cost-events) > > Learn how to track costs by adding the `_cost` property to your events metadata > [card] [Cost Metrics](/docs/features/analytics) > > Query and analyze costs, profits, and customer lifetime value # Custom Fields Source: https://polar.sh/docs/features/custom-fields Learn how to add custom input fields to your checkout with Polar By default, the Checkout form will only ask basic information from the customer to fulfill the order: a name, an email address, billing information, etc. But you might need more! A few examples: * A checkbox asking the customer to accept your terms * An opt-in newsletter consent * A select menu to ask where they heard from you * ... With Polar, you can easily add such fields to your checkout using **Custom Fields**. ## Create Custom Fields Custom Fields are managed at an organization's level. To create them, go to [**Settings → Custom Fields**](https://polar.sh/to/dashboard/settings/custom-fields). You'll see the list of all the available fields on your organization. Click on **New Custom Field** to create a new one. You can also manage them programmatically using the [Custom Fields API](/docs/api-reference/current/custom-fields/create-custom-field). ### Type The type of the field is the most important thing to select. It determines what type of input will be displayed to the customer during checkout. The type can't be changed after the field is created. We support five types of fields: #### Text This will display a simple text field to input textual data. By default, it'll render a simple input field but you can render a **textarea** by toggling the option under `Form input options`. Under `Validation constraints`, you can add minimum and maximum length validation. Underneath, the data will be stored as a string. #### Number This will display a number input field. Under `Validation constraints`, you can add minimum (`Greater than or equal`) and maximum (`Less than or equal`) validation. Underneath, the data will be stored as an integer. #### Date This will display a date input field. Under `Validation constraints`, you can add minimum and maximum validation. Underneath, the data will be stored as a string using the ISO 8601 format. #### Checkbox This will display a checkbox field. Underneath, the data will be stored as a boolean (`true` or `false`). #### Select This will display a select field with a predefined set of options. Each option is a pair of `Value` and `Label`, the first one being the value that'll be stored underneath and the latter the one that will be shown to the customer. At least one option is required, and you can drag options to reorder them. ### Slug and name The slug determines the key that'll be used to store the data inside objects related to the checkout, like Orders and Subscriptions. It must be unique across your organization and can only contain lowercase letters, numbers, hyphens and underscores. You can change it afterwards, we'll automatically update the data stored on existing Checkouts, Orders and Subscriptions to reflect the new slug. The name is what will be displayed to you to recognize the field across your dashboard. By default, it'll also be the label of the field displayed to the customer, unless you customize it under `Form input options`. ### Form input options Those options allow you to customize how the field is displayed to the customer. You can set: * The label, displayed above the field * The help text, displayed below the field * The placeholder, displayed inside the field when there is no value The label and help text support basic Markdown syntax, so you can add bold, italic or even links. ## Add Custom Field to Checkout Custom Fields are enabled on Checkout specifically on each **product**. While [creating or updating](/docs/features/products) a product, expand the **Checkout Page** section and select the fields you want to include under **Checkout Fields**. Note that you can make each field `Required` for that product. > [!TIP] > > If you make a **checkbox** field **required**, customers will have to check > the box before submitting the checkout. Very useful for terms acceptance! The fields are now added as part of the Checkout form for this product. When [creating a Checkout Session](/docs/api-reference/current/checkouts/create-checkout-session) from the API, you can also prefill the fields by setting the `custom_field_data` property, keyed by the **slug** of each field. ## Read data The values input by the customer are stored on the Order or Subscription resulting from the checkout. From your dashboard, open an order or subscription from the **Sales** section: the values are displayed under the **Custom Fields** section of the detail view. This data is also available from the [Orders](/docs/api-reference/current/orders/get-order) and [Subscriptions](/docs/api-reference/current/subscriptions/get-subscription) API, under the `custom_field_data` property. Each value is referenced by the **slug** of the field. ```json theme={null} { // ... "custom_field_data": { "terms": true, "source": "social_media" } } ``` # Customer Management Source: https://polar.sh/docs/features/customer-management Get insights on your customers and sales ![](https://mintcdn.com/polar/Ut0vPUvE1pIdMcH2/assets/features/customer-management/details.light.png?fit=max\&auto=format\&n=Ut0vPUvE1pIdMcH2\&q=85\&s=dc8cb8a0793331ec889f89f3b84d33ac) ## Managing Customers Polar has a built in feature to view and manage your Customers. Everyone who has ever purchased something from you will be recorded as a Customer to your Organization. You’re able to see past orders and their ongoing subscriptions, as well as some additional metrics. ## External ID Quite often, you'll have our own users management system in your application, where your customer already have an ID. To ease reconciliation between Polar and your system, we have a dedicated [`external_id`](/docs/api-reference/current/customers/get-customer-by-external-id#response-external-id) field on Customers. It's unique across your organization and can't be changed once set. We have dedicated API endpoints that work with the `external_id` field, so you don't even have to store the internal Polar ID in your system. > [card] [Get Customer by External ID](/docs/api-reference/current/customers/get-customer-by-external-id) > [card] [Update Customer by External ID](/docs/api-reference/current/customers/update-customer-by-external-id) > [card] [Delete Customer by External ID](/docs/api-reference/current/customers/delete-customer-by-external-id) ## Metadata You may set additional metadata on Customers. This can be very useful to store additional data about your customer you want to be available through our API and webhooks. ![](https://mintcdn.com/polar/Ut0vPUvE1pIdMcH2/assets/features/customer-management/edit.light.png?fit=max\&auto=format\&n=Ut0vPUvE1pIdMcH2\&q=85\&s=00c8cdfc037e19bfe63045c1d9d9459e) It can be set through the dashboard or through the [API](/docs/api-reference/current/customers/update-customer#body-metadata). It can also be pre-set when creating a Checkout Session by using the [`customer_metadata`](/docs/api-reference/current/checkouts/create-checkout-session#body-customer-metadata) field. This way, after a successful checkout, the metadata will automatically be set on the newly created Customer. # Customer Portal Source: https://polar.sh/docs/features/customer-portal/introduction The self-service destination for your customers The Customer Portal is a hosted, self-service page where your customers can manage everything related to their relationship with your business — without having to email your support team. ![](https://mintcdn.com/polar/Ut0vPUvE1pIdMcH2/assets/features/customer-portal/overview.light.png?fit=max\&auto=format\&n=Ut0vPUvE1pIdMcH2\&q=85\&s=20c5b716cad34eae8c8826867b5ca193) ## What customers can do From the Customer Portal, your customers can: * View their **active subscriptions** and past **purchase history** * **Download and edit invoices** (e.g. add a company name, VAT number, or billing address) * **Download payment receipts** for every paid order, with the payment method and any refunds * **Access benefits** they're entitled to — license keys, file downloads, Discord access, etc. * **Cancel active subscriptions** on their own * **Update their default payment method** — the primary way for customers to recover from failed payments * Optionally, do more — change their email address, switch subscription plans, manage seats, pause and resume subscriptions, view metered usage, and so on — depending on which toggles you enable under [Settings](/docs/features/customer-portal/settings) ## Why it matters The Customer Portal isn't just a convenience feature — it's a critical piece of your billing stack: * **Failed payment recovery.** When a subscription renewal fails, the portal is where customers update their card so they don't lose access. Because Polar is PCI-compliant, you never have to handle card details yourself. * **Self-service cancellations.** Some jurisdictions (notably California under the [Automatic Renewal Law](https://oag.ca.gov/consumers/auto-renewing-subscriptions)) legally require customers to be able to cancel a subscription the same way they signed up. The Customer Portal satisfies that requirement out of the box. * **Invoice and receipt access.** Customers retrieve and edit their invoices, and download a receipt for any paid order, without pulling you into a support thread. ## Next steps > [card] [Navigate customers to the portal](/docs/features/customer-portal/navigate-customers) > > Use the default portal URL, generate authenticated links, or rely on the > emails Polar already sends. > [card] [Customer portal settings](/docs/features/customer-portal/settings) > > Configure what your customers can do from the portal under Settings → Customer Portal. > [card] [Customer Portal API](/docs/api-reference/current/customer_portal/get-customer) > > Build your own portal experience on top of the Customer Portal API. ## FAQ > [accordion] Can I disable the Customer Portal completely? > > **No.** The Customer Portal is always available for your customers, and it > can't be turned off. > > This is a deliberate design decision. The portal is how we guarantee that > your customers can always: > > * **Access their invoices and payment receipts** for tax and bookkeeping. > * **Cancel their subscriptions on their own**, which is legally required in > some jurisdictions (for example California's [Automatic Renewal Law](https://oag.ca.gov/consumers/auto-renewing-subscriptions), > which requires that customers be able to cancel the same way they signed > up). > * **Update their payment method in a PCI-compliant way**, so they can > recover from failed renewals without you having to handle card details. > > You can, however, [fine-tune what customers can do](/docs/features/customer-portal/settings) > from the portal — for example, disabling subscription plan changes or email > edits. > [accordion] Can I customize the look and feel of the Customer Portal? > > Not the hosted portal at `polar.sh//portal` — it's > intentionally consistent across all Polar organizations. > > If you need a branded experience, you can build your own portal on top of > the [Customer Portal API](/docs/api-reference/current/customer_portal/get-customer), > which covers the day-to-day actions: viewing subscriptions and orders, > downloading invoices and receipts, managing benefits and seats, and reading > meter usage. > > > [!NOTE] > > > > Not every action is exposed through the Customer Portal API. Most > > notably, **updating a default payment method** is only available from the > > hosted Customer Portal — this is what keeps you PCI-compliant, since card > > details never touch your servers. Customers you send into a custom portal > > will still need the hosted one to recover from failed payments. > [accordion] How do customers sign in to the portal? > > By default, customers authenticate with the email address they used to > purchase or subscribe — Polar emails them a one-time code to confirm. > > You can also skip the email step entirely by generating a pre-authenticated > link from your own application. See [Navigate customers to the portal](/docs/features/customer-portal/navigate-customers) > for details. > [accordion] Do I need to send customers a link to the portal myself? > > You don't have to. Polar already includes a link to the Customer Portal in > the transactional emails it sends — order confirmations, subscription > renewal notices, failed payment alerts, and more. > > You may still want to link to it from your own app for convenience, but > it's not required for customers to be able to reach it. > [accordion] What happens if a customer's payment method fails? > > The customer receives an email from Polar letting them know, with a link to > the Customer Portal where they can update their default payment method. > Once they do, Polar automatically retries the charge. > > This self-service flow is the primary way customers recover from failed > renewals — keep it in mind when you're thinking about churn. # Navigate Customers to the Portal Source: https://polar.sh/docs/features/customer-portal/navigate-customers Three ways your customers can reach their Customer Portal There are three ways your customers can land on the Customer Portal: the default URL, a pre-authenticated link you generate from your application, or the links Polar automatically includes in the emails it sends to your customers. ## 1. The default portal URL Every organization gets a Customer Portal hosted at: ``` https://polar.sh//portal ``` Customers authenticate by entering the email address they used to purchase or subscribe. Polar then emails them a one-time code to complete sign-in. ![](https://mintcdn.com/polar/Ut0vPUvE1pIdMcH2/assets/features/customer-portal/signin.light.png?fit=max\&auto=format\&n=Ut0vPUvE1pIdMcH2\&q=85\&s=1320caeb29255a378aa93359741683dc) This URL is a good choice to link from your marketing site, your app's help menu, or a support article — anywhere you need a stable, shareable link. ## 2. Pre-authenticated portal links If your customer is already signed in to your application, you can generate an authenticated link that drops them directly into the portal — no email code required. Under the hood, this calls the [Create Customer Session](/docs/api-reference/current/customer-sessions/create-customer-session) endpoint and redirects the user to the `customer_portal_url` it returns. ```typescript theme={null} import { createPolar } from "@polar-sh/sdk/2026-10"; const polar = createPolar({ accessToken: process.env.POLAR_ACCESS_TOKEN!, }); async function run() { const result = await polar.customerSessions.create({ customer_id: "", }); redirect(result.customer_portal_url); } run(); ``` If you're on Next.js, the `@polar-sh/nextjs` adapter wraps this into a single route handler: ```typescript theme={null} // app/portal/route.ts import { CustomerPortal } from "@polar-sh/nextjs"; export const GET = CustomerPortal({ accessToken: process.env.POLAR_ACCESS_TOKEN!, getCustomerId: async (req) => "", environment: "sandbox", // Use sandbox if you're testing Polar — pass 'production' otherwise }); ``` Point a link in your app at `/portal` and your customer is one click away from managing their billing. > [!NOTE] > > Customer Session tokens are short-lived. Always generate a fresh link at the > moment the customer clicks, rather than storing the URL. ## 3. Emails Polar sends to your customers You don't have to build anything to get customers to the portal — Polar already includes a link to it in the transactional emails we send on your behalf, including: * **Order confirmation** emails sent after a successful checkout * **Subscription renewal** and **subscription updated** emails * **Failed payment** notifications, so customers can update their card This means that even if you never link to the portal from your own app, your customers already have a way to get back to it from their inbox. # Customer Portal Settings Source: https://polar.sh/docs/features/customer-portal/settings Configure what customers can do from the Customer Portal All Customer Portal settings live under [**Settings → Customer Portal**](https://polar.sh/to/dashboard/settings/customer-portal) in your Polar dashboard. Each setting is a toggle that enables or disables a specific capability for your customers. ## Show metered usage Adds a **Usage** tab to the Customer Portal where customers can see their current consumption for each meter on their subscription. This is only relevant if you've configured [meters](/docs/features/usage-based-billing/meters) on your products. Disabling this toggle hides usage from the portal UI but has no effect on the Customer Portal API — if you're building a custom usage surface in your own app, the [customer meters endpoints](/docs/api-reference/current/customer_meters/list-customer-meters) continue to work regardless. ## Enable subscription seat management Allows customers to change the number of seats on their active subscription, and to assign or revoke seats for their teammates, directly from the portal. This setting is only relevant when you offer [seat-based prices](/docs/features/seat-based-pricing). If you disable it, customers can't change seat counts or manage assignments from the portal — you'll need to build that flow yourself against the [Customer Seats API](/docs/api-reference/current/customer-seats/assign-seat). ## Allow email address changes Gives customers the option to change the email address associated with their customer record after purchasing. The new email must be verified through a confirmation link before the change takes effect. > [!NOTE] > > When this is enabled, you'll probably want to listen for the > [`customer.updated`](/docs/api-reference/current/customer_updated) webhook and > sync the new email back into your own user system, so the two stay in sync. ## Enable subscription plan changes Lets customers switch between products on their own — upgrading, downgrading, or moving to a different plan entirely — without contacting you. Plan changes follow your [proration settings](/docs/features/subscriptions/proration). If you'd rather handle plan changes yourself (for example, because you gate them behind custom logic in your app), disable this and drive updates through the [Update Subscription](/docs/api-reference/current/subscriptions/update-subscription) endpoint instead. ## Enable subscription pause Lets customers pause their own subscription from the portal and resume it later, without contacting you. A paused subscription stops billing at the end of the current period and revokes benefits until it resumes; resuming starts a new billing period and charges immediately. See [Pause and resume](/docs/features/subscriptions/manage#pause-and-resume) for the full behavior. This toggle only gates the portal. Pausing and resuming through the [Update Subscription](/docs/api-reference/current/subscriptions/update-subscription) endpoint is always available to you, so you can drive it from your own backend whether or not customers can self-serve. # Discounts Source: https://polar.sh/docs/features/discounts Create discounts on products and subscriptions Discounts are a way to reduce the price of a product or subscription. They can be applied to one-time purchasable products or subscriptions. ![](https://mintcdn.com/polar/Ut0vPUvE1pIdMcH2/assets/features/discounts/create.light.png?fit=max\&auto=format\&n=Ut0vPUvE1pIdMcH2\&q=85\&s=3c4044637217753344822d88e4807de7) ## Create a discount Go to the [**Discounts**](https://polar.sh/to/dashboard/products/discounts) page #### Name Displayed to the customer when they apply the discount. #### Code Optional code (case insensitive) that the customer can use to apply the discount. If left empty, the discount can only be applied through a Checkout Link or the API. #### Percentage Discount The percentage discount to apply to the product or subscription. #### Fixed Amount Discount The discount deducts a fixed amount from the price of the product or subscription. #### Recurring Discount The percentage discount to apply to the product or subscription. * **Once** The discount is applied once. * **Several Months** The discount is applied for a fixed number of months. * **Forever** The discount is applied indefinitely. #### Restrictions * **Products** The discount can only be applied to specific products. By default the discount can be applied to all products, also ones created after the discount was created. The restriction applies when the discount is redeemed, at checkout or when applying it to a subscription. Once applied to a subscription, the discount stays on through plan changes, including to products outside the restriction, so customers are never charged more unexpectedly after a change. **Once** covers the first billing cycle after it's applied, so its value follows the length of that cycle (for example, after a switch from monthly to yearly, it covers a yearly charge). * **Starts at** The discount can only be applied after this date * **Ends at** The discount can only be applied before this date * **Maximum redemptions** The maximum number of times the discount can be applied, counting across all customers. * **Maximum redemptions per customer** The maximum number of times a single customer can apply the discount. See [Per-customer limits](#per-customer-limits). ## Per-customer limits A per-customer limit caps how many times a single buyer can redeem a code, while leaving the code open to everyone else. Share it publicly, set the limit to 1, and each buyer gets one redemption. Polar identifies a customer by three signals, and a match on any one is enough: * The (external) customer ID on the checkout or the subscription. * The email address (ignoring plus-aliases: `ada+polar@example.com` matches `ada@example.com`) * The payment card, so a new email address on the same card still counts. Free products and 100% forever subscriptions never ask for a card, so those match on ID and email alone. Refunding an order frees the customer's slot, and they can use the code again (note: a partial refund doesn't). [Polar-issued refunds as part of chargeback prevention](/docs/features/refunds) also don't free the customer's slot. ## Apply a discount ### Auto-apply via Checkout Link When creating a [Checkout Link](/docs/features/checkout/links), you can preset a discount that will be automatically applied when customers land on the checkout page. This is useful for promotional campaigns or special offers where you want to guarantee the discount is applied without requiring customers to enter a code. > [!NOTE] > > Discounts without a code can only be auto-applied through Checkout Links or the API. ### Prefill via query parameter You can pass a `discount_code` query parameter to any Checkout Link URL to prefill a discount code in the checkout form. Note that this only prefills the field—customers will still see the code and it will be visible in the form. ### Apply via API When creating a Checkout Session via the API, you can specify a discount to apply programmatically. See the [Checkout API documentation](/docs/features/checkout/session) for details. # Payout Accounts Source: https://polar.sh/docs/features/finance/accounts Connect a Stripe Connect Express account to receive your earnings A **payout account** is the external account Polar uses to send you your earnings. As the [Merchant of Record](/docs/merchant-of-record/introduction), Polar collects the money from your customers, then [transfers your balance](/docs/features/finance/payouts) — minus our fees — to your payout account. From there, the funds are deposited into your bank account. Polar uses [Stripe Connect Express](https://stripe.com/connect) for payout accounts. You need to connect a payout account **before Polar can accept money on your behalf**. We don't want to collect funds from your customers that we wouldn't be able to pay out to you, so a working payout account is a prerequisite to going live. ## Connecting a Payout Account 1. Open the [**Finance → Account**](https://polar.sh/to/dashboard/finance/account) page in your Polar dashboard. 2. Click **Continue with account setup**. 3. Select your country: * If this is a personal account, pick your **country of residence**. * If this is a business or organization, pick the **country of tax residency**. 4. You will be redirected to Stripe to complete onboarding. Stripe will ask for your identity details, business information (if applicable), and the bank account you want to be paid out to. 5. Once Stripe confirms your account, you're ready to receive payouts. The user who completes onboarding becomes the **owner** of the payout account. They own the underlying Stripe account and are the legal recipient of the funds. ## Managing Your Account From [**Finance → Account → Manage payout accounts**](https://polar.sh/to/dashboard/finance/account) you can: * **Open in Stripe** — jump into the Stripe-hosted dashboard to update your bank account and business details. * **Make Active** — switch the organization to a payout account you own that isn't linked to any organization. * **Add Payout Account** — start onboarding for a new payout account (for example, in a different country). * **Delete** — remove a payout account you no longer use. You can only delete an account that is not linked to any organization, has no pending payouts, and has a zero Stripe balance. ## Country & Currency Requirements Stripe Connect requires the bank account you connect to be in the **same country as the business** and to use that country's **local currency**. This is a Stripe (and underlying banking network) requirement that Polar cannot override. > [accordion] Can I have my company registered in Ireland but use a US bank account for payouts? > > No. Stripe Connect requires a bank account in the same country as the business, in the local currency. An Irish company must connect an Irish (EUR) bank account; a US company must connect a US (USD) bank account, and so on. > [accordion] Can I use Wise, Payoneer, Revolut, or another virtual account to receive payouts? > > Only if the virtual account provides a real bank account in the same country as your registered business, in the local currency, and is accepted by Stripe. Most multi-currency or "borderless" accounts (Wise, Payoneer, Revolut, etc.) do not satisfy Stripe's verification for Connect payouts. If Stripe rejects the account during onboarding, you'll need to use a domestic bank account instead. > [accordion] My business is in country A but I live in country B. Which one do I pick? > > Pick the country where the business is legally registered for tax purposes. For a personal account, pick your country of residence. > [accordion] My country isn't in the list. Can I still receive payouts? > > Polar supports the countries listed in our [supported countries for payouts](/docs/merchant-of-record/supported-countries#payouts). If yours isn't listed during onboarding, we can't currently issue payouts there. # Account Balance & Transparent Fees Source: https://polar.sh/docs/features/finance/balance Monitor your Polar balance without hidden fees You can see your available balance for payout at any time under your `Finance` page. ![](https://mintcdn.com/polar/fnujBPxaFvfkZfB0/assets/features/finance/balance/overview.light.jpeg?fit=max\&auto=format\&n=fnujBPxaFvfkZfB0\&q=85\&s=603040c0ac9331aa9f71061ce20401fe) Your balance is all the earnings minus: 1. Any VAT we've captured for remittance, i.e balance is excluding VAT 2. Our revenue share (varies by plan — see [fees](/docs/merchant-of-record/fees)) All historic transactions are available in chronological order along with their associated fees that have been deducted. Note: Upon [payout (withdrawal)](/docs/features/finance/payouts), Stripe incurs additional fees that will be deducted before the final payout of the balance. ## Multiple payment currencies orders and settlement When customers purchase your products in currencies other than USD, Polar automatically converts these amounts to USD (the settlement currency) for your account balance. This conversion ensures that all transactions are consolidated into a single currency for easier financial management and payout processing. The conversion process uses current exchange rates at the time of the transaction, and the converted USD amount is what appears in your account balance and is available for payout. ## Payouts in ISK, HUF, TWD, or UGX For accounts using Icelandic króna (ISK), Hungarian forint (HUF), New Taiwan dollar (TWD), or Ugandan shilling (UGX), Stripe requires payout amounts to be in whole currency units. This means any fractional amount (less than 1 ISK/HUF/TWD/UGX) will remain in your balance and be included in your next payout. # Payouts Source: https://polar.sh/docs/features/finance/payouts Withdraw money from your Polar account You can issue a withdrawal — also called a payout — once your balance meets the minimum threshold for your account currency. Polar transfers the balance, minus Stripe payout fees (see below), to your Stripe account, and Stripe issues the payout from there. ## Payout Delay Transactions are subject to a **7-day settlement delay** from the date they occur before the corresponding funds become available for payout. This delay applies by default to organizations created on or after May 12, 2026. Organizations created before this date continue to receive instant payouts. We may also extend this delay or hold specific transactions when it makes sense — most commonly to align your settlement window with your refund policy, and occasionally for risk or compliance reasons. ## Minimum Payout Thresholds The minimum balance required to issue a payout varies based on the payout currency. Certain currencies have a higher limit due to Stripe requirements, and these limits can change. | Currency | Minimum Balance (USD) | | - | - | | USD | \$10.00 | | EUR | \$13.00 | | GBP | \$15.00 | | CHF | \$15.00 | | AOA | \$30.00 | | ALL | \$40.00 | | AMD | \$40.00 | | AZN | \$40.00 | | BAM | \$40.00 | | BOB | \$40.00 | | BTN | \$40.00 | | CLP | \$40.00 | | GHS | \$40.00 | | GMD | \$40.00 | | GYD | \$40.00 | | KHR | \$40.00 | | KRW | \$40.00 | | LAK | \$40.00 | | MDL | \$40.00 | | MGA | \$40.00 | | MKD | \$40.00 | | MNT | \$40.00 | | MYR | \$40.00 | | MZN | \$40.00 | | NAD | \$40.00 | | PYG | \$40.00 | | RSD | \$40.00 | | THB | \$40.00 | | TWD | \$40.00 | | UZS | \$40.00 | | COP | \$50.00 | | Other currencies | \$10.00 (default) | A handful of countries also enforce a higher minimum: | Country | Minimum Balance (USD) | | - | - | | Bahamas | \$30.00 | | El Salvador | \$30.00 | | Panama | \$50.00 | ## Stripe Payout Fees Each payout to your Stripe account carries a fee: 1. \$2 per month in which you have at least one active payout 2. 0.25% + \$0.25 per payout 3. Cross-border fees (currency conversion): 0.25% within the EU, up to 1% elsewhere ## Manual Withdrawal Because of those fixed per-payout costs, withdrawals are initiated manually rather than on an automatic schedule. This way you decide when to incur the fees and can batch earnings into fewer, larger payouts instead of paying overhead on every transaction. ## Reverse invoices Polar invoices your customers directly as the Merchant of Record. For your own accounting, you'll need to invoice Polar in return for each payout. You can generate a **reverse invoice** — detailing the sales we made on your behalf, minus our fees — from the **Payouts** page under **Finance** in your dashboard. Click the ellipsis next to a payout and select **Download invoice**. A modal will open, allowing you to: * Set your billing name and address. * Add information shown below your billing address — a good place for your VAT number or any other details your local tax rules require on an invoice. * Add notes shown at the bottom of the invoice. * Customize the invoice number. By default, we generate one like `POLAR-0001`, but you can change it to your own format and sequence. > [!WARNING] > > Once the reverse invoice is generated, it cannot be changed. Make sure to > double-check the information before generating it. ### Sample Reverse Invoice [https://polar-public-assets.s3.us-east-2.amazonaws.com/sample-reverse-invoice.pdf](https://polar-public-assets.s3.us-east-2.amazonaws.com/sample-reverse-invoice.pdf) ## Tax Forms ### 1099-K Form (US) Polar will issue 1099-K forms via Stripe to eligible users in the US on an annual basis. For a given tax year, 1099-K forms are required for users who cross a certain gross volume in USD and a certain number of transactions via Polar. **Why not a 1099-NEC or 1099-MISC?** TurboTax has [this great article](https://blog.turbotax.intuit.com/self-employed/1099-misc-or-1099-k-whats-the-difference-29903/) on the difference between 1099-K, 1099-NEC & 1099-MISC. > [!TIP] > > If you're self-employed and accept credit, debit, or prepaid cards, you may receive Form 1099-K for transactions processed by a third party. This includes creators, influencers, rideshare drivers, or side-giggers. If you're an online seller selling on platforms like Ebay, AirBnB, Etsy, and VRBO, you may also receive Form 1099-K. Stripe further clarifies 1099-K requirements for Payment Settlement Entities (PSE) in [this article](https://support.stripe.com/questions/intro-to-1099-k-tax-forms-for-platforms-and-marketplaces). Effectively, `1099-K` is required for platforms/marketplaces which: 1. Handle payment between someone providing goods/services to purchasers 2. Such payments are made with credit, debit, or prepaid cards 3. Receiver is not a contractor/freelancer to the platform/marketplace Polar meets all of these criteria and therefore issues 1099-K forms to eligible developers on the platform vs. other forms. ## Frequently Asked Questions > [accordion] How long do payouts take? > > Payouts typically take 4-7 business days. > [accordion] When are payouts processed after I request them? > > Payouts are processed in batches 24 hours after initiation. > [accordion] Can I use my personal bank account to receive payouts? > > For individual accounts, yes. For business accounts, you will need a business bank account. > [accordion] Why does my payout say 'Held for review'? > > You can request a payout at any time. [Account Reviews](/docs/merchant-of-record/account-reviews) are a normal part of how we operate, so if your account happens to be under review when you request one, the payout shows as "Held for review" until you are reviewed, then is paid out automatically. # Affonso Affiliates with Polar Source: https://polar.sh/docs/features/integrations/affonso This guide explains how to integrate [Affonso](https://affonso.io)'s affiliate marketing software with your Polar account to track and manage affiliate-driven sales for your SaaS business. ## What is Affonso? [Affonso](https://affonso.io) is an affiliate marketing software that enables SaaS businesses to launch, manage, and scale their own affiliate programs. With Affonso, you can: * Set up flexible commission structures * Manage multiple affiliate programs from one dashboard * Provide your affiliates with real-time tracking and marketing resources * Automate affiliate payments and commission calculations ## Integration Steps ### 1. Create a Polar Access Token for Affonso First, you'll need to create an API token in Polar that Affonso can use to communicate with your account: 1. Login to your **Polar Dashboard** 2. Navigate to [**Settings → Access Tokens**](https://polar.sh/to/dashboard/settings/access-tokens) 3. Click the **Create token** button 4. Give your token a name (e.g., "Affonso Integration") 5. Set token expiration to **No expiration** Important: If you set an expiration date, you'll need to manually update the token in Affonso when it expires. Tracking will stop working if the token expires. 6. Enable all the following scopes: * discounts:read * discounts:write * events:read * subscriptions:read * customers:read * customers:write * orders:read * refunds:read * webhooks:read * webhooks:write 7. Click **Create token** and copy the generated token 8. Provide this token to Affonso by entering it [in their integration settings](https://affonso.io/app/affiliate-program/connect) ### 2. Set Up Webhooks in Polar After connecting your Polar account with Affonso, you'll [receive a webhook URL and secret from Affonso](https://affonso.io/app/affiliate-program/connect). Add these to your Polar account: 1. Go to [**Settings → Webhooks**](https://polar.sh/to/dashboard/settings/webhooks) in your Polar Dashboard 2. Click the **"Add Endpoint"** button 3. In the URL field, paste the webhook URL provided by Affonso 4. For Format, select **RAW** from the dropdown 5. In the Secret field, paste the webhook secret provided by Affonso 6. Under Events, enable all of the following: * `order.created` * `order.refunded` * `subscription.canceled` 7. Click **Save** to complete the webhook setup ### 3. Add the Affonso Tracking Script to Your Website Add Affonso's tracking script to the `` tag of your website: ```html theme={null} ``` Replace `YOUR_AFFONSO_PROGRAM_ID` with the unique program ID provided by Affonso. This script should be placed on all pages of your website, including: * Your main marketing website * Your application domain * Any subdomains where users might land or make purchases ### 4. Track User Signups (Optional) For better conversion insights, you can track when users sign up through an affiliate link: ```javascript theme={null} // After successful registration window.Affonso.signup(userEmail); ``` ### 5. Pass Referral Data to Polar Checkout To ensure proper commission attribution, pass the referral data when creating checkout sessions: ```javascript theme={null} // Get the referral ID from the Affonso global variable const referralId = window.affonso_referral; // Create checkout session with Polar const checkout = await polar.checkouts.create({ products: ["your_product_id"], success_url: "https://your-app.com/success", metadata: { affonso_referral: referralId, // Include referral ID from Affonso } }); // Redirect to checkout window.location.href = checkout.url; ``` ## How It Works 1. When a user visits your site through an affiliate link, Affonso's script stores a unique identifier in a cookie 2. If you've implemented signup tracking, Affonso records when the user creates an account 3. When the user makes a purchase, the referral ID is passed to Polar as metadata 4. Polar's webhook notifies Affonso about the purchase 5. Affonso attributes the sale to the correct affiliate and calculates the commission ## Benefits of the Integration * **Automated Tracking**: No manual work required to track affiliate-driven sales * **Real-Time Analytics**: Both you and your affiliates get immediate insights into performance * **Seamless User Experience**: The integration works behind the scenes without affecting your checkout flow * **Flexible Commission Structures**: Set up complex commission rules based on product, subscription duration, etc. ## Getting Help More details about the integration: [Polar Affiliate Program](https://affonso.io/polar-affiliate-program) If you need assistance with your Affonso integration, contact Affonso's support team: * Email: [hello@affonso.io](mailto:hello@affonso.io) * Live chat: Available directly in the Affonso dashboard # Polar Integration in Fernand Source: https://polar.sh/docs/features/integrations/fernand Learn how to sync customer and payment data from Polar to Fernand. ![](https://mintcdn.com/polar/fnujBPxaFvfkZfB0/assets/features/integrations/fernand/overview.png?fit=max\&auto=format\&n=fnujBPxaFvfkZfB0\&q=85\&s=b88538e65544e963bc3d58002ae490a9) ## What is Fernand? [Fernand](https://getfernand.com/) is a modern customer support tool designed for SaaS — it’s fast, calm, and built to reduce the anxiety of answering support requests. ## How it works After connecting your [Polar](https://polar.sh/) account to Fernand, you’ll be able to see customer payment information and product access details directly within each customer conversation. This enables you to: * Instantly verify if someone is an active customer * Prioritize conversations from high-tier plans * View product purchases and payment history in context *** ## How to connect Fernand with Polar ![](https://mintcdn.com/polar/fnujBPxaFvfkZfB0/assets/features/integrations/fernand/enable.png?fit=max\&auto=format\&n=fnujBPxaFvfkZfB0\&q=85\&s=fd7b3bb222aaf0f953bb3380b6191ae3) 1. Open [Integrations](https://app.getfernand.com/settings/organization/integrations) in your Fernand organization settings. 2. Click on **Connect Polar**. 3. You'll be redirected to Polar to authorize the connection. 4. Once approved, Fernand will begin syncing customer data automatically. That’s it! You’ll now see Polar customer info directly in Fernand's conversation list and sidebar. *** ## How to automate your inbox with Polar data Once Polar is connected, you can create automation rules in Fernand based on Polar data. Let’s walk through a basic example: auto-replying to all customers on your `Pro` plan. ![](https://mintcdn.com/polar/fnujBPxaFvfkZfB0/assets/features/integrations/fernand/inbox.png?fit=max\&auto=format\&n=fnujBPxaFvfkZfB0\&q=85\&s=d4e253667c841e2223bd94db3b34f409) ### Create a new rule **1. Create a new rule** 1. Go to [Rules](https://app.getfernand.com/settings/organization/rules) in Fernand. 2. Click `Add rule` and give it a descriptive name. ![](https://mintcdn.com/polar/fnujBPxaFvfkZfB0/assets/features/integrations/fernand/create-rule.png?fit=max\&auto=format\&n=fnujBPxaFvfkZfB0\&q=85\&s=25780e683d3c9796dde3245b65915c04) **2. Select a trigger** This ensures the rule runs on each new customer message. ![](https://mintcdn.com/polar/fnujBPxaFvfkZfB0/assets/features/integrations/fernand/rule-trigger.png?fit=max\&auto=format\&n=fnujBPxaFvfkZfB0\&q=85\&s=aeff3403e656453aa466b014e60b576b) **3. Select a condition** Now add a condition based on Polar data. For example: * `Contact is a customer...` * `Contact has paid plan...` You can target specific plans (e.g. `Pro`, `Business`) or specific products to personalize support or automate prioritization. ![](https://mintcdn.com/polar/fnujBPxaFvfkZfB0/assets/features/integrations/fernand/rule-conditions.png?fit=max\&auto=format\&n=fnujBPxaFvfkZfB0\&q=85\&s=7ed92fcbca3e73c386624f3fadd59e0f) **4. Select an action** Now define what happens when the rule matches. For example: * Send an auto reply (with variables) * Assign the conversation to a specific agent * Tag the conversation with `priority` or `paid` * Trigger a webhook for external automation ![](https://mintcdn.com/polar/fnujBPxaFvfkZfB0/assets/features/integrations/fernand/action.png?fit=max\&auto=format\&n=fnujBPxaFvfkZfB0\&q=85\&s=5991fcfc0687d4cc116fc5e67da3b579) ### Disconnecting the integration If you ever want to disconnect Polar from your Fernand workspace: **1. Go to the Integrations page.** **2. Click Disconnect next to Polar.** Deleting your organization on Fernand will also remove the Polar integration automatically. # Polar for Framer Source: https://polar.sh/docs/features/integrations/framer The fastest way to sell digital products on your Framer site Introducing the official Polar plugin for Framer. Allowing you to sell products on your site without having to build a custom checkout flow. ![](https://www.framer.com/marketplace/_next/image/?url=https%3A%2F%2Fy4pdgnepgswqffpt.public.blob.vercel-storage.com%2Fplugins%2F174-egCWZYwZbpLc42xnGQIY42F1KqtNDk\&w=1920\&q=100) ## Getting Started [Get your hands on the Polar plugin in the Framer Marketplace](https://www.framer.com/marketplace/plugins/polar/) # Purchase Power Parity with ParityDeals Source: https://polar.sh/docs/features/integrations/paritydeals Offer products with different price across the globe Want to offer different prices in different countries? [ParityDeals](https://www.paritydeals.com/) offers [automatic pricing optimizations depending on customers geolocation](https://www.paritydeals.com/features/purchasing-power-parity-discounts/) and a seamless integration with Polar. ## Simple Integration, Powerful Deals * You can easily and securely (OAuth 2.0) connect Polar to ParityDeals * Select products on Polar to offer deals for * Configure deals by country or holidays * ParityDeals automatically creates and manages discounts on Polar * Showing them to customers based on time and geolocation (unless VPN is detected) * Offering great & local deals internationally with ease ## Setup Guide ### Signup to ParityDeals Go to [app.paritydeals.com](http://app.paritydeals.com) and sign up. ### Connect Polar on ParityDeals In your ParityDeals dashboard, click `Create Deals` > `Create Deals with Polar`. ![](https://mintcdn.com/polar/fnujBPxaFvfkZfB0/assets/features/integrations/paritydeals/connect.light.png?fit=max\&auto=format\&n=fnujBPxaFvfkZfB0\&q=85\&s=380b19a4b436cc7144fe70555ac48ee4) ### Grant ParityDeals Access (OAuth 2.0) No need to create API access keys and share them externally. Just connect securely and grant the necessary permissions using Polar OAuth 2.0. ![](https://mintcdn.com/polar/fnujBPxaFvfkZfB0/assets/features/integrations/paritydeals/grant.light.png?fit=max\&auto=format\&n=fnujBPxaFvfkZfB0\&q=85\&s=d38ee9aaa7efe1e936f0f65847fcfe30) ### Choose Products Now, let's select the Polar products you want to offer deals for. ![](https://mintcdn.com/polar/fnujBPxaFvfkZfB0/assets/features/integrations/paritydeals/choose-products.light.png?fit=max\&auto=format\&n=fnujBPxaFvfkZfB0\&q=85\&s=389665fb4c7b0433696ee3127849acb2) ### Configure Deals Let's configure our deal settings. * Enter your website URL (requires your own site vs. Polar storefront) * Enter a targeted URL path, e.g `/pricing` to only show deals on that page ![](https://mintcdn.com/polar/fnujBPxaFvfkZfB0/assets/features/integrations/paritydeals/create-deals.light.png?fit=max\&auto=format\&n=fnujBPxaFvfkZfB0\&q=85\&s=949909121fedb3cb385841126059b886) Now we can configure the deals for different countries. ParityDeals offers great defaults, but you can of course change them. ![](https://mintcdn.com/polar/fnujBPxaFvfkZfB0/assets/features/integrations/paritydeals/customize-deals.light.png?fit=max\&auto=format\&n=fnujBPxaFvfkZfB0\&q=85\&s=437db4cc1c875c1a43312801267e1edf) ### Configure Banner You can then customize the ParityDeals banner to suit your site and design. ![](https://mintcdn.com/polar/fnujBPxaFvfkZfB0/assets/features/integrations/paritydeals/customize-banner.light.png?fit=max\&auto=format\&n=fnujBPxaFvfkZfB0\&q=85\&s=768323a8222a26b6279e33a29d58ed2f) ### Embed Banner Finally, we're all setup over at ParityDeals. Just copy the script to their banner and embed it on your site. You're now done 👏🏼 ![](https://mintcdn.com/polar/fnujBPxaFvfkZfB0/assets/features/integrations/paritydeals/success.light.png?fit=max\&auto=format\&n=fnujBPxaFvfkZfB0\&q=85\&s=f798f597faf884b32ded6cf493c0097b) ## Questions & Help Checkout the [ParityDeals documentation](https://www.paritydeals.com/docs/) for more guides and information. # Polar for Raycast Source: https://polar.sh/docs/features/integrations/raycast The fastest way to access Polar from your keyboard ![](https://mintcdn.com/polar/fnujBPxaFvfkZfB0/assets/features/integrations/raycast/hero.png?fit=max\&auto=format\&n=fnujBPxaFvfkZfB0\&q=85\&s=c0ee6608105a2797546bb31d14121345) ## Install Extension [Head over to Polar on the Raycast Store, and install it from there.](https://www.raycast.com/emilwidlund/polar) ### View Orders Easily view orders across organizations. ![](https://files.raycast.com/acvj8yffxqxbnv82lhtsnf7u7x29) ### View Subscriptions View all active subscriptions across your organizations. ![](https://files.raycast.com/y6he77j6ig6hchxbpxdcsd2i1yjf) ### View Customers Keep track of all your customers. # Polar for Zapier Source: https://polar.sh/docs/features/integrations/zapier Connect Polar to hundreds of other apps with Zapier [Zapier](https://zapier.com/apps/polar/integrations) lets you connect Polar to 2,000+ other web services. Automated connections called Zaps, set up in minutes with no coding, can automate your day-to-day tasks and build workflows between apps that otherwise wouldn't be possible. Each Zap has one app as the **Trigger**, where your information comes from and which causes one or more **Actions** in other apps, where your data gets sent automatically. > [!NOTE] > > We've focused on **triggers** (webhooks) for now, so you can react to events in Polar and trigger actions in other apps. > > Need to perform actions in Polar? Tell us about your use case [here](https://github.com/orgs/polarsource/discussions/new?category=integrations\&labels=integrations%2Fzapier) and we'll consider adding more actions in the future. ## Getting Started with Zapier Sign up for a free [Zapier](https://zapier.com/apps/polar/integrations) account, from there you can jump right in. To help you hit the ground running, you'll find popular pre-made Zaps below. ## How do I connect Polar to Zapier? Log in to your [Zapier account](https://zapier.com/sign-up) or create a new account. Navigate to "My Apps" from the top menu bar. Now click on "Connect a new account..." and search for "Polar" Use your credentials to connect your Polar account to Zapier. Once that's done you can start creating an automation! Use a pre-made Zap or create your own with the Zap Editor. Creating a Zap requires no coding knowledge and you'll be walked step-by-step through the setup. Need inspiration? See everything that's possible with [Polar and Zapier](https://zapier.com/apps/Polar/integrations). If you have any additional questions, you can open a ticket with Zapier Support from [https://zapier.com/app/get-help](https://zapier.com/app/get-help) ## Popular use cases # Orders Source: https://polar.sh/docs/features/orders Every paid transaction on Polar is an order. An **order** is the record of a single paid transaction on Polar. Every successful checkout, subscription cycle, and subscription change generates an order — it's where the money, the tax, the invoice, and the link back to the [product](/docs/features/products) and [customer](/docs/features/customer-management) live. If [subscriptions](/docs/features/subscriptions/introduction) are the *relationship* with a customer, orders are the *individual payments* inside that relationship. ## When orders are created Polar creates an order in all of these cases: * **One-time purchase** — when a customer checks out a non-recurring product. * **Subscription created** — the initial order generated when a customer subscribes. * **Subscription renewal** — every billing cycle of an active subscription. * **Subscription change** — when a plan or seat update is prorated with `invoice` behavior and charges the difference immediately. See [Proration](/docs/features/subscriptions/proration). * **Usage charge** — at the end of each meter period, for products with a [meter cycle](/docs/features/usage-based-billing/billing#meter-cycle) shorter than the billing interval. Each order carries a `billing_reason` that tells you which of these it is: `purchase`, `subscription_create`, `subscription_cycle`, `subscription_update`, or `subscription_meter_cycle`. ## Arbitrary charges Sometimes you need to charge a customer an amount that doesn't originate from a checkout or a subscription renewal — a usage overage, a one-off professional-services fee, or a manual top-up. Polar lets you run these **off-session charges** against a customer's saved payment method, without the customer being present. > [!NOTE] > > Off-session charges are currently in preview. You'll only be able to run off-session charges if > you are on a paid plan. An off-session charge is a two-step flow: you create a **draft order**, then **finalize** it to attempt the charge. Both endpoints require the `orders:write` scope and the sales-management permission on the organization. ### 1. Create a draft order `POST /v1/orders/` creates an order in `draft` status with no invoice number — nothing is charged yet. You reference an existing customer and a one-time product, and optionally override the amount and description: **customer_id** `string` *required* The customer to charge. Must belong to the organization. **product_id** `string` *required* A one-time product to charge for. Only fixed-price, free and unit-based products are supported. **units** `integer` The number of units to charge for. Required for unit-based products, rejected for any other pricing. The quantity shows on the invoice line, e.g. `Acme Credits (500 credits)`, unless `description` replaces the text. **amount** `integer` A custom amount in the smallest currency unit (e.g. `2500` for \$25.00). Overrides the product's price; defaults to it. Can't be combined with `units`. **currency** `string` ISO 4217, lowercase (e.g. `usd`). Defaults to the organization's currency. **description** `string` The line-item text shown on the invoice and receipt. Defaults to the product name. **organization_id** `string` Required unless you authenticate with an organization token. The customer must have a complete billing address (so Polar can calculate tax) and at least one saved payment method. ```bash cURL theme={null} curl --request POST \ --url https://api.polar.sh/v1/orders/ \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "customer_id": "", "product_id": "", "amount": 2500, "description": "5,000 extra tokens" }' ``` The response is the draft order, including its `id`. Creating a draft fires the `order.created` webhook but does not yet email the customer. ### 2. Finalize and charge `POST /v1/orders/{id}/finalize` synchronously attempts the off-session charge. By default it uses the customer's default payment method; pass `payment_method_id` to charge a specific one. ```bash cURL theme={null} curl --request POST \ --url https://api.polar.sh/v1/orders//finalize \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{}' ``` On success, the order transitions to `paid`, an invoice number is assigned, any [benefits](/docs/features/benefits/introduction) attached to the product are granted, the customer is emailed their confirmation, and the [`order.paid`](/docs/api-reference/current/order_paid) webhook fires. If the charge fails, the API returns an error and the order is reverted to `draft` so you can fix the problem and finalize the same order again — no invoice number is consumed by a failed attempt: | Status | When | | - | - | | `402` | The card was declined, the customer has no payment method, or the charge needs a 3DS / SCA challenge that can't be completed off-session. | | `403` | Off-session charges aren't enabled for the organization, or its account can't currently accept payments. | | `412` | The order is no longer in `draft` status (for example, it was already finalized). | ## Order status An order moves through a small set of statuses over its lifetime: | Status | Meaning | | - | - | | `pending` | The order has been created and Polar is attempting to collect payment. | | `paid` | The payment succeeded. | | `refunded` | The order has been fully refunded. | | `partially_refunded` | Part of the order has been refunded. See [Refunds](/docs/features/refunds). | | `void` | The order will not be collected (for example, it's been voided after repeated failures). | Free orders — those with a total of zero, typically from a \$0 subscription or a 100% discount — are marked `paid` immediately with no payment step. ## What's on an order Every order carries: * **Amounts**: subtotal, discount, tax, net, and total, with the currency it was billed in. * **Billing details**: customer billing name and address (editable until the invoice is generated). * **Tax details**: taxability reason, tax rate, and the amount collected — useful if you're operating as merchant of record on your own, or reconciling against Polar's [MoR tax handling](/docs/merchant-of-record/introduction). * **A link to the product and customer**, and to the subscription if the order came from a subscription. * **The invoice**, once it's been generated. * **[Custom field data](/docs/features/custom-fields)** captured at checkout. ## Invoices Polar generates a PDF invoice for every paid order. You can: * **Download it** from the order detail page in the dashboard. * **Trigger generation** programmatically via [Generate Order Invoice](/docs/api-reference/current/orders/generate-order-invoice), then fetch the URL with [Get Order Invoice](/docs/api-reference/current/orders/get-order-invoice). Customers can download and edit their own invoices — adding a company name, VAT number, or billing address — from the [Customer Portal](/docs/features/customer-portal/introduction), without pulling you into a support thread. > [!NOTE] > > Once an invoice has been generated, its billing details are frozen. If you need to correct a name > or address after the fact, the customer should edit their invoice from the Customer Portal, which > regenerates it. ## Receipts A **receipt** is the proof of payment for an order — what was charged, how, and what's been refunded since. Polar issues one for every paid order and assigns a per-customer number in the form `RCPT-{customer-id}-{NNNN}`. Each receipt includes: * The **payment method** used (e.g. `Visa — 4242`), the **date paid**, and the **amount**. * Any **customer balance** applied to the order. * Any **refunds** issued against the order, with dates and amounts. * The same line items, taxes, totals, and linked invoice number as the order's invoice. You can **download receipts** from the order detail page in the dashboard, and customers download receipts from the [Customer Portal](/docs/features/customer-portal/introduction) — a **Download Receipt** button appears on each paid order. Programmatically, use [Get Order Receipt](/docs/api-reference/current/orders/get-order-receipt) for the merchant API or its [customer-portal counterpart](/docs/api-reference/current/customer_portal/get-order-receipt). The first request for a given order may return `202 Accepted` while the PDF renders. Retry shortly after for a presigned download URL. The Customer Portal handles this for you. ## Refunds Orders can be refunded in full or in part from the dashboard, or programmatically via the [Refunds API](/docs/api-reference/current/refunds/create-refund). Refunds are a separate resource linked to the order — see [Refunds](/docs/features/refunds) for the rules around what's refundable and how it interacts with payouts. ## Webhooks If you're integrating orders into your own system, Polar emits an event on every state transition: * [`order.created`](/docs/api-reference/current/order_created) — a new order exists (not necessarily paid yet). * [`order.paid`](/docs/api-reference/current/order_paid) — the order has been collected. This is the one most integrations care about. * [`order.updated`](/docs/api-reference/current/order_updated) — something changed on the order. * [`order.refunded`](/docs/api-reference/current/order_refunded) — a refund was issued against the order. ## Next steps > [card] [Subscriptions](/docs/features/subscriptions/introduction) > > The recurring relationship that generates most orders. > [card] [Refunds](/docs/features/refunds) > > How to refund an order, fully or partially. > [card] [Orders API](/docs/api-reference/current/orders/list-orders) > > List and fetch orders, update billing details, and generate invoices. > [card] [Customer Portal](/docs/features/customer-portal/introduction) > > Where customers view their own orders and download invoices and receipts. # Products Source: https://polar.sh/docs/features/products Start selling digital products on Polar in minutes. > [!NOTE] > > **Everything is a product** > > Subscriptions and one-time purchases are both products in Polar — same API, same data model, just different pricing and billing logic. They live together in the Products dashboard, filterable by pricing model. ## Billing cycle A product is either a **one-time purchase** or **recurring**. One-time products charge the customer once and grant access forever. Recurring products bill on an interval — daily, weekly, monthly, or yearly — and you can extend any of those with an interval count to express things like "every 2 weeks" or "every 3 months". The billing cycle and recurring interval are locked in at creation. If you need to change them later, create a new product instead. ## Pricing Polar supports several pricing models, and you pick one per product: * **Fixed price.** Set an amount and that's what customers pay. * **Pay what you want.** Customers choose the amount. You can set a minimum and a default that's pre-filled at checkout. * **Free.** No charge. Useful for lead magnets, free tiers, or gating benefits behind a sign-up. * **Metered pricing.** Charge based on usage — bill per API call, per token, per anything you can count. [Learn more about usage-based billing](/docs/features/usage-based-billing/introduction). * **Seat-based pricing.** Sell a number of seats with optional volume tiers, and let the buyer assign them to teammates. [Learn more about seat-based billing](/docs/features/seat-based-pricing). Metered prices stack on top of the others. You can pair one with a fixed base fee for a classic "base + usage" plan, and you can attach multiple metered prices to the same product if you want to bill on more than one dimension at once — say, per API call *and* per GB of storage. Pricing type is locked in at creation, but for fixed-price products you can change the amount at any time. Existing subscribers are **grandfathered** onto the price they signed up at, so a price change only affects new purchases. If you do want to migrate someone onto the new price, you can do it [per subscription](/docs/features/subscriptions/manage) from the dashboard or the API. Whether the amount you enter includes tax or has tax added on top depends on your tax behavior setting. By default, Polar picks the convention that matches the customer's country (inclusive in most of the world, exclusive in the US, Canada, and India). You can set your own default under **Settings**. See [Tax Inclusive Pricing](/docs/features/tax-inclusive-pricing) for how the amount you set translates to what customers actually pay. ### Multiple payment currencies Products can be priced in several currencies at once so customers pay in their local currency. Your organization has a default payment currency that acts as the fallback, and you can add more on top. A price in the default currency is **required** — if you leave it empty, the product is treated as free. To price a product only in another currency, change your organization's default payment currency under **Settings** first. The price structure (price type, metered prices, etc.) must match across every currency you enable. Polar picks the currency based on the customer's geolocation at checkout. If their currency isn't enabled on the product, it falls back to your organization's default. > [!WARNING] > > **Creating checkout sessions from a backend or proxy?** Polar reads the customer's geolocation from the IP address of the request that creates the session. If you create sessions server-side (an API, a Cloudflare Worker, etc.), Polar sees *your server's* IP and may pick the wrong currency. > > Forward the customer's IP as [`customer_ip_address`](/docs/features/checkout/session#customer-ip-address) when creating the session. > [accordion] Supported currencies > > Polar supports 130+ currencies for product pricing: > > | Code | Currency | > | - | - | > | `AED` | United Arab Emirates Dirham | > | `ALL` | Albanian Lek | > | `AMD` | Armenian Dram | > | `AOA` | Angolan Kwanza | > | `ARS` | Argentine Peso | > | `AUD` | Australian Dollar | > | `AWG` | Aruban Florin | > | `AZN` | Azerbaijani Manat | > | `BAM` | Bosnia-Herzegovina Convertible Mark | > | `BBD` | Barbadian Dollar | > | `BDT` | Bangladeshi Taka | > | `BIF` | Burundian Franc | > | `BMD` | Bermudan Dollar | > | `BND` | Brunei Dollar | > | `BOB` | Bolivian Boliviano | > | `BRL` | Brazilian Real | > | `BSD` | Bahamian Dollar | > | `BWP` | Botswanan Pula | > | `BZD` | Belize Dollar | > | `CAD` | Canadian Dollar | > | `CDF` | Congolese Franc | > | `CHF` | Swiss Franc | > | `CLP` | Chilean Peso | > | `CNY` | Chinese Yuan | > | `COP` | Colombian Peso | > | `CRC` | Costa Rican Colón | > | `CVE` | Cape Verdean Escudo | > | `CZK` | Czech Koruna | > | `DJF` | Djiboutian Franc | > | `DKK` | Danish Krone | > | `DOP` | Dominican Peso | > | `DZD` | Algerian Dinar | > | `EGP` | Egyptian Pound | > | `ETB` | Ethiopian Birr | > | `EUR` | Euro | > | `FJD` | Fijian Dollar | > | `FKP` | Falkland Islands Pound | > | `GBP` | British Pound | > | `GEL` | Georgian Lari | > | `GIP` | Gibraltar Pound | > | `GMD` | Gambian Dalasi | > | `GNF` | Guinean Franc | > | `GTQ` | Guatemalan Quetzal | > | `GYD` | Guyanaese Dollar | > | `HKD` | Hong Kong Dollar | > | `HNL` | Honduran Lempira | > | `HTG` | Haitian Gourde | > | `HUF` | Hungarian Forint | > | `IDR` | Indonesian Rupiah | > | `ILS` | Israeli New Shekel | > | `INR` | Indian Rupee | > | `ISK` | Icelandic Króna | > | `JMD` | Jamaican Dollar | > | `JPY` | Japanese Yen | > | `KES` | Kenyan Shilling | > | `KGS` | Kyrgystani Som | > | `KHR` | Cambodian Riel | > | `KMF` | Comorian Franc | > | `KRW` | South Korean Won | > | `KYD` | Cayman Islands Dollar | > | `KZT` | Kazakhstani Tenge | > | `LAK` | Laotian Kip | > | `LKR` | Sri Lankan Rupee | > | `LRD` | Liberian Dollar | > | `LSL` | Lesotho Loti | > | `MAD` | Moroccan Dirham | > | `MDL` | Moldovan Leu | > | `MGA` | Malagasy Ariary | > | `MKD` | Macedonian Denar | > | `MNT` | Mongolian Tugrik | > | `MOP` | Macanese Pataca | > | `MUR` | Mauritian Rupee | > | `MVR` | Maldivian Rufiyaa | > | `MWK` | Malawian Kwacha | > | `MXN` | Mexican Peso | > | `MYR` | Malaysian Ringgit | > | `MZN` | Mozambican Metical | > | `NAD` | Namibian Dollar | > | `NGN` | Nigerian Naira | > | `NIO` | Nicaraguan Córdoba | > | `NOK` | Norwegian Krone | > | `NPR` | Nepalese Rupee | > | `NZD` | New Zealand Dollar | > | `PAB` | Panamanian Balboa | > | `PEN` | Peruvian Sol | > | `PGK` | Papua New Guinean Kina | > | `PHP` | Philippine Peso | > | `PKR` | Pakistani Rupee | > | `PLN` | Polish Zloty | > | `PYG` | Paraguayan Guarani | > | `QAR` | Qatari Riyal | > | `RON` | Romanian Leu | > | `RSD` | Serbian Dinar | > | `RWF` | Rwandan Franc | > | `SAR` | Saudi Riyal | > | `SBD` | Solomon Islands Dollar | > | `SCR` | Seychellois Rupee | > | `SEK` | Swedish Krona | > | `SGD` | Singapore Dollar | > | `SHP` | St. Helena Pound | > | `SOS` | Somali Shilling | > | `SRD` | Surinamese Dollar | > | `SZL` | Swazi Lilangeni | > | `THB` | Thai Baht | > | `TJS` | Tajikistani Somoni | > | `TOP` | Tongan Paʻanga | > | `TRY` | Turkish Lira | > | `TTD` | Trinidad & Tobago Dollar | > | `TWD` | New Taiwan Dollar | > | `TZS` | Tanzanian Shilling | > | `UAH` | Ukrainian Hryvnia | > | `UGX` | Ugandan Shilling | > | `USD` | US Dollar | > | `UYU` | Uruguayan Peso | > | `UZS` | Uzbekistani Som | > | `VND` | Vietnamese Dong | > | `VUV` | Vanuatu Vatu | > | `WST` | Samoan Tala | > | `XAF` | Central African CFA Franc | > | `XCD` | East Caribbean Dollar | > | `XCG` | Caribbean Guilder | > | `XOF` | West African CFA Franc | > | `XPF` | CFP Franc | > | `YER` | Yemeni Rial | > | `ZAR` | South African Rand | > | `ZMW` | Zambian Kwacha | ## Trial period For recurring products, toggle **Enable trial period** to give customers a window where they aren't charged. Pick a number and a unit (days, weeks, months, or years) and Polar handles the rest. [Learn more about trials](/docs/features/subscriptions/trials). ## Metadata You can attach arbitrary key–value metadata to a product. It's not shown to customers, but it travels along on every order, subscription, and webhook tied to the product, which makes it useful for keeping track of internal IDs or categories that live outside Polar. ## Automated Benefits Benefits are what your customers actually get when they buy: license keys, Discord roles, GitHub repository access, file downloads, feature flags, or a custom benefit you wire up yourself. Polar grants and revokes benefits automatically as customers purchase, renew, or cancel. [Learn more about benefits](/docs/features/benefits/introduction). ## Checkout Page How your product is represented during checkout. ### Description Optional copy that appears on the checkout page. Use it to pitch the product, list what's included, or anything else that helps the customer commit. Markdown is supported. ### Product media Upload images to display on the checkout page. Images can be up to 10MB each, and you can re-arrange or remove them at any time. ### Checkout fields Collect extra information from customers at checkout — phone numbers, terms-of-service agreements, custom data you need for fulfillment, anything you want. Fields are defined once at the organization level and then enabled per product, where you also choose whether each one is required. Supported field types: text, number, date, checkbox, and select. > [!NOTE] > > A required checkbox blocks confirmation until the customer ticks it. Handy for legal terms. The collected values show up on the resulting order or subscription. ## Update a product Most things on a product can be edited after the fact, except for the billing cycle and pricing type — those are locked in at creation. To change either, create a new product. A few things to know: * **Existing subscribers stay on their original price.** Changing a fixed price only affects new purchases. * **Benefit changes propagate.** Add a benefit and existing customers get it automatically. Remove one and they lose access. * **Need a similar product?** Use **Duplicate Product** from the product menu to clone an existing one as a starting point — handy for spinning up a yearly variant of a monthly plan, or for A/B testing pricing. ## Archive a product Products can be archived at any time. Click **Archive** from the product menu and the product disappears from new checkouts. Existing customers keep their access, and active subscriptions keep renewing. You can unarchive at any time from the same menu to make the product available again. ## Delete a product A product without an order, subscription, trial or discount can be permanently deleted. Archive it first, then click **Delete Permanently** from the product menu. The option only appears for products that aren't in use. ## FAQ > [accordion] What about variants? Can I sell a monthly and a yearly version of the same product? > > Polar takes a different approach to what the industry typically calls **variants**. Each product has a single pricing model, and instead of bolting variants onto one product, you create one product per pricing model and showcase them together at checkout. > > So a "monthly" and "yearly" plan are two products, each with their own pricing and benefits, presented side-by-side via [Checkout Links](/docs/features/checkout/links) or the [Checkout Session API](/docs/features/checkout/session). It keeps the API and the data model clean, and gives you full freedom over what each option includes. > [accordion] Can I change the price of a product after publishing it? > > Yes, for fixed-price products. Existing subscribers are grandfathered onto their original price and only new purchases see the updated amount — but you can move individual subscribers onto the new price [per subscription](/docs/features/subscriptions/manage) if you want. Billing cycle and pricing type can't change. > [accordion] Can I sell usage-based or metered products? > > Yes. Set the price type to **Metered** and link it to a meter that tracks the events you care about. Full walkthrough in the [usage-based billing guide](/docs/features/usage-based-billing/introduction). > [accordion] Can I sell team or per-seat plans? > > Yes, via [seat-based pricing](/docs/features/seat-based-pricing). The buyer purchases a number of seats and assigns them to teammates, who each get the product's benefits. > [accordion] Will customers see prices in their local currency? > > If you've enabled additional payment currencies on the product, yes — Polar matches the customer's geolocation to one of the enabled currencies. If there's no match, it falls back to your organization's default. See [Multiple payment currencies](#multiple-payment-currencies) above. > [accordion] Can I duplicate a product? > > Yes. From the product list or the product menu, pick **Duplicate Product** to clone all the settings into a new draft you can tweak before saving. # Manage Refunds Source: https://polar.sh/docs/features/refunds You can easily refund orders on Polar — both in full or in parts. No matter what refund policy you offer to customers, Polar makes it easy to issue both full and partial refunds, so you can deliver the customer experience and refund policy you want. > [!NOTE] > > **Polar can issue refunds on your behalf** > > Polar reserves the right to issue refunds within 60 days of purchase, at its own discretion, in order to prevent chargebacks. We integrate with credit card networks to receive early chargeback signals before a dispute is officially filed, and for lower-value transactions we'll automatically refund the order on your behalf to head off the chargeback — cancelling any related subscription and revoking the customer's benefits at the same time. > > This applies even if you have a "no refunds" policy: keeping chargebacks low protects your account, so Polar may still refund proactively. See [Chargeback Management](/docs/merchant-of-record/account-reviews#chargeback-management) for the wider context. ## What's refundable The maximum refundable amount on an order is the **net amount** (excluding tax) minus anything that's already been refunded, with any customer balance applied to the order taken into account. The corresponding **tax** is refunded automatically alongside it — fully on a full refund, prorated on a partial one. > [!WARNING] > > **Payment fees are not refunded** > > Credit card networks and payment processors charge us for the underlying transaction regardless of whether it's later refunded (industry standard). We therefore can't return our fees, since the cost remains. > > Example: an order of \$30 costs \~\$1.60 in fees to Polar. You can still refund the customer \$30, but the \~\$1.60 fee stays deducted from your balance. ## Issuing a refund 1. Go to the order details page for the specific order you want to refund. 2. Scroll down to the "Refunds" section. 3. Click "Refund order". ### Amount Specify the **net amount** to refund — i.e. the amount excluding tax. It defaults to the maximum refundable amount, but you can lower it to issue a partial refund. Polar **automatically calculates the corresponding tax** to refund based on the order's tax rate. For partial refunds, tax is prorated against the refunded portion; for a full refund, the entire remaining tax is returned. ### Reason Select the reason for the refund — helpful for future reference. ### Revoking benefits **One-time purchases.** You can revoke the customer's access to product benefits — e.g. file downloads, license keys, or Discord/GitHub invites. This is selected by default, since we default to a full refund, but it can be disabled. **Subscriptions.** You can't revoke access by refunding an order tied to a subscription — refunding the order returns the money but does not end the relationship. To end access, [cancel the subscription](/docs/features/subscriptions/manage) instead. Polar revokes the associated benefits automatically once the subscription itself is revoked. # Seat-Based Pricing Source: https://polar.sh/docs/features/seat-based-pricing Sell team products with assignable seats and tiered pricing Seat-based pricing allows you to sell products where a billing manager purchases a specific number of seats and can assign them to team members. Each seat holder gets their own access to the product benefits, making it perfect for team subscriptions, perpetual licenses, and multi-user products. > [!NOTE] > > **Seat-based pricing is ideal for:** > > * Team subscriptions where one billing manager pays for multiple users > * Perpetual team licenses with one-time payment > * Organizational licenses with per-seat pricing > * Products with flat, graduated, or volume-discounted seat pricing ## Customers and members Seat-based products separate who pays from who uses, modeled through three entities: * A **Customer** is the billing entity — who pays. They own subscriptions, orders, and payment methods. On their first seat-based purchase, the customer is permanently upgraded to `type: "team"`, which enables members and team management. * A **Member** is a person under a customer — who uses. Each member has their own email, role (`owner`, `billing_manager`, or `member`), and receives benefit grants independently. The purchaser becomes an `owner` member. Both `owner` and `billing_manager` roles can manage seats and the subscription. * A **CustomerSeat** is the link between a product and a member. It tracks assignment status (`pending`, `claimed`, `revoked`) and holds the invitation token. Because benefits are granted to members, not to the billing customer, always identify the end user by their member — not the customer who paid. ## How it works With seat-based pricing, a billing manager purchases a product (subscription or one-time) with a specific number of seats. They can then: 1. **Assign seats** to team members via email or external customer ID 2. **Manage seats** by resending invitations or revoking access 3. **Scale up** by purchasing additional seats (or a new order for one-time products) 4. **Track usage** by viewing which seats are claimed, pending, or available Team members receive an invitation email with a claim link. Once they claim their seat, benefits are automatically granted. ### Subscriptions vs One-Time Purchases | Feature | Subscriptions | One-Time Purchases | | - | - | - | | **Payment** | Recurring (monthly/yearly) | Single payment | | **Seat Duration** | Active while subscribed | Perpetual (never expire) | | **Adding Seats** | Modify subscription | Purchase new order | | **Benefits** | While subscription active | Forever after claim | > [!TIP] > > Use **subscriptions** for ongoing team access. Use **one-time purchases** for perpetual team licenses. ## Creating a seat-based product **1. Create a new product** From your dashboard, [create a new product](https://polar.sh/to/dashboard/products/new). **2. Configure basic settings** Set your product name, description, and media as usual. **3. Select seat-based pricing** Under **Pricing**, select: * **Product type**: Subscription or One-time * **Billing cycle** (subscriptions only): Monthly or Yearly * **Pricing type**: Seat-based **4. Choose a tiering model** Under **Tiering model**, select how seats are priced: | Model | Description | | - | - | | **Fixed price per seat** | Every seat costs the same flat rate. Simple and predictable. | | **Graduated** | Seats are priced per tier range independently — seats in tier 1 cost one rate, seats in tier 2 cost another. Total price is the sum across all tiers. | | **Volume discounts** | The per-seat price is determined by the total seats purchased, and that rate applies to all seats. Crossing a tier threshold lowers the price for everyone. | **Fixed price per seat** is the default and the simplest option — just enter a single price per seat. For **Graduated** and **Volume discounts**, define tiers using a threshold (the seat count at which a new rate begins) and a price per seat for that range. **Example** with tiers at 1–10 seats: \$10/seat and 11+ seats: \$8/seat: * Graduated: 14 seats = 10 × \$10 + 4 × \$8 = \$132 — each range is billed at its own rate * Volume discounts: 14 seats = 14 × \$8 = \$112 — all seats use the lowest matching rate **5. Add benefits** Configure the benefits that seat holders will receive. These are only granted when a seat is claimed, not when purchased. > [!NOTE] > > When using the default Polar confirmation page (no custom `success_url`), the buyer's seat is automatically claimed during checkout, granting them immediate access to benefits. Any remaining seats can be assigned to teammates. > > If you set a custom `success_url`, the buyer will need to manually assign themselves a seat through the Customer Portal or API if they also want benefits. ## Managing seats After purchase, the billing manager can assign and manage seats from the **Customer Portal** or via the API. ### Seat statuses * **Pending**: Seat assigned, invitation sent, awaiting claim * **Claimed**: Seat claimed by team member, benefits granted * **Revoked**: Seat revoked, benefits removed, can be reassigned ### Key actions * **Assign seats** by email, external customer ID, or existing Polar customer ID * **Resend invitations** for pending seats if the link expired (valid for 24 hours) * **Revoke seats** to remove benefits and free the seat for reassignment * **Reduce seat count** to lower the number of seats on the subscription (triggers a prorated credit) > [!WARNING] > > **Revoking a seat** and **reducing the seat count** are different actions: > > * **Revoking a seat** removes a specific user's access and frees that seat for reassignment. It does **not** reduce the number of seats on the subscription, and the billing manager continues to pay for the same total. > * **Reducing the seat count** changes the subscription quantity itself, which results in a prorated credit for the remainder of the billing period. > > To stop paying for an unused seat, you must reduce the seat count — not just revoke the assignment. ### Proration and billing adjustments When the seat count on a subscription changes mid-billing cycle, charges are prorated automatically: * **Adding seats**: The billing manager is charged immediately for the new seats, prorated for the remainder of the current billing period. The full per-seat price applies from the next billing cycle onward. * **Reducing seat count**: A prorated credit is applied for the removed seats, covering the unused portion of the current billing period. > [!TIP] > > Proration ensures billing managers only pay for seats during the time they are active. Encourage customers to adjust their seat count rather than leaving unused seats idle. ## Limitations * Seats must be assigned individually (no bulk import via dashboard, use API instead) * Claim links expire after 24 hours * Billing manager does not receive product benefits * Maximum of 1,000 seats per subscription * Metadata limited to 10 keys and 1KB total size per seat ## Next steps For implementation details including API integration, webhook handling, and code examples, see the [Implementing Seat-Based Pricing](/docs/guides/seat-based-pricing) guide. # Single Sign-On Source: https://polar.sh/docs/features/sso Let your team sign in to Polar through your own identity provider, and become members automatically. > [!NOTE] > > Single Sign-On is included in the **Scale** plan. Upgrade from [**Settings → > Billing**](https://polar.sh/to/dashboard/settings/billing) — SSO becomes available as soon as the > subscription is active. Single Sign-On connects your organization to your own identity provider. Your team signs in with the credentials they already use, and anyone who authenticates becomes a member of your organization. Polar supports any provider that implements OpenID Connect, including Google Workspace, Okta, Microsoft Entra ID, and Keycloak. SSO lives under [**Settings → SSO**](https://polar.sh/to/dashboard/settings/sso) in your dashboard. ## Company-managed accounts When you configure SSO for a verified email domain, Polar treats accounts using that domain as company-managed. Polar trusts your identity provider to authenticate those users, including users who already have a Polar account. The email address must belong to a domain verified by your organization and be marked as verified by your provider. Administrators who control your identity provider can authenticate as those users and control their Polar accounts, including account-level email and security settings. This authority extends to the user's identity across Polar, including access they hold in other organizations, subject to those organizations' own access requirements. Enforcing SSO is not required for this trust model to apply. Use a separate account with a personal email address for work that should remain outside your company's control. ## How people become members Anyone who signs in through your connection becomes a member of your organization. You don't invite them first — authenticating against your identity provider is what grants membership. New members join with the **Member** role. To grant more access, [change their role](/docs/features/team-management#changing-a-members-role) after their first sign-in. Your identity provider decides who can authenticate, so it also decides who can join. Grant and revoke access to the Polar application there. > [!WARNING] > > **Removing a member in Polar does not keep them out.** If they can still authenticate against your identity provider, they rejoin on their next sign-in. To remove someone's access, revoke it in your identity provider. Polar only accepts an identity whose email address your provider marks as verified. If the email is unverified, the sign-in is refused and no account is created. ## Setting up a connection You can only add a connection once you've verified a domain you own, so start there. **1. Verify your email domain** Go to [**Settings → Domains**](https://polar.sh/to/dashboard/settings/domains), enter the domain of your team's email addresses, and click **Add**. Add the TXT record shown to your DNS, then click **Verify**. **2. Add the connection in Polar** Go to [**Settings → SSO**](https://polar.sh/to/dashboard/settings/sso) and click **Add connection**. Pick **Google Workspace** or **Custom OIDC provider**. **3. Register the callback URL** Copy the **Callback URL** shown at the top of the form and register it as a redirect URI in your identity provider. **4. Fill in the provider details** Enter the **Issuer URL** and **Client ID** from your provider. You can paste the discovery URL into the issuer field — Polar strips the `/.well-known/openid-configuration` suffix. For **Client secret** authentication, paste the secret. For **Private key JWT**, copy the **JWKS URL** into your provider so it can fetch Polar's public keys. **5. Enable it** Connections are created disabled. Once your provider is configured, click **Enable** on the connection row. Share the **Login link** from the SSO settings page with your team. It takes them straight to your organization's sign-in page. ### Authorization parameters You can append extra parameters to the authorization request. The most common is `hd`, which pins a Google Workspace domain so users outside it can't sign in. Polar sets `response_type`, `client_id`, `redirect_uri`, `scope`, `state`, `nonce`, and the PKCE parameters itself. You can't override them. ## Enforcing SSO By default, members can sign in either through SSO or through the standard methods — email code, Google, GitHub, or Apple. Enforcing SSO removes the alternatives: members reach your organization only through your identity provider. To enforce it, you need an enabled connection and a verified domain, and you must already be signed in through this organization's SSO. That proves the connection works before it becomes the only way in. Once SSO is enforced, anyone who signs in with an email address on your verified domain goes straight to your identity provider. With several connections, they pick one on your organization's SSO sign-in page. > [!WARNING] > > Enforcing SSO disconnects every member and every authorized third-party app. They must sign in again through your identity provider. Enforcement makes your identity provider the only door. Anyone who can't authenticate there loses access, including members you invited by email — they keep their membership, but they can't reach the organization until you add them to your provider. You can stop enforcing at any time from the same screen. > [!NOTE] > > Enforcement applies to dashboard sessions. Personal access tokens and organization access tokens keep working, so scripts and integrations aren't interrupted. ## Frequently asked questions > [accordion] Do members need a Polar account before their first sign-in? > > No. Polar creates the account on their first sign-in through your connection, and adds them to your organization. > [accordion] What happens to someone who already has a Polar account? > > They keep it. Signing in through your connection adds your organization to their existing account instead of creating a second one. Accounts using your verified domain are company-managed: your identity provider is trusted for the whole Polar identity, including account-level settings and access to other organizations, subject to those organizations' own access requirements. Use a separate account with a personal email address for independent work. > [accordion] Can I still invite members by email? > > Yes, as long as you don't enforce SSO. [Invitations](/docs/features/team-management#inviting-a-member) work alongside it, which is useful for contractors who aren't in your identity provider. > > Once you enforce SSO, invitations stop being a way in. The invited person becomes a member, but reaching your organization requires signing in through your identity provider. Add them there instead. > [accordion] Can I use more than one identity provider? > > Yes. Add a connection per provider. Each one appears as a separate button on your organization's sign-in page, so give them names. > [accordion] How do I remove someone's access? > > Revoke their access to the Polar application in your identity provider. Removing them in Polar alone doesn't stop them from rejoining on their next sign-in. > [accordion] What happens if I leave the Scale plan? > > SSO turns off, and enforcement is lifted with it, so your members sign in with the standard methods again. Your connections are kept — upgrading to Scale again restores them as they were. Everyone who joined through SSO stays a member. # Recovering failed payments Source: https://polar.sh/docs/features/subscriptions/failed-payments How Polar retries failed renewals before revoking a subscription. When a subscription renews, Polar advances it to the next billing cycle first, then attempts to charge the customer's default payment method for the new order. If that charge fails, the subscription moves to `past_due` and enters Polar's automated **payment recovery** (dunning) flow instead of being canceled straight away. This page explains exactly what happens during that window, how to give yourself breathing room before benefits are revoked, and what levers you have to help the customer recover. ## The retry schedule As soon as the first renewal charge fails: 1. The subscription's status moves from `active` to `past_due`, and `past_due_at` is stamped with the time of the failure. 2. Polar emails the customer to let them know the charge failed and links them to the [Customer Portal](/docs/features/customer-portal/introduction) so they can update their default payment method. 3. The renewal order stays open with `next_payment_attempt_at` set to the next retry time. Polar then retries the charge on a fixed schedule, starting from the time of the first failure: | Attempt | Delay from previous | Cumulative time from first failure | | - | - | - | | 1st retry | 2 days | 2 days | | 2nd retry | 5 days | 7 days | | 3rd retry | 7 days | 14 days | | 4th retry | 7 days | 21 days | If a retry succeeds, the failed order is paid. The subscription returns to `active` once all of its pending orders have been paid (past-due subscriptions keep cycling, so there can be more than one). If all four retries fail — or the payment's decline code indicates the method will never succeed (for example, `lost_card`) — Polar stops retrying and **revokes the subscription**. Its status moves to `canceled` and benefits are revoked (subject to the grace period below). ## Benefit revocation grace period By default, benefits follow the subscription's status strictly: the moment the subscription leaves `active`, benefits are revoked. For many businesses that's harsh — a single expired card shouldn't instantly lock a paying customer out while they update their details. Polar has an organization-level **grace period** that holds off benefit revocation while a subscription is in `past_due`. You can set it under **Settings → Subscriptions → Grace period for benefit revocation**. The available values are: * **Immediately** (default) — revoke benefits as soon as the subscription leaves `active`. * **After 2 days** * **After 7 days** * **After 14 days** * **After 21 days** — benefits stay granted for the full length of the retry schedule. The grace period is measured from `past_due_at`. While it's in effect the subscription is still `past_due` (so you can differentiate it in your own app), but the customer retains access to their benefits. Once the grace period expires — or the subscription is revoked for good — benefits are revoked on the next check. > [!NOTE] > > The grace period only delays **benefit revocation**. It does not change the > retry schedule, and it does not keep the subscription `active`. If you want > to treat past-due subscribers specially (for example, with a banner or > a reduced feature set), listen for the > [`subscription.updated`](/docs/api-reference/current/subscription_updated) webhook > and branch on `status === "past_due"`. ## Helping customers recover The most reliable way for a customer to get back into `active` is to update their default payment method from the [Customer Portal](/docs/features/customer-portal/introduction). As soon as the payment method is updated, Polar retries the charge immediately rather than waiting for the next scheduled attempt. Things you can do from your side: * Link prominently to the Customer Portal from your own app when a customer is `past_due`. * [Issue a refund](/docs/features/refunds) on the original failed order if you want to credit the customer for the lost time while keeping the subscription. * [Reschedule the renewal](/docs/features/subscriptions/manage#reschedule-the-next-renewal) to give the customer extra time before the next attempt. * [Revoke the subscription](/docs/features/subscriptions/manage#revoke-immediately) manually if you've decided not to pursue recovery. # Subscriptions Source: https://polar.sh/docs/features/subscriptions/introduction Recurring revenue on top of your products. A **subscription** is the recurring relationship between a customer and one of your [products](/docs/features/products). It's created automatically whenever a customer checks out a product that has a recurring price, and it keeps generating orders on each renewal until the customer or you decide to end it. ## How subscriptions work 1. **A customer subscribes.** When a customer completes a [checkout](/docs/features/checkout/session) for a product that has a recurring price, Polar creates a `subscription` and the first [order](/docs/features/orders). 2. **Polar renews it automatically.** At the end of each billing period, Polar advances the subscription to the next cycle and creates a new order, then attempts to charge the customer's default payment method. If the payment fails, the subscription moves to `past_due` and Polar runs an automated [payment recovery flow](/docs/features/subscriptions/failed-payments). 3. **Benefits stay in sync.** As long as the subscription is active or trialing, the customer keeps access to all the [benefits](/docs/features/benefits/introduction) attached to the product. When the subscription ends, those benefits are revoked. 4. **Customers self-serve from the portal.** The [Customer Portal](/docs/features/customer-portal/introduction) lets customers update their payment method, download invoices, cancel, and — if you allow it — change plans or manage seats. ## Recurring pricing Subscriptions are driven entirely by the way you price the underlying product. Recurring pricing is configured when you [create a product](/docs/features/products#pricing): * **Billing interval.** Daily, weekly, monthly or yearly. * **Interval count.** The number of units per cycle. Setting this to `2` with a `month` interval gives you "every 2 months". * **Pricing type.** Fixed, pay-what-you-want, or free. Free recurring products are still modeled as subscriptions — they just never generate a payment. * **Currency.** A product can have prices in multiple currencies; the subscription locks in the currency used at checkout. > [!NOTE] > > The billing interval and pricing type are fixed once a product is created. If > you need a different interval (for example, a yearly plan next to a monthly > one), create a separate product and show both at checkout. See > [Products → Variants](/docs/features/products#variants). ## Renewal reminders For subscriptions on long billing cycles — six months or more — Polar emails the customer **7 days before the renewal date** to let them know an upcoming charge is coming. This helps with regulations (like the EU's Consumer Rights Directive) that require advance notice on long-interval renewals, and avoids surprise charges that often end in chargebacks. The threshold is six months, however it is expressed: yearly plans, monthly plans with an interval of 6 or more, weekly plans of 25 or more, and daily plans of 180 or more all get the reminder. Reminders are skipped for free subscriptions and for subscriptions already scheduled to cancel at period end. You can turn renewal reminders off under [**Settings → Customer Notifications**](https://polar.sh/to/dashboard/settings/customer-notifications) if you prefer to handle that communication yourself. ## Cancellation A subscription can end in one of two ways, both available to you and your customers: * **Cancel at period end** — the subscription keeps working until `current_period_end`, then transitions to `canceled`. You can reverse this (uncancel) until the end date is reached. * **Revoke immediately** — the subscription moves to `canceled` right away and benefits are revoked. This is irreversible. See [Managing subscriptions](/docs/features/subscriptions/manage) for how to perform these actions and everything else merchants can do from the dashboard or the API. ## Creating subscriptions There are two ways a subscription can come into existence: * **Through checkout.** The default. Works for any paid recurring product. See [Checkout](/docs/features/checkout/session). * **Through the API, for free recurring products only.** You can call [Create Subscription](/docs/api-reference/current/subscriptions/create-subscription) to subscribe an existing customer to a free product — no order, no email, no charge. This is useful for freemium onboarding flows where you want every signup to have a subscription tied to it from day one. Paid products always go through checkout so that Polar can collect and validate the payment method. ## Next steps > [card] [Managing subscriptions](/docs/features/subscriptions/manage) > > Change plans, seats, trials, billing dates, cancel or revoke — from the > dashboard or the API. > [card] [Proration](/docs/features/subscriptions/proration) > > Control how the price difference is handled when a subscription is upgraded > or downgraded. > [card] [Recovering failed payments](/docs/features/subscriptions/failed-payments) > > How Polar retries failed renewals and when benefits are revoked. > [card] [Subscriptions API](/docs/api-reference/current/subscriptions/list-subscriptions) > > List, create, update, and revoke subscriptions programmatically. ## FAQ > [accordion] What's the difference between a subscription and a product? > > A product is the thing you're selling — name, description, benefits, > pricing. A subscription is one specific customer's ongoing relationship > with that product. > > Polar treats one-time purchases and recurring subscriptions as the same > kind of object (both are "products"); the only difference is whether the > price is recurring. See [Products](/docs/features/products) for the full model. > [accordion] Can a customer have more than one active subscription? > > By default, no — a customer can only have one active subscription per > organization at a time. This keeps the common case simple. > > If your product genuinely needs multiple parallel subscriptions per > customer, you can opt in under **Organization Settings → Subscriptions** > by toggling on **Allow multiple subscriptions**. > [accordion] When is a customer actually charged? > > At the end of each billing cycle. When a subscription renews, Polar > advances the cycle, creates a new order with tax and any applicable > discount, and charges the customer's default payment method. If the > charge fails the subscription moves to `past_due` and Polar starts the > [payment recovery flow](/docs/features/subscriptions/failed-payments). > > The first charge happens at checkout (or when the [trial](/docs/features/subscriptions/trials) > ends, if one is configured). > [accordion] Can I change the price of an existing subscription? > > Not the amount on an existing subscription directly — subscriptions lock > in the price they were created with so existing subscribers aren't > surprised by changes. > > If you update the price on a product, the change applies only to **new** > subscriptions. To move an existing subscriber to different pricing, > either create a new product and run an [update to switch them to > it](/docs/features/subscriptions/manage#change-the-plan), or ask them to > change plans themselves from the Customer Portal. > [accordion] What happens to benefits when a subscription is canceled? > > Benefits are tied to the subscription's status, not to the cancellation > action itself: > > * If you **cancel at period end**, the customer keeps their benefits > until `current_period_end` — they paid for that period. > * If you **revoke immediately**, the subscription becomes `canceled` > right away and all benefits are revoked. > * If a renewal payment can't be recovered after Polar's retries, the > subscription moves to `unpaid` and benefits are revoked the same way > as a revoke — subject to the optional > [grace period](/docs/features/subscriptions/failed-payments#benefit-revocation-grace-period) > you can configure on your organization. # Managing subscriptions Source: https://polar.sh/docs/features/subscriptions/manage Everything you can do to a subscription after it's been created. Once a subscription exists, you'll want to adjust it over time — change plans, extend trials, tweak seats, or end it. This page covers everything a merchant can do to a subscription, both from the dashboard and through the API. All of these actions are available under **Sales → Subscriptions** in the dashboard, and via the [Update Subscription](/docs/api-reference/current/subscriptions/update-subscription) endpoint. Customers can also perform a subset of them from the [Customer Portal](/docs/features/customer-portal/introduction) — which ones is controlled by your [portal settings](/docs/features/customer-portal/settings). ## Change the plan Switch a subscription to a different recurring product — the standard upgrade or downgrade flow. * When the change takes effect depends on the [proration behavior](/docs/features/subscriptions/proration): `invoice` and `prorate` apply the new product immediately, `next_period` schedules a pending update that's only applied at the start of the next billing cycle, and `auto` applies upgrades immediately and schedules downgrades (during a trial, it applies every change immediately). * The new product must share the subscription's currency. * You can upgrade a non-seat subscription to a seat-based product — the billing customer is auto-promoted to a `team` customer and claims a seat — but you can't switch a seat-based subscription back to a non-seat product. Non-seat → seat changes must apply immediately, so `next_period` proration isn't allowed for that transition. * You can't change the plan on a subscription that's already canceled or scheduled to cancel — uncancel first. * Plan changes on a **trialing** subscription are allowed. The trial carries over with its end recomputed from the new product's trial length (anchored to the original `trial_start`). If the new product has no trial — or its trial would already have elapsed — the trial ends immediately and a fresh billing cycle starts on the new product. * Custom-priced products (pay-what-you-want) aren't valid destinations for a plan change. * The current discount carries over to the new product, including plan changes from the [Customer Portal](/docs/features/customer-portal/introduction) and `PATCH /v1/subscriptions/{id}` calls that omit `discount_id`. Set `discount_id` to `null` to remove it. From API version `2027-01`, a scheduled change reports that removal as `pending_update.discount_unset: true`. `discount_id: null` on that object means the current discount stays. ```bash cURL theme={null} curl --request PATCH \ --url https://api.polar.sh/v1/subscriptions/{subscription_id} \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "product_id": "", "proration_behavior": "prorate" }' ``` ```py Python theme={null} polar.subscriptions.update( "", product_id="", proration_behavior="prorate", ) ``` Read more in [Proration](/docs/features/subscriptions/proration). ## Change the number of seats For [seat-based subscriptions](/docs/features/seat-based-pricing), update how many seats the customer is paying for. Like plan changes, when the seat count actually takes effect depends on the [proration behavior](/docs/features/subscriptions/proration): immediate with `invoice` or `prorate`, scheduled for the next cycle with `next_period`, and with `auto` immediate for increases and scheduled for decreases (immediate for both during a trial). ```bash cURL theme={null} curl --request PATCH \ --url https://api.polar.sh/v1/subscriptions/{subscription_id} \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "seats": 25, "proration_behavior": "invoice" }' ``` ## Apply or change a discount Attach a [discount](/docs/features/discounts) to an active subscription, or remove the current one by setting `discount_id` to `null`. Leaving `discount_id` out keeps the current discount, including when the same request changes the product. The change is applied to the **next** billing cycle — it doesn't retroactively re-bill the current period. From API version `2027-01`, a removal scheduled with the plan change shows up as `pending_update.discount_unset: true`. ```bash cURL theme={null} curl --request PATCH \ --url https://api.polar.sh/v1/subscriptions/{subscription_id} \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "discount_id": "" }' ``` ## Manage the trial You can add, extend, or end a [trial](/docs/features/subscriptions/trials) on any subscription: * **Add or extend** a trial by setting `trial_end` to a future date. If the subscription is currently active, its status switches to `trialing` and the next charge is postponed to the new date. * **End a trial immediately** by setting `trial_end` to `"now"`. Polar will charge the first billing cycle and only change the subscription to `active` if payment succeeds. If payment fails, the subscription remains `trialing` with its original trial end. ```bash cURL theme={null} curl --request PATCH \ --url https://api.polar.sh/v1/subscriptions/{subscription_id} \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "trial_end": "2026-06-01T00:00:00Z" }' ``` ## Reschedule the next renewal If you need to move a subscription's renewal date — for example, to align several subscriptions on the same day, or to extend the current period as a goodwill gesture — you can set a new `current_billing_period_end`. The new date has to be in the future, and this operation isn't available on revoked subscriptions. If the subscription is scheduled to cancel at period end, its `ends_at` moves with the new date: it ends then instead of on the original period end. ```bash cURL theme={null} curl --request PATCH \ --url https://api.polar.sh/v1/subscriptions/{subscription_id} \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "current_billing_period_end": "2026-07-15T00:00:00Z" }' ``` ## Pause and resume Pausing stops billing without ending the subscription. Use it for seasonal plans or account "freezes", where a customer steps away for a while and comes back to the same subscription and payment method. ### Pause at period end Calling pause sets `pause_at_period_end = true`. The subscription stays **active** and keeps its benefits until its `current_period_end`, then it moves to the `paused` status: benefits are revoked and no further orders are generated. Pausing never charges the customer and never takes effect mid-period. Pass an optional `resumes_at` date to schedule an automatic resume. It has to be after the current period end. Leave it out to pause indefinitely and resume by hand later. ```bash cURL theme={null} curl --request PATCH \ --url https://api.polar.sh/v1/subscriptions/{subscription_id} \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "pause_at_period_end": true, "resumes_at": "2026-11-01T00:00:00Z" }' ``` You can only pause a subscription that's active, with no pending cancellation or pause. To cancel a scheduled pause before it takes effect, set `pause_at_period_end` back to `false`. ```bash cURL theme={null} curl --request PATCH \ --url https://api.polar.sh/v1/subscriptions/{subscription_id} \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "pause_at_period_end": false }' ``` ### Resume Resuming a paused subscription takes effect **right now**: status moves back to `active`, a new billing period starts from the resume date, and the customer is charged immediately. The payment method stays on file, so there's no second checkout. An automatic resume on the `resumes_at` date does exactly the same thing. ```bash cURL theme={null} curl --request PATCH \ --url https://api.polar.sh/v1/subscriptions/{subscription_id} \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "resume": true }' ``` ## Cancel or revoke Polar distinguishes between **canceling** and **revoking** a subscription. Both end the customer's access eventually — the difference is when. ### Cancel at period end Calling cancel (or toggling "Cancel at period end" in the dashboard) sets `cancel_at_period_end = true` and schedules the subscription to end on its `current_period_end`. Until then: * The subscription stays **active** and the customer keeps their benefits — they paid for that period. * No further orders are generated after the current one. * You can **uncancel** at any time before the end date, which reverts the scheduled cancellation. This is the gentler option and the one customers trigger themselves from the [Customer Portal](/docs/features/customer-portal/introduction). It's also what satisfies the "cancel the way you signed up" requirement in jurisdictions like California's [Automatic Renewal Law](https://oag.ca.gov/consumers/auto-renewing-subscriptions). ```bash cURL theme={null} curl --request PATCH \ --url https://api.polar.sh/v1/subscriptions/{subscription_id} \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "cancel_at_period_end": true, "customer_cancellation_reason": "too_expensive" }' ``` You can optionally record a **cancellation reason** and **comment** — useful for tracking churn. The supported reasons are `too_expensive`, `missing_features`, `switched_service`, `unused`, `customer_service`, `low_quality`, `too_complex`, and `other`. > [!NOTE] > > Only set the cancellation reason and comment when they actually come from > the customer (for example, from a cancellation survey or a support > conversation). Customers can see their `customer_cancellation_comment` in > their purchase history, so don't put internal notes there. ### Revoke immediately Revoking ends the subscription **right now**: status moves to `canceled`, `ended_at` is set to the current time, and all benefits are revoked. There's no refund — if you need to issue one, do it separately from [Refunds](/docs/features/refunds). Use this when access needs to stop immediately — a terms-of-service violation, a chargeback, or an explicit customer request. ```bash cURL theme={null} curl --request DELETE \ --url https://api.polar.sh/v1/subscriptions/{subscription_id} \ --header 'Authorization: Bearer ' ``` > [!WARNING] > > Revoking is irreversible. If you want the option to reverse the decision, > cancel at period end instead. ### Uncancel If a subscription is set to cancel at period end and hasn't ended yet, you (or the customer) can reverse the decision. The `cancel_at_period_end` flag is cleared, `ends_at` and `canceled_at` are unset, and the subscription goes back to renewing normally. ```bash cURL theme={null} curl --request PATCH \ --url https://api.polar.sh/v1/subscriptions/{subscription_id} \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "cancel_at_period_end": false }' ``` Uncancelling is not possible once the subscription has actually ended. ## What customers can do The [Customer Portal](/docs/features/customer-portal/introduction) exposes a subset of these actions to the customer, gated by your [portal settings](/docs/features/customer-portal/settings): * **Cancel at period end** is always available — this is the self-service guarantee the portal provides. * **Update the default payment method** is always available — the primary way customers recover from a failed renewal. * **Change plan** is available when **Enable subscription plan changes** is on. * **Change seats** (for seat-based subscriptions) is available when **Enable subscription seat management** is on. * **Pause and resume** is available when **Enable subscription pause** is on. Everything else on this page is merchant-only: revoking a subscription, applying or changing a discount, extending or ending a trial, and rescheduling the renewal date are not exposed to customers. # Proration Source: https://polar.sh/docs/features/subscriptions/proration Control how the price difference is billed when a subscription is upgraded or downgraded. Whenever a subscription's price changes mid-cycle — typically because the customer switched to a different product or changed seats — there's an unused portion of the current billing period that has already been paid for. **Proration** is how Polar reconciles that difference. You pick the proration behavior either at the organization level (as the default) or per API call. ## Proration behaviors Polar supports three standard proration behaviors, plus `auto`, which picks one of them for each change: ### Prorate and charge now (`invoice`) The subscription is updated **immediately** and Polar invoices the prorated difference right away. If the update is an upgrade the customer is charged; if it's a downgrade they're credited on the new invoice. Use this when you want money to change hands at the same time as the change — for example, on upgrades where you want to collect the extra revenue now. ### Prorate on next invoice (`prorate`) The subscription is updated **immediately**, but the prorated difference is carried over and applied on the **next scheduled invoice** instead of triggering a charge now. The customer's billing cycle is unchanged. This is typically the smoothest experience for the customer: their plan changes instantly, and they see the adjustment on their regular renewal invoice. > [!NOTE] > > If the billing interval changes (for example, monthly to yearly), `prorate` is promoted to > `invoice` automatically — there's no "next invoice" on the old cycle to defer the difference to. > [!WARNING] > > For `invoice` and `prorate`, the subscription update is applied only if the immediate payment (if > any) succeeds. If the payment fails, the API returns an error and the subscription stays > unchanged. ### Schedule for next cycle (`next_period`) The change is **not applied immediately**. It's scheduled as a pending update and applied at the start of the next billing period. No proration charge or credit is issued — the new plan simply takes effect on renewal. While a `next_period` update is pending, the subscription's `pending_update` field describes the scheduled change. Submitting a new update always supersedes the pending one: if you scheduled a `next_period` change and then make another update with `invoice` or `prorate`, the pending update is discarded and the new change is applied right away. This behavior is the safer default for downgrades where you don't want to issue credits, and for any case where you want the current period's terms to stay intact. ### Prorate upgrades, schedule downgrades (`auto`) Polar decides per change: **upgrades** are applied immediately like `invoice`, and **downgrades** are scheduled for the next cycle like `next_period`. This lets customers upgrade straight from the [Customer Portal](/docs/features/customer-portal/introduction) while keeping downgrades for their renewal. * **Product changes**: moving to a longer billing interval (for example, monthly to yearly) is an upgrade, and moving to a shorter one is a downgrade, whatever the prices. With the same interval, a higher or equal price is an upgrade and a lower price is a downgrade. Switching from a non-seat subscription to a seat-based product, or from a non-unit subscription to a unit-based product, is always applied immediately. * **Seat and unit changes**: adding seats or units is an upgrade, removing them is a downgrade. * **Trials**: during a trial, every change is applied immediately, since nothing is billed until the trial ends. If the new product's trial would already be over, the trial ends and the customer is charged for the new plan. To apply a particular change differently, pass an explicit `proration_behavior` on that update; it overrides `auto`. > [!NOTE] > > Use `2027-01` as your API version to ensure compatibility with `auto`. ### Charge full amount and reset cycle (`reset`) The subscription switches to the new plan **immediately**, Polar invoices the **full price of the new plan** right away, and the **billing cycle is reset** to start now. No proration is applied: the customer isn't credited for the unused portion of the old period, and they aren't charged a prorated amount — they pay the full new price and begin a fresh billing period. Because the cycle restarts, the new period's anchor day becomes the day the change was made, and all future renewals follow the new schedule. Use this when a plan change should behave like a brand-new subscription — for example, when an upgrade should restart the commitment period rather than carry over the current one. > [!NOTE] > > The `reset` proration behavior is currently in preview. You'll only be able to use the `reset` > proration behavior if you are on a paid plan. ## Setting the default behavior Each organization has a default proration behavior that applies whenever you don't pass an explicit `proration_behavior` on an API call — including plan changes customers initiate from the [Customer Portal](/docs/features/customer-portal/introduction). You can change it from **Settings → Subscriptions** in the dashboard, or via the [Update Organization](/docs/api-reference/current/organizations/update-organization) API. ## Overriding per update Every subscription update that changes the price — a product change or a seat change — accepts an optional `proration_behavior` that overrides the organization default for that single call: ```bash cURL theme={null} curl --request PATCH \ --url https://api.polar.sh/v1/subscriptions/{subscription_id} \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "product_id": "", "proration_behavior": "invoice" }' ``` ```py Python theme={null} from polar.v2026_10 import Polar with Polar("") as polar: res = polar.subscriptions.update( "", product_id="", proration_behavior="invoice", # or "prorate" or "next_period" ) ``` Valid values are `invoice`, `prorate`, and `next_period`, plus `auto` from API version `2027-01`. If your organization has access to the preview `reset` behavior, you can pass `reset` here as well. ## How the prorated amount is calculated Polar prorates on a **per-second** basis. If `S` seconds remain out of `T` total seconds in the current billing period: * Unused credit on the old plan: `old_plan_price * S / T` * Charge on the new plan for the remainder: `new_plan_price * S / T` * Prorated difference: the new-plan remainder minus the old-plan unused credit For an upgrade the difference is positive, so the customer is charged; for a downgrade it's negative, so the customer is credited. ### Upgrade A customer subscribed to a \$5/month plan on a 30-day month (2,592,000 seconds total). After 1 day (86,400 seconds elapsed, 2,505,600 seconds remaining) they upgrade to a \$20/month plan. * Unused credit on the $5 plan: `\$5 \* 2,505,600 / 2,592,000 = \$4.83\` * New charge for the remaining 2,505,600 seconds on the $20 plan: `\$20 \* 2,505,600 / 2,592,000 = \$19.33\` * **Prorated difference: \$14.50** With `invoice`, that \$14.50 is charged immediately. With `prorate`, it's added to the next monthly invoice (which is also the new \$20 charge for the next cycle). ### Downgrade A customer subscribed to a \$20/month plan on a 30-day month (2,592,000 seconds total). After 1 day (2,505,600 seconds remaining) they downgrade to a \$5/month plan. * Unused credit on the $20 plan: `\$20 \* 2,505,600 / 2,592,000 = \$19.33\` * New charge for the remaining 2,505,600 seconds on the $5 plan: `\$5 \* 2,505,600 / 2,592,000 = \$4.83\` * **Prorated difference: -\$14.50** (credit to the customer) With `invoice`, a credit invoice for \$14.50 is issued immediately. With `prorate`, the credit is applied on the next invoice. > [!NOTE] > > Because proration is computed from the exact number of seconds remaining, the change time-of-day > matters: upgrading at noon credits a different amount than upgrading at midnight. Polar always > uses the real length of the current billing period (so 28-, 29-, 30-, and 31-day months are all > handled exactly). # Trials Source: https://polar.sh/docs/features/subscriptions/trials Offer free trials on your subscriptions Trials are a great way to let potential customers experience your product before committing to a subscription. With Polar, you can easily set up free trials for your subscription products. ## Setting up a trial You can set up a trial period through the following means: * When creating or editing a [product](/docs/features/products). * When creating or editing a [checkout link](/docs/features/checkout/links). * When creating a Checkout Session through the [API](/docs/api-reference/current/checkouts/create-checkout-session). If you set a trial period on the Checkout Link or Checkout Session, it will **override the trial period set on the product**. The trial period consists of two parameters: * **A unit**: day, week, month, or year. * **A duration**: a number representing how many units the trial will last. ![](https://mintcdn.com/polar/6okRukiIx_KDNAFT/assets/features/trials/setup.light.png?fit=max\&auto=format\&n=6okRukiIx_KDNAFT\&q=85\&s=808ba964c320447e8bb71612e27687d0) ## Starting a trial When a customer checks out a subscription product with a trial period, they will not be charged immediately. Instead, they will have access to the product for the duration of the trial period. We'll still collect their payment information at checkout, but they won't be charged until the trial period ends. This means that if they decide to cancel before the trial ends, they won't be charged at all. Once the trial period ends, the customer will be automatically charged for the subscription, and their billing cycle will begin. ![](https://mintcdn.com/polar/6okRukiIx_KDNAFT/assets/features/trials/checkout.light.png?fit=max\&auto=format\&n=6okRukiIx_KDNAFT\&q=85\&s=a022daf013c20b48e1fdfd6610214b21) ## Adding, extending or canceling a trial For existing subscriptions, you can add, extend or cancel a customer's trial period at any time through the dashboard, from the subscription details page. Click on **Update Subscription**, then click on the **Trial** tab. To add or extend a trial, set a new trial end date in the future. If the subscription was active, its status will be changed to **trialing**, and the billing will be postponed until the end of the trial. To cancel a trial, click on the **End trial** button. Polar will charge the customer immediately and change the subscription to **active** if payment succeeds. ![](https://mintcdn.com/polar/6okRukiIx_KDNAFT/assets/features/trials/update.light.png?fit=max\&auto=format\&n=6okRukiIx_KDNAFT\&q=85\&s=e8068c41e9a3eef52df62342a8b24cdb) ## Trial conversion reminders Before a trial ends, Polar emails the customer to remind them that they're about to be charged. This keeps conversions transparent and avoids surprise charges that often end in chargebacks. When the reminder goes out depends on the length of the trial: * **Trials of 3 days or more** — reminder sent **3 days before** the trial ends. * **Trials between 1 and 3 days** — reminder sent **1 day before** the trial ends. * **Trials shorter than 1 day** — no reminder is sent (there isn't enough runway). Reminders are skipped for fully free subscriptions and for trialing subscriptions already scheduled to cancel at period end. You can turn trial conversion reminders off under [**Settings → Customer Notifications**](https://polar.sh/to/dashboard/settings/customer-notifications) if you prefer to handle that communication yourself. ## Preventing trial abuse To protect your business from customers repeatedly signing up for trials, you can enable the **Prevent trial abuse** feature from your organization's subscription settings. ### How it works When this feature is enabled, Polar tracks trial redemptions using: * **Email addresses**: We automatically detect and normalize email aliases (e.g., `user+alias@example.com` is treated as `user@example.com`) to prevent abuse through simple email variations. * **Payment method fingerprints**: We track the unique fingerprint of payment methods (credit cards) used during checkout to identify returning customers even if they use a different email address. A customer will be blocked from starting a new trial if they have previously redeemed a trial for any of your products and match either: * The same unaliased email address, OR * The same payment method fingerprint ### Enabling the feature 1. Open your organization's [**Settings**](https://polar.sh/to/dashboard/settings) page 2. Navigate to the **Subscription** section 3. Toggle on **Prevent trial abuse** Once enabled, the feature will apply to all future trial checkout attempts across all your products. ### Customer experience When a customer who has already used a trial attempts to check out again: 1. They will see an error message: "You have already used a trial for this product. Trials can only be used once per customer." 2. The checkout will automatically refresh without the trial period 3. The customer can still complete their purchase and subscribe at the regular price This approach ensures a smooth experience while protecting your business from trial abuse. # Tax Inclusive Pricing Source: https://polar.sh/docs/features/tax-inclusive-pricing Control whether your product prices include or exclude tax at checkout When displaying a price to a customer, there are two common conventions: either the displayed price **already includes tax** (inclusive), or tax is **calculated and added on top** at checkout (exclusive). Polar gives you fine-grained control over this behavior at both the organization level and on individual product prices. ## Tax Behavior Options There are three options available: | Option | Description | | - | - | | **Location-based** | Polar automatically picks the right behavior based on the customer's country. This is the default. | | **Inclusive** | The price shown to the customer already includes tax. Tax is extracted from the total at checkout. | | **Exclusive** | The price shown to the customer is before tax. Tax is calculated and added on top at checkout. | > [!NOTE] > > **Location-based** is the recommended option for most businesses. It follows > common regional conventions — customers in the United States, Canada, and > India see exclusive pricing, while customers in the rest of the world (e.g. > EU, UK) see inclusive pricing. ### How it affects checkout * **Inclusive**: If a product is priced at \$12.00 and the tax rate is 20%, the customer pays \$12.00 — \$2.00 of which is tax and \$10.00 is the net amount. * **Exclusive**: If a product is priced at \$10.00 and the tax rate is 20%, the customer pays \$12.00 — \$10.00 net plus \$2.00 tax added on top. In both cases the tax amount is fully visible and itemized on the checkout page and on receipts. ## Setting the Default Tax Behavior The default tax behavior applies to all products in your organization that don't have a price-level override. To change it: 1. Go to your organization's settings. 2. Find the **Default tax behavior** selector under the **Payments** section. 3. Choose **Location-based**, **Inclusive**, or **Exclusive**. 4. The setting is saved automatically. ![](https://mintcdn.com/polar/iBNAahIQ3TXjbcn9/assets/features/tax-inclusive-pricing/settings.light.png?fit=max\&auto=format\&n=iBNAahIQ3TXjbcn9\&q=85\&s=d453dd296f4ab0aff85a2ba48403fcab) ## Location-based Behavior in Detail When the tax behavior is set to **Location-based**, Polar resolves the actual inclusive/exclusive behavior at checkout time based on the customer's billing address: | Countries | Behavior | | - | - | | United States, Canada, India | **Exclusive** — tax is added on top of the listed price | | All other countries | **Inclusive** — tax is already included in the listed price | This follows prevailing regional conventions: North American and Indian consumers generally expect prices before tax, while European and most other international customers expect VAT-inclusive pricing. ## Relationship with Merchant of Record As a [Merchant of Record](/docs/merchant-of-record/introduction), we handle the calculation, collection, and remittance of sales taxes globally on your behalf. Tax behavior only controls **how the price is presented** to your customer — it does not affect whether tax is collected or how much is owed. Regardless of the tax behavior chosen, Polar always: * Calculates the correct tax amount for the customer's jurisdiction. * Displays the tax breakdown clearly on the checkout page. * Issues a compliant receipt that itemizes the tax amount. * Remits the collected tax to the appropriate tax authorities. > [!NOTE] > > Changing the tax behavior on a price does **not** change the effective tax > rate or your tax obligations. It only changes whether the stated price is > presented as tax-included or tax-excluded to the customer. # Team Management Source: https://polar.sh/docs/features/team-management Invite teammates to your organization, manage their roles, and control what they can access in the Polar dashboard. Polar organizations support multiple users. You can invite teammates to collaborate on products, orders, customers, and other parts of your business — each with a role that determines what they're allowed to do. Team management lives under [**Settings → Members**](https://polar.sh/to/dashboard/settings/members) in your dashboard. > [!NOTE] > > On the Scale plan you can connect your own identity provider instead of inviting people one by > one. See [Single Sign-On](/docs/features/sso). ## Roles Every member of an organization has one of three roles: | Role | Description | | - | - | | **Owner** | There is always exactly one owner per organization. Has the same permissions as an admin. | | **Admin** | Full access to the organization — including managing members, finances, and organization settings. | | **Member** | Operational access to day-to-day work (products, customers, orders, analytics) but cannot manage other members, finances, or organization settings. | ### Permissions The exact permissions granted by each role: | Permission | Member | Admin | Owner | | - | :-: | :-: | :-: | | View & manage products | ✓ | ✓ | ✓ | | View & manage customers | ✓ | ✓ | ✓ | | View & manage custom fields | ✓ | ✓ | ✓ | | View & manage sales (orders, subscriptions, refunds) | ✓ | ✓ | ✓ | | View & manage analytics | ✓ | ✓ | ✓ | | View other members | ✓ | ✓ | ✓ | | Invite, remove & change member roles | | ✓ | ✓ | | View & manage finances (balance, payouts) | | ✓ | ✓ | | Manage organization settings (including webhooks & API keys) | | ✓ | ✓ | `owner` and `admin` carry the same permissions — the owner is distinguished by the fact that every organization always has exactly one, not by additional capabilities. ## Inviting a member 1. Go to [**Settings → Members**](https://polar.sh/to/dashboard/settings/members) in your organization's dashboard. 2. Click **Invite**. 3. Enter the email address of the person you want to add. 4. Click **Send Invite**. The invitee receives an email with a link to join your organization. If they don't already have a Polar account, one is created for them when they accept the invitation. New members join with the **Member** role by default. To grant additional access, change their role after they've been added. > [!NOTE] > > **Already a member?** If you invite an email that's already part of your organization, no new invite is sent — the existing membership is shown instead. > [!WARNING] > > **Enforcing [SSO](/docs/features/sso)?** Invitations stop being a way in. The invited person becomes a member, but reaching the organization requires signing in through your identity provider. Add them there instead. ## Changing a member's role Only **admins** and **owners** can change roles. 1. Go to [**Settings → Members**](https://polar.sh/to/dashboard/settings/members). 2. Click the **⋯** menu on the member's row. 3. Choose **Change role**. 4. Select **Admin** or **Member** and click **Save**. The role picker shows a side-by-side permissions matrix so you can confirm what each role grants before saving. > [!NOTE] > > **The owner's role can't be changed from this menu.** Every organization has exactly one owner at all times. Ownership can only be transferred to another member of the organization who has completed identity verification — please [contact support](/docs/support) to request an ownership transfer. ## Removing a member Only **admins** and **owners** can remove other members. 1. Go to [**Settings → Members**](https://polar.sh/to/dashboard/settings/members). 2. Click the **⋯** menu on the member's row. 3. Choose **Remove from organization**. 4. Confirm the removal. The removed member immediately loses access to the organization. They keep their Polar account and any other organizations they're a member of. > [!WARNING] > > **You can't remove the owner.** Every organization always has exactly one owner — to remove the current owner, ownership must first be transferred to another member who has completed identity verification. Please [contact support](/docs/support) to request an ownership transfer. > [!WARNING] > > **Using [SSO](/docs/features/sso)?** Removing a member here doesn't keep them out. Anyone who can still authenticate against your identity provider rejoins on their next sign-in. Revoke their access in your identity provider instead. ## Leaving an organization If you want to leave an organization yourself: 1. Go to [**Settings → Members**](https://polar.sh/to/dashboard/settings/members). 2. Click the **⋯** menu on your own row. 3. Choose **Leave organization** and confirm. You can't leave an organization if you are: * The **owner** — ownership must be transferred first. * The **only remaining member** of the organization. ## Frequently asked questions > [accordion] Do invited users need an existing Polar account? > > No. If the invited email doesn't have a Polar account yet, one is created automatically. The user signs in to claim it when they accept the invitation. > [accordion] Can people join without an invitation? > > Yes, if your organization uses [Single Sign-On](/docs/features/sso). Anyone who authenticates through your identity provider becomes a member with the Member role — no invitation needed. Your identity provider controls who can do that. > [accordion] Can a user belong to more than one organization? > > Yes. A user can be a member of any number of organizations and may have different roles in each one. You can switch between them from the organization picker in the dashboard. > [accordion] How do I transfer ownership of an organization? > > Ownership can only be transferred to another member of the organization who has completed identity verification. Every organization always has exactly one owner — the previous owner becomes an admin once the transfer completes. > Please [contact support](/docs/support) to request an ownership transfer. # Unit-Based Pricing Source: https://polar.sh/docs/features/unit-based-pricing Sell a quantity of anything, paid up front, with tiered rates Unit-based pricing lets a customer buy a quantity of something and pay for it up front. Devices, licenses, gigabytes, servers. You name the unit, set the rate, and the buyer picks how many they want at checkout. > [!NOTE] > > **Unit-based pricing is ideal for:** > > * Per-device or per-installation licensing > * Prepaid capacity, such as storage or bandwidth > * Any quantity that isn't a person and isn't measured after the fact > * Products where volume discounts should apply to the declared quantity ## Choosing between unit-based, seat-based, and metered Three pricing models charge by quantity. They differ in what the quantity counts and when the customer pays. | Model | The quantity counts | Customer pays | Benefits go to | | - | - | - | - | | **Unit-based** | Anything that isn't a person | Up front | The customer, once | | **Seat-based** | People | Up front | Each member who claims a seat | | **Metered** | Consumption you record | After the period | The customer, once | Pick seat-based when each unit maps to a person who needs their own access. Polar then handles invitations, seat claims, and per-member benefits. Pick unit-based for everything else. Pick metered when Polar counts the quantity for you, from usage events. With unit-based the buyer declares the number themselves, at checkout. ## How it works The buyer chooses a quantity at checkout and pays for it immediately. The price comes from the tiers you configure and the quantity they picked. On a subscription, the quantity carries across billing periods. You can change it at any time, and so can the customer if you let them. Polar prorates the difference. On a one-time purchase, the quantity is fixed at the moment of sale. ## Creating a unit-based product **1. Create a new product** From your dashboard, [create a new product](https://polar.sh/to/dashboard/products/new). **2. Configure basic settings** Set your product name, description, and media as usual. **3. Select unit-based pricing** Under **Pricing**, select: * **Product type**: Subscription or One-time * **Billing cycle** (subscriptions only): Monthly or Yearly * **Pricing type**: Unit-based **4. Name the unit** Set the singular and plural nouns for what you're selling, such as `device` and `devices`. They appear at checkout, in the Customer Portal, and on invoices. Leave them empty and Polar falls back to "unit" and "units". **5. Choose a tiering model** Under **Tiering model**, select how the quantity is priced: | Model | Description | | - | - | | **Fixed price per unit** | Every unit costs the same rate. | | **Volume** | The rate is set by the total quantity, and that rate applies to every unit. Crossing a threshold lowers the price on the whole order. | | **Graduated** | Each tier range is priced at its own rate. The total is the sum across ranges. | Define a tier by an upper bound and a rate. The bound is inclusive, and each tier starts where the previous one ended. Leave the last tier's bound empty for an open-ended top range. **Example** with tiers at up to 10: \$10 per unit, and beyond: \$8 per unit: * Volume: 14 units = 14 × \$8 = \$112. Every unit gets the lower rate. * Graduated: 14 units = 10 × \$10 + 4 × \$8 = \$132. Each range keeps its own rate. **6. Set a minimum and maximum** **Minimum units** is the smallest quantity a customer can buy. It defaults to 1. **Maximum units** caps the quantity a customer can buy. Leave it empty for unlimited, and customers can buy any quantity above the minimum. **7. Add benefits** Configure the benefits the customer receives on purchase. ### Combining with other prices Add a fixed price alongside the unit-based one for a base fee plus a per-unit rate. Metered prices can sit on top of both, so a subscription can charge a flat monthly amount, a rate per device, and usage on a meter. ## Benefits The customer receives each benefit once, whatever quantity they buy. Buying 40 devices grants one license key, not 40. If you need one grant per unit, use [seat-based pricing](/docs/features/seat-based-pricing). ## Changing the quantity You can change the quantity on a subscription from your dashboard or through the API at any time. Customers can change it themselves from the Customer Portal once you allow it. Go to **Settings**, then **Customer portal**, and turn on **Enable subscription unit changes**. It is off by default. ### Proration When the quantity changes mid-period, Polar prorates the difference using your organization's proration behavior: * **Increasing the quantity** charges for the added units, prorated over the remainder of the period. * **Reducing the quantity** credits the removed units for the unused part of the period. The full amount applies from the next billing period onward. ## Limitations * The quantity is a whole number. Fractional quantities need [metered billing](/docs/features/usage-based-billing/introduction) instead. * Tier rates are whole cents. * A product carries at most one unit-based price. * Unit-based cannot be combined with seat-based or pay-what-you-want pricing. * One-time purchases cannot change quantity after the sale. The customer buys again instead. # Usage-Based Pricing Source: https://polar.sh/docs/features/usage-based-billing/billing Charge customers for their metered usage Usage-based pricing charges customers based on usage tracked by [Metering](/docs/features/usage-based-billing/introduction). Set up your events and meters first, then add a metered price to a Product. ## Metered Pricing Metered Pricing is a pricing model where you charge your customers based on the usage of your application. There are a few different usage-based pricing models: * Unit Pricing * Volume Pricing * Graduated Pricing ### Unit Pricing Unit pricing is a simple pricing model where you charge a fixed amount for each unit of usage. For example: | Product Meter | Price per unit | | - | - | | `prompt-tokens` | \$0.10 | | `completion-tokens` | \$0.18 | This means that every unit of `prompt-tokens` consumed by a customer will be charged at \$0.10 and every unit of `completion-tokens` will be charged at \$0.18. It's a linear pricing model, where the price per unit is fixed. ### Volume Pricing Volume pricing sets the rate from the total usage over the period, and that rate applies to every unit. Crossing a threshold lowers the price on all of it. ### Graduated Pricing Graduated pricing charges each range at its own rate. The total is the sum across ranges. ### Defining tiers Volume and graduated take the same tiers. Define one by an upper bound and a rate. The bound is inclusive, and each tier starts where the previous one ended. The last tier is always unbounded, since usage has no ceiling. A [cap](#add-a-metered-price-to-your-product) still limits what the customer pays. **Example** with tiers at up to 1,000: \$0.10 per unit, and beyond: \$0.08 per unit: * Volume: 1,400 units = 1,400 × \$0.08 = \$112. Every unit gets the lower rate. * Graduated: 1,400 units = 1,000 × \$0.10 + 400 × \$0.08 = \$132. Each range keeps its own rate. ## Invoicing Customers for Usage Usage-based pricing is built to work with Subscription products out of the box. ### Add a metered price to your product To charge your customers for usage, you need to add a metered price to your product. You'll need to select the **Meter** and the **Pricing model**. A flat price per unit takes a single **amount per unit**; volume and graduated take a list of tiers. > [!NOTE] > > The price is always entered as the cost per **single unit**. How it is > displayed to customers — for example as `$20 / 1M tokens` — is controlled by > the [Unit](/docs/features/usage-based-billing/meters#unit) setting on the meter. ![](https://mintcdn.com/polar/fnujBPxaFvfkZfB0/assets/features/usage/cap.light.png?fit=max\&auto=format\&n=fnujBPxaFvfkZfB0\&q=85\&s=b4ac7dd5bf3e6a6f1aa8ef8866bc81a3) Optionally, you can set a **cap**. The customer will be charged the cap amount if they exceed it, regardless of the usage. ### When usage is invoiced By default, usage follows the subscription's billing period. On a monthly subscription, usage is aggregated over the month and invoiced at renewal with the rest of the subscription. On a yearly subscription, it's aggregated over the year and invoiced at the yearly renewal. To invoice usage more often than the subscription renews, for example monthly on a yearly plan, set a [meter cycle](#meter-cycle). ## Meter cycle A meter cycle lets metered usage run on its own cadence, independent of the billing interval. It's set on the product with `meter_interval` and `meter_interval_count`, or with the **Separate meter cycle** toggle in the product's pricing section. The common case is a yearly plan with monthly usage: the customer pays the base price once a year, while overage is invoiced and [credits](/docs/features/usage-based-billing/credits) are granted every month. At the end of each meter period, Polar: 1. Invoices the period's usage as a separate order. 2. Resets the customer's meters. 3. Grants the [Credits benefit](/docs/features/benefits/credits) again, applying rollover if it's enabled. Meters are reset and credits granted even when there's no usage to invoice. If the period's usage is below the minimum chargeable amount, no payment is taken: the amount is added to the customer's balance and applied to their next order. Without a meter cycle, all of this happens once per billing period, at renewal. ### Alignment with the billing interval The meter cycle must divide the billing interval evenly, so both cycles line up again at every renewal. The meter cycle starts on the same anchor day as the subscription. | Billing interval | Allowed meter cycles | | - | - | | Every *n* days | Every *m* days, where *m* divides *n* | | Every *n* weeks | Every *m* weeks, where *m* divides *n*, or every *m* days, where *m* divides *7n* | | Every *n* months | Every day, or every *m* months, where *m* divides *n* | | Every *n* years | Every day, or every *m* months, where *m* divides *12n*, or every *m* years, where *m* divides *n* | For example, a yearly plan accepts a meter cycle of 1, 2, 3, 4, 6 or 12 months, but not 5 months or 1 week. Weeks don't fit evenly into months, so weekly meter cycles aren't available on monthly or yearly plans. > [!WARNING] > > The meter cycle can't be changed once it's set on a product. Existing > subscriptions keep the meter cycle they were created with. ### At renewal and other boundaries * **Renewal**: the last meter period of a billing period is invoiced in the regular renewal order, together with the base price. No separate `subscription_meter_cycle` order is created, and the meter cycle restarts from the new billing period. * **Trials**: the meter cycle starts when the trial converts to a paid subscription. * **Plan change**: usage accrued so far is invoiced right away on the previous product's prices, before the switch takes effect. * **Immediate cancellation**: usage up to the cancellation is invoiced right away. A cancellation at the end of the period invoices the final usage at the end of that period, as usual. ### Discounts A percentage [discount](/docs/features/discounts) applies to every meter cycle order. A fixed-amount discount doesn't. It still applies to the renewal order. ### Failed payments A failed meter cycle order is retried on the same schedule as [failed subscription payments](/docs/features/subscriptions/failed-payments): after 2, 7, 14 and 21 days. It never affects the subscription itself: the subscription stays `active`, keeps its benefits, and isn't revoked. If every retry fails, the order is voided. If the subscription itself becomes `past_due` because its renewal payment failed, the meter cycle is paused: no usage is invoiced, meters aren't reset and no credits are granted. Usage keeps being recorded. When the subscription recovers, the accrued usage is invoiced in one order, meters are reset and credits are granted again. ### Customer emails Each meter cycle order sends the customer a **Your usage invoice** email with a link to the customer portal. It's controlled by the same setting as subscription renewal emails, so disabling renewal emails disables these too. ### Webhooks Each meter cycle order emits `order.created` and `order.paid` like any other order. Check `billing_reason` to tell them apart from renewals. Meter cycles don't emit `subscription.cycled`, which only fires at renewal. ### Usage Charges and Subscription Cancellation When a subscription is canceled, it generally remains active until the end of the current billing period (known as the grace period). During this grace period, all accumulated usage-based charges continue to be tracked. A final invoice will be issued at the end of that period to cover the consumed usage, even if the subscription will not be renewed. This ensures no pending usage charges are lost. > [!WARNING] > > If a [discount](/docs/features/discounts) is applied on the subscription, it'll be > applied on the **whole invoice**, including metered usage. ## Customer Portal Customers can view their estimated charges for each meter in the Customer Portal. ![](https://mintcdn.com/polar/fnujBPxaFvfkZfB0/assets/features/usage/portal.light.png?fit=max\&auto=format\&n=fnujBPxaFvfkZfB0\&q=85\&s=85bdb395f87e972ed50a7381ba3aad43) # Credits Source: https://polar.sh/docs/features/usage-based-billing/credits Crediting customers for metered usage Credits is the way to pre-pay for usage in Polar. It allows you to give your customers the ability to pre-pay for usage instead of risk getting a hefty bill at the end of the month. ## How Credits Work When you ingest events into a Usage Meter, customers will be charged for the usage based on the product's pricing model. However, sometimes you may want to give your customers the ability to pre-pay for usage instead of risk getting a hefty bill at the end of the month. When you issue Credits to a customer, we first deduct the Credits from their Usage Meter balance. If the Usage Meter balance reaches 0, the customer will be charged for the overage. ### Credits-only spending To avoid any overage charges, don't create any Metered price on your product. This way, billing won't be triggered at all for the meter ## Issuing Credits with the Credits Benefit ![](https://mintcdn.com/polar/Ut0vPUvE1pIdMcH2/assets/features/benefits/credits/credits.light.png?fit=max\&auto=format\&n=Ut0vPUvE1pIdMcH2\&q=85\&s=95a964aa562069bd58a551e44c757459) The Credits benefit will credit a customer's Usage Meter balance at different points in time depending on the type of product the benefit is attached to. ### Subscription Products The customer will be credited the amount of units specified in the benefit at the beginning of every subscription cycle period — monthly or yearly. If the product has a [meter cycle](/docs/features/usage-based-billing/billing#meter-cycle), credits are granted at the start of every meter period instead. For example, a yearly plan with a monthly meter cycle grants credits every month. No credits are granted while the subscription is `past_due`. ### One-Time Products The customer will be credited the amount of units specified in the benefit once at the time of purchase. ## Granting Credits Manually You can also credit a customer's Usage Meter directly, for example as a goodwill gesture or to top up a balance outside of a purchase. Manual credits are added on top of any credits granted through a Meter Credits benefit. ### From the dashboard Open a customer and choose **Add Credits** from the customer menu, use **Add credits** on a meter row in the customer's **Usage** tab, or open a customer meter and click **Add credits**. Pick the meter, enter the number of credits and choose whether unused credits roll over to the next billing cycle (on by default). The panel previews the new balance and, for billed meters, how much of the current overage the credits cover. ### From the API > [!NOTE] > > Manual credits are available from API version `2027-01`. Use the [Credit Customer Meter](/docs/api-reference/2027-01/customer_meters/credit-customer-meter) endpoint, `POST /v1/customer-meters/credits`. It requires the `customers:write` scope. Identify the customer and meter either with Polar IDs (`customer_id` and `meter_id`) or with external IDs (`external_customer_id` and `external_meter_id`); the two styles can't be mixed in one request. ```json theme={null} { "external_customer_id": "usr_1337", "external_meter_id": "tool_call", "units": 100, "rollover": false, "external_id": "goodwill-2026-10-20" } ``` * `units` is a whole number between 1 and 1,000,000,000. * `rollover` defaults to `false`: unused credits expire at the end of the meter period unless you set it to `true`. * `external_id` is optional. Retrying with the same `external_id` and the same request returns the original credit instead of granting it twice. Reusing it for a different credit returns a `409`. * The meter must belong to the customer's organization and can't be archived. The response is the `meter.credited` event that was recorded. The customer meter balance is updated before the response is returned; if the meter is being updated at the same moment, the balance catches up shortly after. ### Reversing a manual credit A manual credit added by mistake can be reversed, either with **Reverse** on the credit in the customer meter's history, or with the [Reverse Customer Meter Credit](/docs/api-reference/2027-01/customer_meters/reverse-customer-meter-credit) endpoint, `POST /v1/customer-meters/credits/{id}/reverse`, where `id` is the ID of the `meter.credited` event returned when the credit was granted. Reversal removes only the units the customer hasn't used yet; units already consumed stay consumed. Usage draws from non-rollover credits before rollover credits. A reversal is rejected when: * The credit is older than 7 days. * The credit was granted during a period that has already been invoiced. * The credit has already been reversed. Each credit can be reversed once. * All of the credited units have already been used. Only manual credits can be reversed. Credits granted through the Meter Credits benefit can be removed by revoking the benefit. ## Credit history Every credit, reversal and revocation is recorded as a `meter.credited` system event on the customer. Its metadata contains: * `meter_id`: the meter that was credited. * `units`: the number of units. Revoked benefit credits and reversals have negative units. * `rollover`: whether unused units carry over to the next meter period. * `reason`: `benefit` for credits granted through the Meter Credits benefit, including rolled-over units, or `manual` for credits granted from the dashboard or API. A reversal has `parent_id` set to the ID of the credit it reverses. ## Tracking customer's balance In your application, you'll likely need to track the customer's balance for a given meter. The easiest way to do this is to use the [Customer State](/docs/integrate/customer-state), which will give you the overview of the customer, including the balance for each of their active meters. You can also specifically query the meters balance using the [Customer Meters API](/docs/api-reference/current/customer_meters/list-customer-meters). > [!WARNING] > > Polar doesn't block usage if the customer exceeds their balance. You're > responsible for implementing the logic you need to prevent usage if they > exceed it. # Event Ingestion Source: https://polar.sh/docs/features/usage-based-billing/event-ingestion Ingest events from your application Events are the core of Usage Based Billing. They represent *some* usage done by a customer in your application. Typical examples of events are: * A customer consumed AI LLM tokens * A customer streamed minutes of video * A customer uploaded a file to your application Events are sent to Polar using the [Events Ingestion API](/docs/api-reference/current/events/ingest-events) and are stored in our database. An event consists of the following fields: * A `name`, which is a string that can be used to identify the type of event. For example, `ai_usage`, `video_streamed` or `file_uploaded`. * A `customer_id` or `external_customer_id`, which is Polar's customer ID or your user's ID. This is used to identify the customer that triggered the event. * A `metadata` object, which is a JSON object that can contain any additional information about the event. This is useful for storing information that can be used to filter the events or compute the actual usage. For example, you can store the duration of the video streamed or the size of the file uploaded. Here is an example of an event: ```json theme={null} { "name": "ai_usage", "external_customer_id": "cus_123", "metadata": { "model": "gpt-4.1-nano", "requests": 1, "total_tokens": 77, "request_tokens": 58, "response_tokens": 19 } } ``` ## Ingest events using the Polar SDK To ingest events, you can use the Polar SDKs. ### TypeScript Example ```typescript theme={null} import { createPolar } from "@polar-sh/sdk/2026-10"; const polar = createPolar({ accessToken: process.env.POLAR_ACCESS_TOKEN!, }); await polar.events.ingest({ events: [ { name: "", external_customer_id: "", metadata: { key: "value", }, }, ], }); ``` > [!NOTE] > > You are always responsible for checking the balance of your customers' Usage > Meter. As events always are ingested, we will never prohibit any customer's > action based on their Usage Meter balance. ## Ingestion Strategies To make it easier to ingest events, we have created a set of ingestion strategies for common event sources. Learn more about our [Ingestion Strategies](/docs/features/usage-based-billing/ingestion-strategies). ## Good to know ### Events are immutable Once an event is ingested, it cannot be changed, nor can it be deleted. ### Backdated events You can set the `timestamp` field on an event to any point in the past — useful for batched ingestion or replaying from your own queue. The timestamp does not need to be part of the current billing cycle. Polar attributes events to billing periods based on **when they were received by Polar**, not the supplied `timestamp`. An event ingested today with a `timestamp` from a previous billing period is included on the **current cycle** — it is not added to the already-closed invoice for the period it logically belongs to. Polar never issues retroactive invoices or credits for late events. The supplied `timestamp` is still used to: * Place events on the time series shown in the dashboard and the Customer Portal. * Set the date range displayed on the metered line item of the next invoice. # Delta Time Strategy Source: https://polar.sh/docs/features/usage-based-billing/ingestion-strategies/delta-time-strategy Ingest delta time of arbitrary execution ## Javascript SDK Ingest delta time of arbitrary execution. Bring your own now-resolver. ``` pnpm add @polar-sh/ingestion ``` ```typescript theme={null} import { Ingestion } from "@polar-sh/ingestion"; import { DeltaTimeStrategy } from "@polar-sh/ingestion/strategies/DeltaTime"; const nowResolver = () => performance.now(); // const nowResolver = () => Number(hrtime.bigint()) // const nowResolver = () => Date.now() // Setup the Delta Time Ingestion Strategy const deltaTimeIngestion = Ingestion({ accessToken: process.env.POLAR_ACCESS_TOKEN, }) .strategy(new DeltaTimeStrategy(nowResolver)) .ingest("execution-time"); export async function GET(request: Request) { try { // Get the wrapped start clock function // Pass Customer Id to properly annotate the ingestion events with a specific customer const start = deltaTimeIngestion.client({ customerId: request.headers.get("X-Polar-Customer-Id") ?? "", }); const stop = start(); await sleep(1000); // { deltaTime: xxx } is automatically ingested to Polar const delta = stop(); return Response.json({ delta }); } catch (error) { return Response.json({ error: error.message }); } } ``` #### Ingestion Payload ```json theme={null} { "customerId": "123", "name": "execution-time", "metadata": { "deltaTime": 1000 } } ``` # Strategy Introduction Source: https://polar.sh/docs/features/usage-based-billing/ingestion-strategies/ingestion-strategy Ingestion strategies for Metering Polar offers an ingestion framework to work with Polar's event ingestion API. Want to report events regarding Large Language Model usage, S3 file uploads or something else? Our Ingestion strategies are customized to make it as seamless as possible to fire ingestion events for complex needs. * [LLM Strategy](/docs/features/usage-based-billing/ingestion-strategies/llm-strategy) * [S3 Strategy](/docs/features/usage-based-billing/ingestion-strategies/s3-strategy) * [Stream Strategy](/docs/features/usage-based-billing/ingestion-strategies/stream-strategy) * [Delta Time Strategy](/docs/features/usage-based-billing/ingestion-strategies/delta-time-strategy) ### Help us improve We're always looking for ways to improve our ingestion strategies. Feel free to contribute — [Polar Ingestion SDK](https://github.com/polarsource/polar-ingestion). # LLM Strategy Source: https://polar.sh/docs/features/usage-based-billing/ingestion-strategies/llm-strategy Ingestion strategy for LLM Usage ## Javascript SDK ### LLM Strategy Wrap any LLM model from the `@ai-sdk/*` library, to automatically fire prompt- & completion tokens used by every model call. ``` pnpm add @polar-sh/ingestion ai @ai-sdk/openai ``` ```typescript theme={null} import { Ingestion } from "@polar-sh/ingestion"; import { LLMStrategy } from "@polar-sh/ingestion/strategies/LLM"; import { generateText } from "ai"; import { openai } from "@ai-sdk/openai"; // Setup the LLM Ingestion Strategy const llmIngestion = Ingestion({ accessToken: process.env.POLAR_ACCESS_TOKEN }) .strategy(new LLMStrategy(openai("gpt-4o"))) .cost((ctx) => ({ amount: 123, currency: "usd" })) // Optional: Set the cost of the LLM usage .ingest("openai-usage"); export async function POST(req: Request) { const { prompt }: { prompt: string } = await req.json(); // Get the wrapped LLM model with ingestion capabilities // Pass Customer Id to properly annotate the ingestion events with a specific customer const model = llmIngestion.client({ customerId: "xxx", }); const { text } = await generateText({ model, system: "You are a helpful assistant.", prompt, }); return Response.json({ text }); } ``` #### Ingestion Payload ```json theme={null} { "customerId": "123", "name": "openai-usage", "metadata": { "inputTokens": 100, "outputTokens": 200, "cachedInputTokens": 10, "totalTokens": 300, "model": "gpt-4o", "provider": "openai.responses", "strategy": "LLM", "_cost": { "amount": 123, // Amount is expected to be in cents. $1.23 should be represented as 123 "currency": "usd" }, "_llm": { ... // } } } ``` ## Python SDK The Python SDK has no ingestion helper or strategies. Send usage events with `polar.events.ingest` from the [Python SDK](/docs/integrate/sdk/python) instead. ```bash pip theme={null} pip install polar-sdk ``` ```bash uv theme={null} uv add polar-sdk ``` ### Ingesting events ```python theme={null} import os from polar.v2026_10 import Polar polar = Polar(os.environ["POLAR_ACCESS_TOKEN"]) polar.events.ingest( events=[ { "name": "my-event", "external_customer_id": "CUSTOMER_ID", "metadata": { "usage": 13.37, }, } ] ) ``` `events.ingest` sends the request synchronously. To avoid blocking your request path, batch events and send them from a background task, or use `PolarAsync` in asynchronous applications. ### PydanticAI [PydanticAI](https://ai.pydantic.dev) is an AI agent framework for Python. A common use-case with AI applications is to track the usage of LLMs, like the number of input and output tokens, and bill the customer accordingly. Read the token usage from the agent run and ingest it as an event: ```python theme={null} import os from polar.v2026_10 import Polar from pydantic import BaseModel from pydantic_ai import Agent polar = Polar(os.environ["POLAR_ACCESS_TOKEN"]) class MyModel(BaseModel): city: str country: str agent = Agent("gpt-4.1-nano", output_type=MyModel) if __name__ == "__main__": result = agent.run_sync("The windy city in the US of A.") print(result.output) usage = result.usage polar.events.ingest( events=[ { "name": "ai_usage", "external_customer_id": "CUSTOMER_ID", "metadata": { "requests": usage.requests, "total_tokens": usage.total_tokens, "input_tokens": usage.input_tokens, "output_tokens": usage.output_tokens, }, } ] ) ``` *This example is inspired from the [Pydantic Model example](https://ai.pydantic.dev/examples/pydantic-model/) of PydanticAI documentation.* #### Ingestion Payload ```json theme={null} { "name": "ai_usage", "external_customer_id": "CUSTOMER_ID", "metadata": { "requests": 1, "total_tokens": 78, "input_tokens": 58, "output_tokens": 20 } } ``` # S3 Strategy Source: https://polar.sh/docs/features/usage-based-billing/ingestion-strategies/s3-strategy Ingestion strategy for S3 Operations ## Javascript SDK Wrap the official AWS S3 Client with our S3 Ingestion Strategy to automatically ingest bytes uploaded. ``` pnpm add @polar-sh/ingestion @aws-sdk/client-s3 ``` ```typescript theme={null} import { Ingestion } from "@polar-sh/ingestion"; import { S3Strategy } from "@polar-sh/ingestion/strategies/S3"; import { PutObjectCommand, S3Client } from "@aws-sdk/client-s3"; const s3Client = new S3Client({ region: process.env.AWS_REGION, endpoint: process.env.AWS_ENDPOINT_URL, credentials: { accessKeyId: process.env.AWS_ACCESS_KEY_ID!, secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY!, }, }); // Setup the S3 Ingestion Strategy const s3Ingestion = Ingestion({ accessToken: process.env.POLAR_ACCESS_TOKEN }) .strategy(new S3Strategy(s3Client)) .ingest("s3-uploads"); export async function POST(request: Request) { try { // Get the wrapped S3 Client // Pass Customer Id to properly annotate the ingestion events with a specific customer const s3 = s3Ingestion.client({ customerId: request.headers.get("X-Polar-Customer-Id") ?? "", }); await s3.send( new PutObjectCommand({ Bucket: process.env.AWS_BUCKET_NAME, Key: "a-random-key", Body: JSON.stringify({ name: "John Doe", age: 30, }), ContentType: "application/json", }) ); return Response.json({}); } catch (error) { return Response.json({ error: error.message }); } } ``` #### Ingestion Payload ```json theme={null} { "customerId": "123", "name": "s3-uploads", "metadata": { "bytes": 100, "bucket": "my-bucket", "key": "my-key", "contentType": "application/text" } } ``` # Stream Strategy Source: https://polar.sh/docs/features/usage-based-billing/ingestion-strategies/stream-strategy Ingestion strategy for Readable & Writable Streams ## Javascript SDK Wrap any Readable or Writable stream of choice to automatically ingest the bytes consumed. ``` pnpm add @polar-sh/ingestion ``` ```typescript theme={null} import { Ingestion } from '@polar-sh/ingestion'; import { StreamStrategy } from '@polar-sh/ingestion/strategies/Stream'; const myReadstream = createReadStream(...); // Setup the Stream Ingestion Strategy const streamIngestion = Ingestion({ accessToken: process.env.POLAR_ACCESS_TOKEN }) .strategy(new StreamStrategy(myReadstream)) .ingest("my-stream"); export async function GET(request: Request) { try { // Get the wrapped stream // Pass Customer Id to properly annotate the ingestion events with a specific customer const stream = streamIngestion.client({ customerId: request.headers.get("X-Polar-Customer-Id") ?? "" }); // Consume stream... stream.on('data', () => ...) return Response.json({}); } catch (error) { return Response.json({ error: error.message }); } } ``` #### Ingestion Payload ```json theme={null} { "customerId": "123", "name": "my-stream", "metadata": { "bytes": 100 } } ``` # Metering Source: https://polar.sh/docs/features/usage-based-billing/introduction Track customer usage with ingested events and meters ## Overview Metering lets you track how your customers use your application. You ingest events from your application, and Meters aggregate those events into usage per customer. You can then use that usage to: * Charge customers for it with [metered prices](/docs/features/usage-based-billing/billing) * Grant usage [credits](/docs/features/usage-based-billing/credits) that are consumed as usage comes in * Show customers their usage and estimated charges in the [Customer Portal](/docs/features/customer-portal/introduction) The same events can also carry cost data, which [Cost Insights](/docs/features/cost-insights/introduction) uses to track what each customer costs you. ## Concepts ### Events Events are the core of Usage Based Billing. They represent *some* usage done by a customer in your application. Typical examples of events are: * A customer consumed AI LLM tokens * A customer streamed minutes of video * A customer uploaded a file to your application Events are sent to Polar using the [Events Ingestion API](/docs/api-reference/current/events/ingest-events) and are stored in our database. An event consists of the following fields: * A `name`, which is a string that can be used to identify the type of event. For example, `ai_usage`, `video_streamed` or `file_uploaded`. * A `customer_id` or `external_customer_id`, which is Polar's customer ID or your user's ID. This is used to identify the customer that triggered the event. * A `metadata` object, which is a JSON object that can contain any additional information about the event. This is useful for storing information that can be used to filter the events or compute the actual usage. For example, you can store the duration of the video streamed or the size of the file uploaded. Here is an example of an event: ```json theme={null} { "name": "ai_usage", "external_customer_id": "cus_123", "metadata": { "model": "gpt-4.1-nano", "requests": 1, "total_tokens": 77, "request_tokens": 58, "response_tokens": 19 } } ``` ### Meters Meters are there to filter and aggregate the events that are ingested. Said another way, this is how you define what usage you want to charge for, based on the events you send to Polar. For example: * AI usage meter, which filters the events with the name `ai_usage` and sums the `total_tokens` field. * Video streaming meter, which filters the events with the name `video_streamed` and sums the `duration` field. * File upload meter, which filters the events with the name `file_uploaded` and sums the `size` field. You can create and manage your meters from the dashboard. Polar is then able to compute the usage over time, both globally and per customer. ### Metered Price To charge customers for their usage, add a metered price based on a meter to a Product. See [Usage-Based Pricing](/docs/features/usage-based-billing/billing). ### Meter Credits benefit You can give credits to your customers on a specific meter. This is done by creating a Meter Credits Benefit, which is a special type of benefit that allows you to give credits to your customers on a specific meter. On a recurring product, the customer will be credited the amount of units specified in the benefit at the beginning of every subscription cycle period — monthly or yearly. ## Quickstart Get up and running in 5 minutes **1. Create a Meter** Meters consist of filters and an aggregation function. The filter is used to filter the events that should be included in the meter and the aggregation function is used to compute the usage. ![](https://mintcdn.com/polar/fnujBPxaFvfkZfB0/assets/features/usage/create-meter.light.png?fit=max\&auto=format\&n=fnujBPxaFvfkZfB0\&q=85\&s=0145ac51bc8100b038482d31612f3ea6) **2. Add metered price to a Product** Only needed if you want to charge for usage. Add a metered price to the Product to bill customers based on the meter. Metered prices are only applicable to Subscription Products. ![](https://mintcdn.com/polar/0Af3hN6-oIM4IHT3/assets/features/usage/product-meter.light.png?fit=max\&auto=format\&n=0Af3hN6-oIM4IHT3\&q=85\&s=c1a9f0493fa6b73f0d4581b19e5d757c) **3. Ingest Events** Now you're ready to ingest events from your application. Sending events which match the meter's filter will increment the meter's usage for the customer. ![](https://mintcdn.com/polar/fnujBPxaFvfkZfB0/assets/features/usage/ingest.light.png?fit=max\&auto=format\&n=fnujBPxaFvfkZfB0\&q=85\&s=6428f34bbf464c2e8248138ccbcea782) **4. Customer Usage** Customers can view their estimated charges for each meter in the Customer Portal. ![](https://mintcdn.com/polar/fnujBPxaFvfkZfB0/assets/features/usage/portal.light.png?fit=max\&auto=format\&n=fnujBPxaFvfkZfB0\&q=85\&s=85bdb395f87e972ed50a7381ba3aad43) # Meters Source: https://polar.sh/docs/features/usage-based-billing/meters Creating and managing meters Meters are there to filter and aggregate the events that are ingested. Said another way, this is how you define what usage you want to charge for, based on the events you send to Polar. For example: * AI usage meter, which filters the events with the name `ai_usage` and sums the `total_tokens` field. * Video streaming meter, which filters the events with the name `video_streamed` and sums the `duration` field. * File upload meter, which filters the events with the name `file_uploaded` and sums the `size` field. You can create and manage your meters from the dashboard. Polar is then able to compute the usage over time, both globally and per customer. ## Creating a Meter To create a meter, [open the Meters page](https://polar.sh/to/dashboard/products/meters) and click the "Create Meter" button. ![](https://mintcdn.com/polar/fnujBPxaFvfkZfB0/assets/features/usage/create-meter.light.png?fit=max\&auto=format\&n=fnujBPxaFvfkZfB0\&q=85\&s=0145ac51bc8100b038482d31612f3ea6) ## Filters A filter is a set of clauses that are combined using conjunctions. They're used to filter events that you've ingested into Polar. ![](https://mintcdn.com/polar/fnujBPxaFvfkZfB0/assets/features/usage/filter.light.png?fit=max\&auto=format\&n=fnujBPxaFvfkZfB0\&q=85\&s=77aca67ac7630a38fefa9a6d567a58f3) ### Clauses A clause is a condition that an event must meet to be included in the meter. #### Property Properties are the properties of the event that you want to filter on. If you want to match on a metadata field, you can use the metadata key directly. No need to include a `metadata.` prefix. #### Operator Operators are the operators that you want to use to filter the events. * **Equals** * **Not equals** * **Greater Than** * **Greater Than or Equals** * **Less Than** * **Less Than or Equals** * **Contains** * **Does Not Contain** #### Value Values are automatically parsed in the filter builder. They're parsed in the following order: 1. Number — Tries to parse the value as number 2. Boolean — Checks if value is "true" or "false" 3. String — Treats value as string as fallback ### Conjunctions A conjunction is a logical operator that combines two or more clauses. * **and** — All clauses must be true for the event to be included. * **or** — At least one clause must be true for the event to be included. ## Aggregation The aggregation is the function that is used to aggregate the events that match the filter. For example, if you want to count the number of events that match the filter, you can use the **Count** aggregation. If you want to sum the value of a metadata field, you can use the **Sum** aggregation. * **Count** — Counts the number of events that match the filter. * **Sum** — Sums the value of a property. * **Average** — Computes the average value of a property. * **Minimum** — Computes the minimum value of a property. * **Maximum** — Computes the maximum value of a property. * **Unique** — Counts the number of unique values of a property. > [accordion] Example > > Consider the following events: > > ```json theme={null} > [ > { > "name": "ai_usage", > "external_customer_id": "cus_123", > "metadata": { > "total_tokens": 10 > } > }, > { > "name": "ai_usage", > "external_customer_id": "cus_123", > "metadata": { > "total_tokens": 20 > } > }, > { > "name": "ai_usage", > "external_customer_id": "cus_123", > "metadata": { > "total_tokens": 30 > } > }, > { > "name": "ai_usage", > "external_customer_id": "cus_123", > "metadata": { > "total_tokens": 30 > } > } > ] > ``` > > Here is the result of each aggregation function, over the `total_tokens` metadata property: > > * **Count**: 4 units > * **Sum**: 90 units > * **Average**: 22.5 units > * **Minimum**: 10 units > * **Maximum**: 30 units > * **Unique**: 3 units If you want to use a metadata property in the aggregation, you can use the metadata property directly. No need to include a `metadata.` prefix. ## Unit The unit controls how prices for this meter are **formatted and displayed** to customers — on invoices, in the customer portal, and in your checkout. It does not affect billing calculation; it is purely presentational. | Unit | Display format | Best for | | - | - | - | | Scalar | \$0.05 / unit | Generic counts (API calls, events, seats) | | Token | \$20.00 / 1M tokens | LLM token consumption | | Custom | Configurable (see below) | Any unit not covered above | ### Custom unit Select **Custom** to define your own display format. Two additional fields appear: * **Unit label** — The singular name shown after the price, e.g. `gigabyte` displays as `$0.023 / gigabyte`. * **Unit multiplier** — Scales the displayed price so you can show a more readable denomination. For example, a multiplier of `1000` shows the price per 1 000 units rather than per single unit. > [!TIP] > > The unit multiplier only affects how the price is shown. The raw `unit_amount` > you set is still the price per single event unit — the multiplier scales the > display amount for readability. ## Example The following Meter Filter & Aggregation will match events that have the name `openai-usage` and sum units over metadata property `completionTokens`. ![](https://mintcdn.com/polar/fnujBPxaFvfkZfB0/assets/features/usage/meter.light.png?fit=max\&auto=format\&n=fnujBPxaFvfkZfB0\&q=85\&s=2c4ba244ceee17f9bda8665f6a22a6b6) > [!TIP] > > You can **Preview** the events matched by the meter while creating it. ## Good to know A few things to keep in mind when creating and managing meters: ### Updating a Meter You may update a meter's filters or aggregation function as long as the meter doesn't have any processed events or does not have any customer purchase associated with it. # Integrate Polar with Encore Source: https://polar.sh/docs/guides/encore In this guide, we'll show you how to integrate Polar with Encore. [Encore](https://encore.dev) is an open source backend framework for TypeScript with built-in infrastructure automation and observability. When you define services, databases, and APIs in code, Encore automatically provisions and manages the underlying infrastructure, both locally and in the cloud. Because Encore defines infrastructure in code and provides built-in distributed tracing, AI coding assistants can both build and debug your backend end-to-end, including your Polar integration. They can read the code to understand the full system, then inspect traces to diagnose exactly what happened when a checkout completes or a webhook arrives. Consider following this guide while using the Polar Sandbox Environment. This will allow you to test your integration without affecting your production data. ## Examples * [With Encore](https://github.com/polarsource/examples/tree/main/with-encore) ## Install the Polar JavaScript SDK To get started, install the Polar JavaScript SDK and the webhook verification library: ```bash Terminal theme={null} npm install @polar-sh/sdk standardwebhooks ``` ## Setting up Secrets Encore has built-in secrets management that works consistently across local development and cloud environments. ### Polar Access Token and Mode To authenticate with Polar, you need to create an access token and specify if it's production or sandbox mode. You can create an [organization access token from your organization settings](/docs/integrate/oat). Add it to Encore using the secrets manager: ```bash Terminal theme={null} encore secret set --type local POLAR_ACCESS_TOKEN encore secret set --type local POLAR_MODE ``` ### Polar Webhook Secret You'll need a webhook secret to verify incoming webhook events. We'll set this up in the webhook section below. ```bash Terminal theme={null} encore secret set --type local POLAR_WEBHOOK_SECRET ``` When deploying to Encore Cloud, you'll set production secrets through the dashboard or CI/CD pipeline. ## Configuring a Polar API Client To interact with the Polar API, create a client with `createPolar` using Encore's secret management. ```tsx title="payments/polar.ts" theme={null} import { createPolar } from "@polar-sh/sdk/2026-10"; import { secret } from "encore.dev/config"; const POLAR_MODE = secret("POLAR_MODE"); const POLAR_ACCESS_TOKEN = secret("POLAR_ACCESS_TOKEN"); export const polar = createPolar({ accessToken: POLAR_ACCESS_TOKEN(), environment: POLAR_MODE() as "sandbox" | "production", }); ``` Remember to set `POLAR_MODE` as `production` when you're ready to switch to the production environment. ## Generating Polar Checkout Sessions Create a checkout endpoint that creates a Polar checkout session and redirects the user. ```tsx title="payments/payments.ts" theme={null} import { api, APIError } from "encore.dev/api"; import { polar } from "./polar"; export const checkout = api.raw( { expose: true, path: "/checkout", method: "GET" }, async (req, resp) => { const url = new URL(req.url!, `http://${req.headers.host}`); const productId = url.searchParams.get("product"); if (!productId) { resp.writeHead(400); resp.end("Missing product query parameter"); return; } try { const result = await polar.checkouts.create({ products: [productId], success_url: "https://your-app.com/confirmation?checkout_id={CHECKOUT_ID}", }); resp.writeHead(302, { Location: result.url }); resp.end(); } catch (error) { console.error("[Polar] Checkout error:", error); resp.writeHead(500); resp.end("Failed to create checkout session"); } } ); ``` You can now create a checkout session by visiting `/checkout?product=YOUR_PRODUCT_ID`. ## Handling Polar Webhooks Polar can send you events about various things happening in your organization. This is useful for keeping your database in sync with Polar checkouts, orders, subscriptions, etc. Configuring a webhook is simple. Head over to [**Settings → Webhooks**](https://polar.sh/to/dashboard/settings/webhooks) and click on the "Add Endpoint" button to create a new webhook. ### Tunneling webhook events to your local development environment Encore runs your app locally with full infrastructure support. To receive webhooks during local development, you can use the [Polar CLI](/docs/integrate/cli/webhooks) to tunnel webhook events to your local environment. ```bash Terminal theme={null} polar webhook listen http://localhost:4000/webhooks/polar ``` Make sure to copy the webhook secret and set it using: ```bash Terminal theme={null} encore secret set --type local POLAR_WEBHOOK_SECRET ``` ### Add Webhook Endpoint 1. Point the Webhook to `your-app.com/webhooks/polar`. This must be an absolute URL which Polar can reach. If you use the Polar CLI tunnel, it will handle this for you. 2. Select which events you want to be notified about. You can read more about the available events in the [Events section](/docs/api-reference#webhooks). 3. Generate a secret key to sign the requests. This will allow you to verify that the requests are truly coming from Polar. 4. Add the secret key to Encore: ```bash Terminal theme={null} encore secret set --type local POLAR_WEBHOOK_SECRET ``` ### Setting up the Webhook handler Encore webhook handlers use `api.raw()` to access the raw request body, which is required for signature verification. ```tsx title="payments/payments.ts" theme={null} import { api } from "encore.dev/api"; import { secret } from "encore.dev/config"; import { Webhook } from "standardwebhooks"; const POLAR_WEBHOOK_SECRET = secret("POLAR_WEBHOOK_SECRET"); export const webhooks = api.raw( { expose: true, path: "/webhooks/polar", method: "POST" }, async (req, resp) => { // Read the raw request body const chunks: Buffer[] = []; for await (const chunk of req) { chunks.push(chunk); } const body = Buffer.concat(chunks).toString("utf-8"); // Convert headers for standardwebhooks const headers: Record = {}; for (const [key, value] of Object.entries(req.headers)) { headers[key] = Array.isArray(value) ? value[0] : (value || ""); } // Verify the webhook signature. Try Standard Webhooks first (secret as-is), // then Polar's legacy HMAC (UTF-8 bytes of the full secret, including `whsec_`). const secret = POLAR_WEBHOOK_SECRET().trim(); let payload: any; try { payload = new Webhook(secret).verify(body, headers); } catch { try { const legacySecret = Buffer.from(secret, "utf-8").toString("base64"); payload = new Webhook(legacySecret).verify(body, headers); } catch (error: any) { console.error("[Polar] Invalid webhook signature:", error?.message); resp.writeHead(403); resp.end(JSON.stringify({ error: "Invalid signature" })); return; } } // Handle the payload switch (payload.type) { case "order.created": console.log("[Polar] Order created:", payload.data.id); break; case "subscription.active": console.log("[Polar] Subscription active:", payload.data.id); break; case "subscription.canceled": console.log("[Polar] Subscription canceled:", payload.data.id); break; case "customer.state_changed": console.log("[Polar] Customer state changed:", payload.data.id); break; default: console.log("[Polar] Unhandled event:", payload.type); } resp.writeHead(200); resp.end(JSON.stringify({ received: true })); } ); ``` > [!WARNING] > > Polar webhook signatures use two key derivations depending on when the secret > was generated. Polar SDKs (version 1.0.0-alpha.19 and later) try both. If you > verify with `standardwebhooks` directly: secrets created **on or after 8 > September 2026, 00:00 UTC** can be passed to `new Webhook()` as-is (`whsec_…`). > Older Polar secrets need the **entire** secret UTF-8 string base64-encoded > first. ## Local Development Start your Encore app: ```bash Terminal theme={null} encore run ``` Encore provides a local development dashboard at `localhost:9400` where you can: * View distributed traces for all requests, including checkout redirects and webhook deliveries * Inspect API calls between services * Query local databases * View logs and errors in real-time This makes debugging payment flows straightforward since you can trace exactly what happens when a checkout completes or a webhook arrives. ## Deploying to Production When you're ready to go live, deploy to Encore Cloud or your own cloud account: ```bash Terminal theme={null} git push encore ``` Encore automatically provisions all the infrastructure your app needs. Remember to: 1. Set production secrets in the Encore Cloud dashboard 2. Set the `POLAR_MODE` secret to `"production"` 3. Update your webhook URL in Polar to point to your production domain 4. Update `success_url` to your production URL # Integrate Polar with Laravel Source: https://polar.sh/docs/guides/laravel In this guide, we'll show you how to integrate Polar with Laravel. ![](https://mintcdn.com/polar/0Af3hN6-oIM4IHT3/assets/guides/laravel/hero.jpeg?fit=max\&auto=format\&n=0Af3hN6-oIM4IHT3\&q=85\&s=7f57da3dcc77d6f8e0f8b2e760f0aeea) Consider following this guide while using the Polar Sandbox Environment. This will allow you to test your integration without affecting your production data. ## Polar Laravel Example App We've created a simple example Laravel application that you can use as a reference. [View Code on GitHub](https://github.com/polarsource/polar-laravel) ## Setting up environment variables ### Polar API Key To authenticate with Polar, you need to create an access token, and supply it to Laravel using a `POLAR_API_KEY` environment variable. You can create an organization access token from your organization settings. ## Fetching Polar Products for display ### Creating the Products Controller Go ahead and add the following entry in your `routes/web.php` file: ```php theme={null} // routes/web.php Route::get('/products', [ProductsController::class, 'handle']); ``` Next up, create the `ProductsController` class in the `app/Http/Controllers` directory: ```php theme={null} // app/Http/Controllers/ProductsController.php api.polar.sh when ready to go live // And don't forget to update the .env file with the correct POLAR_ORGANIZATION_ID and POLAR_WEBHOOK_SECRET $data = Http::get('https://sandbox-api.polar.sh/v1/products', [ 'is_archived' => false, ]); $products = $data->json(); return view('products', ['products' => $products['items']]); } } ``` ## Displaying Products Finally, create the `products` view in the `resources/views` directory: ```php theme={null} // resources/views/products.blade.php @foreach ($products as $product)

{{ $product['name'] }}

Buy
@endforeach ``` Notice that we create a link to `/checkout` with a query parameter `productId`. This is the ID of the product that the user will be purchasing. We will configure this route in the next section. That's it for the products page. You can now display the products to your users, and they will be able to buy them. Let's now create the checkout endpoint. ## Generating Polar Checkout Sessions This endpoint will be responsible for creating a new checkout session, redirecting the user to the Polar Checkout page & redirect back to a configured confirmation page. Go ahead and create a new entry in your `routes/web.php` file: ```php theme={null} // routes/web.php Route::get('/checkout', [CheckoutController::class, 'handle']); ``` Next, create the `CheckoutController` class in the `app/Http/Controllers` directory: ```php theme={null} // app/Http/Controllers/CheckoutController.php query('productId', ''); // Polar will replace {CHECKOUT_ID} with the actual checkout ID upon a confirmed checkout $confirmationUrl = $request->getSchemeAndHttpHost() . '/confirmation?checkout_id={CHECKOUT_ID}'; // Change from sandbox-api.polar.sh -> api.polar.sh when ready to go live // And don't forget to update the .env file with the correct POLAR_ORGANIZATION_ID and POLAR_WEBHOOK_SECRET $result = Http::withHeaders([ 'Authorization' => 'Bearer ' . env('POLAR_API_KEY'), 'Content-Type' => 'application/json', ])->post('https://sandbox-api.polar.sh/v1/checkouts/custom/', [ 'products' => [$productId], 'success_url' => $confirmationUrl, 'payment_processor' => 'stripe', ]); $data = $result->json(); $checkoutUrl = $data['url']; return redirect($checkoutUrl); } } ``` We can now easily create a checkout session & redirect there by creating a link to `/checkout?productId={productId}`. Just like we did when displaying the products above. Upon Checkout success, the user will be redirected to the confirmation page. ## Creating the Confirmation Page Create a new entry in your `routes/web.php` file: ```php theme={null} // routes/web.php Route::get('/confirmation', [ConfirmationController::class, 'handle']); ``` Next, create the `ConfirmationController` class in the `app/Http/Controllers` directory: ```php theme={null} // app/Http/Controllers/ConfirmationController.php api.polar.sh when ready to go live // And don't forget to update the .env file with the correct POLAR_ORGANIZATION_ID and POLAR_WEBHOOK_SECRET $data = Http::withHeaders([ 'Authorization' => 'Bearer ' . env('POLAR_API_KEY'), 'Content-Type' => 'application/json', ])->get('https://sandbox-api.polar.sh/v1/checkouts/custom/' . $request->query('checkout_id')); $checkout = $data->json(); Log::info(json_encode($checkout, JSON_PRETTY_PRINT)); return view('confirmation', ['checkout' => $checkout]); } } ``` The checkout is not considered "successful" yet however. It's initially marked as `confirmed` until you've received a webhook event `checkout.updated` with a status set to `succeeded`. We'll cover this in the next section. ## Handling Polar Webhooks Polar can send you events about various things happening in your organization. This is very useful for keeping your database in sync with Polar checkouts, orders, subscriptions, etc. Configuring a webhook is simple. Head over to [**Settings → Webhooks**](https://polar.sh/to/dashboard/settings/webhooks) and click on the "Add Endpoint" button to create a new webhook. ### Tunneling webhook events to your local development environment If you're developing locally, you can use a tool like [ngrok](https://ngrok.com/) to tunnel webhook events to your local development environment. This will allow you to test your webhook handlers without deploying them to a live server. Run the following command to start an ngrok tunnel: ```bash Terminal theme={null} ngrok http 3000 ``` ### Add Webhook Endpoint 1. Point the Webhook to `your-app.com/api/webhook/polar`. This must be an absolute URL which Polar can reach. If you use ngrok, the URL will look something like this: `https://.ngrok-free.app/api/webhook/polar`. 2. Select which events you want to be notified about. You can read more about the available events in the [Events section](/docs/api-reference#webhooks). 3. Generate a secret key to sign the requests. This will allow you to verify that the requests are truly coming from Polar. 4. Add the secret key to your environment variables. ```bash Terminal theme={null} # .env POLAR_API_KEY="polar_oat..." POLAR_WEBHOOK_SECRET="..." ``` ### Setting up the Webhook handler First, we need to install the standard-webhooks package to properly decode the incoming webhook payloads. ```bash Terminal theme={null} composer require standard-webhooks/standard-webhooks:dev-main ``` Go and add a `routes/api.php` file and add the following entry: ```php theme={null} // routes/api.php Route::webhooks('/webhook/polar'); ``` Make sure that it is included in the Bootstrap file. ```php theme={null} // bootstrap/app.php withRouting( web: __DIR__.'/../routes/web.php', api: __DIR__.'/../routes/api.php', commands: __DIR__.'/../routes/console.php', health: '/up', ) ->withMiddleware(function (Middleware $middleware) { // }) ->withExceptions(function (Exceptions $exceptions) { // })->create(); ``` We will use Spatie's Webhook Client to handle the webhook events. It will automatically verify the signature of the requests, and dispatch the payload to a job queue for processing. ```bash Terminal theme={null} composer require spatie/laravel-webhook-client ``` Let's publish the config: ```bash Terminal theme={null} php artisan vendor:publish --provider="Spatie\WebhookClient\WebhookClientServiceProvider" --tag="webhook-client-config" ``` This will create a new file called webhook-client.php in the config folder. We need to adjust it to properly verify the signature of the requests. ```php theme={null} // config/webhook-client.php [ [ /* * This package supports multiple webhook receiving endpoints. If you only have * one endpoint receiving webhooks, you can use 'default'. */ 'name' => 'default', /* * We expect that every webhook call will be signed using a secret. This secret * is used to verify that the payload has not been tampered with. */ 'signing_secret' => env('POLAR_WEBHOOK_SECRET'), /* * The name of the header containing the signature. */ 'signature_header_name' => 'webhook-signature', /* * This class will verify that the content of the signature header is valid. * * It should implement \Spatie\WebhookClient\SignatureValidator\SignatureValidator */ // 'signature_validator' => \Spatie\WebhookClient\SignatureValidator\DefaultSignatureValidator::class, 'signature_validator' => App\Handler\PolarSignature::class, /* * This class determines if the webhook call should be stored and processed. */ 'webhook_profile' => \Spatie\WebhookClient\WebhookProfile\ProcessEverythingWebhookProfile::class, /* * This class determines the response on a valid webhook call. */ 'webhook_response' => \Spatie\WebhookClient\WebhookResponse\DefaultRespondsTo::class, /* * The classname of the model to be used to store webhook calls. The class should * be equal or extend Spatie\WebhookClient\Models\WebhookCall. */ 'webhook_model' => \Spatie\WebhookClient\Models\WebhookCall::class, /* * In this array, you can pass the headers that should be stored on * the webhook call model when a webhook comes in. * * To store all headers, set this value to `*`. */ 'store_headers' => [], /* * The class name of the job that will process the webhook request. * * This should be set to a class that extends \Spatie\WebhookClient\Jobs\ProcessWebhookJob. */ 'process_webhook_job' => App\Handler\ProcessWebhook::class, ], ], /* * The integer amount of days after which models should be deleted. * * 7 deletes all records after 1 week. Set to null if no models should be deleted. */ 'delete_after_days' => 30, ]; ``` ### Preparing the database By default, all webhook calls get saved into the database. So, we need to publish the migration that will hold the records. So run: ```bash Terminal theme={null} php artisan vendor:publish --provider="Spatie\WebhookClient\WebhookClientServiceProvider" --tag="webhook-client-migrations" ``` This will create a new migration file in the “database/migration” folder. Then run `php artisan migrate` to run the migration. ### Setting up the queue system Before we set up our job handler — let’s set up our queue system Go to your “.env” file and set the QUEUE_CONNECTION=database — you can decide to use other connections like redis. Let’s create our jobs table by running php artisan queue:table and then run the migration using php artisan migrate. ### Create the Handlers The next thing we do is to create a folder named Handler inside the app folder. Then inside this app/Handler, create two files which are * PolarSignature.php * ProcessWebhook.php Inside app/Handler/PolarSignature.php, validate that the request came from Polar. Try Standard Webhooks first (secret as-is), then Polar's legacy HMAC (base64-encode the full `whsec_…` string). Add the code to that file. ```php theme={null} // app/Handler/PolarSignature.php $request->header("webhook-id"), "webhook-signature" => $request->header("webhook-signature"), "webhook-timestamp" => $request->header("webhook-timestamp"), ); $body = $request->getContent(); $secret = $config->signingSecret; try { (new \StandardWebhooks\Webhook($secret))->verify($body, $headers); return true; } catch (\Throwable) { try { $legacySecret = base64_encode($secret); (new \StandardWebhooks\Webhook($legacySecret))->verify($body, $headers); return true; } catch (\Throwable) { return false; } } } } ``` Great. So the other file app/Handler/ProcessWebhook.php extends the ProcessWebhookJob class which holds the WebhookCall variables containing each job’s detail. ```php theme={null} // app/Handler/ProcessWebhook.php webhookCall, true); $data = $decoded['payload']; switch ($data['type']) { case "checkout.created": // Handle the checkout created event break; case "checkout.updated": // Handle the checkout updated event break; case "subscription.created": // Handle the subscription created event break; case "subscription.updated": // Handle the subscription updated event break; case "subscription.active": // Handle the subscription active event break; case "subscription.revoked": // Handle the subscription revoked event break; case "subscription.canceled": // Handle the subscription canceled event break; default: // Handle unknown event Log::info($data['type']); break; } //Acknowledge you received the response http_response_code(200); } } ``` Our application is ready to receive webhook requests. Don’t forget to run `php artisan queue:listen` to process the jobs. ### Tips If you're keeping track of active and inactive subscriptions in your database, make sure to handle the `subscription.active` and `subscription.revoked` events accordingly. The cancellation of a subscription is handled by the `subscription.canceled` event. The user has probably canceled their subscription before the end of the billing period. Do not revoke any kind of access immediately, but rather wait until the end of the billing period or when you receive the `subscription.revoked` event. ## Notifying the client about the event If you're building a real-time application, you might want to notify the client about the event. On the confirmation-page, you can listen for the `checkout.updated` event and update the UI accordingly when it reaches the succeeded status. ## Polar Laravel Example App We've created a simple example Laravel application that you can use as a reference [View Code on GitHub](https://github.com/polarsource/polar-laravel) # Integrate Polar with Next.js Source: https://polar.sh/docs/guides/nextjs In this guide, we'll show you how to integrate Polar with Next.js. Feel free to use our quick-start script to get started inside a new Next.js project: ```bash Terminal theme={null} # Inside a new Next.js project npx polar-init ``` Consider following this guide while using the Polar Sandbox Environment. This will allow you to test your integration without affecting your production data. [A complete code-example of this guide can be found on GitHub](https://github.com/polarsource/polar-next). ## Install the Polar JavaScript SDK To get started, you need to install the Polar JavaScript SDK and the Polar Nextjs helper package. You can do this by running the following command: ```bash Terminal theme={null} pnpm install @polar-sh/sdk @polar-sh/nextjs ``` ## Setting up environment variables ### Polar Access Token To authenticate with Polar, you need to create an access token, and supply it to Next.js using a `POLAR_ACCESS_TOKEN` environment variable. You can create an organization access token from your organization settings. ## Configuring a Polar API Client To interact with the Polar API, create a client with `createPolar`. It uses the provided access token to authenticate with the Polar API. ```typescript theme={null} // src/polar.ts import { createPolar } from "@polar-sh/sdk/2026-10"; export const api = createPolar({ accessToken: process.env.POLAR_ACCESS_TOKEN!, environment: "sandbox", // Use this option if you're using the sandbox environment - else use 'production' or omit the parameter }); ``` Remember to replace `sandbox` with `production` when you're ready to switch to the production environment. ## Generating Polar Checkout Sessions Next up, we need to create a checkout endpoint to handle the creation of checkout sessions. Go ahead and create a new GET route in Next.js. ```typescript theme={null} // src/app/checkout/route.ts import { Checkout } from "@polar-sh/nextjs"; export const GET = Checkout({ accessToken: process.env.POLAR_ACCESS_TOKEN!, successUrl: "https://your-app.com/confirmation", // The handler appends checkout_id={CHECKOUT_ID} environment: "sandbox", // Use this option if you're using the sandbox environment - else use 'production' or omit the parameter }); ``` ## Handling Polar Webhooks Polar can send you events about various things happening in your organization. This is very useful for keeping your database in sync with Polar checkouts, orders, subscriptions, etc. Configuring a webhook is simple. Head over to [**Settings → Webhooks**](https://polar.sh/to/dashboard/settings/webhooks) and click on the "Add Endpoint" button to create a new webhook. ### Tunneling webhook events to your local development environment If you're developing locally, you can use a tool like [ngrok](https://ngrok.com/) to tunnel webhook events to your local development environment. This will allow you to test your webhook handlers without deploying them to a live server. Run the following command to start an ngrok tunnel: ```bash Terminal theme={null} ngrok http 3000 ``` ### Add Webhook Endpoint 1. Point the Webhook to `your-app.com/api/webhook/polar`. This must be an absolute URL which Polar can reach. If you use ngrok, the URL will look something like this: `https://.ngrok-free.app/api/webhook/polar`. 2. Select which events you want to be notified about. You can read more about the available events in the [Events section](/docs/api-reference#webhooks). 3. Generate a secret key to sign the requests. This will allow you to verify that the requests are truly coming from Polar. 4. Add the secret key to your environment variables. ```bash Terminal theme={null} # .env POLAR_ACCESS_TOKEN="polar_pat..." POLAR_WEBHOOK_SECRET="..." ``` ### Setting up the Webhook handler ```typescript theme={null} // src/app/api/webhook/polar/route.ts import { Webhooks } from "@polar-sh/nextjs"; export const POST = Webhooks({ webhookSecret: process.env.POLAR_WEBHOOK_SECRET!, onPayload: async (payload) => { // Handle payload... }, }); ``` The webhook event is now verified and you can proceed to handle the payload data. ### Handling Webhook Events Depending on which events you've subscribed to, you'll receive different payloads. This is where you can update your database, send notifications, etc. ```typescript theme={null} // src/app/api/webhook/polar/route.ts import { Webhooks } from "@polar-sh/nextjs"; export const POST = Webhooks({ webhookSecret: process.env.POLAR_WEBHOOK_SECRET!, onPayload: async (payload) => {}, onOrderCreated: async (payload) => { // The order is in payload.data }, onCustomerStateChanged: async (payload) => { // The customer state is in payload.data }, // ... }); ``` ### Notifying the client about the event If you're building a real-time application, you might want to notify the client about the event. On the confirmation-page, you can listen for the `checkout.updated` event and update the UI accordingly when it reaches the succeeded status. # Authentication Source: https://polar.sh/docs/integrate/authentication > [!NOTE] > > All bearer tokens should be kept private and never shared or exposed in client-side code. To authenticate requests, Polar API has two mechanisms. 1. [Organization Access Tokens (OAT)](/docs/integrate/oat) - Recommended 2. [OAuth 2.0 Provider](/docs/integrate/oauth2/introduction) (Partner Integrations) ## Organization Access Tokens (OAT) They are tied to **one** of your organization. You can create them from your organization settings. ## Security To protect your data and ensure the security of Polar, we've several mechanisms in place to automatically revoke tokens that may have been leaked publicly on the web. In particular, we're part of the [GitHub Secret Scanning Program](https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning). If GitHub systems detect a Polar token in a code repository or public discussion, our systems are notified and the tokens are immediately revoked. If you received an email about one of your token being leaked, it means that we were notified of such situation. The email contains the details about the nature of the token and the source of the leak. In the future, it's crucial that you remain extra cautious about not leaking your tokens publicly online. You can read more about the good practices to manage secrets in the [OWASP Secrets Management Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html). # Authentication Source: https://polar.sh/docs/integrate/cli/authentication Sign in to Polar from the CLI and choose the organization you work on The CLI signs in through your browser with OAuth. Sessions are stored in your operating system's keychain, one per environment, so you can be signed in to sandbox and production at the same time. ## Signing in Every login targets one environment. Pass the environment as a flag, or run the command without one in a terminal and the CLI will ask: > [tab] Sandbox > > ```bash Terminal theme={null} > polar auth login --sandbox > ``` > [tab] Production > > ```bash Terminal theme={null} > polar auth login --production > ``` Your browser opens on Polar's authorization page. Approve the request and return to the terminal. If a session already exists for that environment, the CLI keeps it and tells you how to replace it with `--new-session`. After signing in, the CLI lists every organization you can access across the environments you are signed in to and asks which one to make active. ## The active organization Commands that act on an organization, such as `polar webhook listen`, use the active organization. Its environment comes with it: choosing a sandbox organization means the CLI talks to sandbox, choosing a production organization means it talks to production. There is no separate environment switch. ```bash Terminal theme={null} polar auth org ``` Shows the same organization picker as login, so you can switch at any time. ```bash Terminal theme={null} polar auth whoami ``` Prints which environments you are signed in to and the active organization. ```bash Terminal theme={null} polar auth list ``` Lists every organization you can access, grouped by environment, with the active one marked. To use a different organization for a single command without changing the active one, pass its ID: ```bash Terminal theme={null} polar webhook listen http://localhost:3000/webhooks --org ``` ## Signing out Log out of one environment or all of them: ```bash Terminal theme={null} polar auth logout --production polar auth logout --all ``` Run it without a flag in a terminal to pick from your sessions. Logging out removes the session from your keychain and clears the active organization if it belonged to that environment. ## CI and headless use On machines without a browser or keychain, authenticate with an [organization access token](/docs/integrate/oat) instead of a session: ```bash Terminal theme={null} export POLAR_ACCESS_TOKEN=polar_oat_... export POLAR_ENVIRONMENT=sandbox polar webhook listen http://localhost:3000/webhooks ``` `POLAR_ENVIRONMENT` selects the environment the token belongs to and defaults to `production`. When a token can access several organizations, pass `--org ` to the command. > [!NOTE] > > While `POLAR_ACCESS_TOKEN` is set, saved sessions are ignored and `polar auth > login` and `polar auth org` refuse to run. Unset it to go back to your > browser session. ## Where things are stored * Sessions live in the operating system keychain under the service name `polar-cli`, with one entry per environment. * The active organization is saved in `~/.config/polar-cli/config.json`, or `$XDG_CONFIG_HOME/polar-cli/config.json` when that variable is set. # Polar CLI Source: https://polar.sh/docs/integrate/cli/introduction Forward webhooks to your machine, trigger sample events and manage your Polar sessions from the terminal The Polar CLI brings your Polar organization to your terminal. Use it to receive webhooks on your local machine while you build, send realistic sample events to your handler, and switch between your sandbox and production organizations. > [card] [Authentication](/docs/integrate/cli/authentication) > > Sign in to sandbox and production, and choose the organization you work on. > [card] [Webhooks](/docs/integrate/cli/webhooks) > > Receive real webhooks locally and trigger sample events on demand. > [card] [Command reference](/docs/integrate/cli/reference) > > Every command, argument and flag. ## Installation The CLI ships as a single binary for macOS (Apple Silicon and Intel), Linux (x64) and Windows through WSL. ```bash Terminal theme={null} curl -fsSL https://polar.sh/install.sh | bash ``` Or with your package manager, on any platform. pnpm and bun block install scripts by default, and the flags below allow the one that unpacks the binary: ```bash Terminal theme={null} npm install -g @polar-sh/cli pnpm add -g --allow-build=@polar-sh/cli @polar-sh/cli bun install -g --trust @polar-sh/cli ``` Check that it works: ```bash Terminal theme={null} polar --version ``` ## Updating The CLI checks for new releases in the background and tells you when one is available. Install it with: ```bash Terminal theme={null} polar update ``` ## Shell completions Print a completion script for your shell and add it to your profile: ```bash Terminal theme={null} polar --completions zsh ``` Bash, fish and sh are supported too. Run `polar --help` to list every command, or add `--help` to a command, like `polar products --help`, to see the flags of every command under it at once. ## Telemetry The CLI sends one anonymous event per command to help us improve it: the command name, the names of the flags used (never their values), whether it succeeded, the duration, the CLI version, your operating system, and whether it ran in CI or from an AI coding agent. Events are keyed by a random install id. Access tokens, organization IDs, URLs and webhook payloads are never sent. To opt out, set either variable in your environment: ```bash Terminal theme={null} export POLAR_CLI_TELEMETRY_OPTOUT=1 ``` The standard `DO_NOT_TRACK=1` is honoured as well. # Command reference Source: https://polar.sh/docs/integrate/cli/reference Every command, argument and flag of the Polar CLI Each command has its own page. Run any command with `--help` to see the same information in your terminal. ```bash theme={null} polar [flags] ``` ## CLI commands * [`polar auth`](/docs/integrate/cli/reference/auth) Manage your Polar sessions and active organization * [`polar agent`](/docs/integrate/cli/reference/agent) Set up coding agents to build with Polar * [`polar webhook`](/docs/integrate/cli/reference/webhook) Test webhooks against your local server * [`polar update`](/docs/integrate/cli/reference/update) Update the CLI to the latest release ## API resources * [`polar benefit_grants`](/docs/integrate/cli/reference/benefit_grants) * [`polar benefits`](/docs/integrate/cli/reference/benefits) * [`polar checkout_links`](/docs/integrate/cli/reference/checkout_links) * [`polar checkouts`](/docs/integrate/cli/reference/checkouts) * [`polar custom_fields`](/docs/integrate/cli/reference/custom_fields) * [`polar customer_meters`](/docs/integrate/cli/reference/customer_meters) * [`polar customer_seats`](/docs/integrate/cli/reference/customer_seats) * [`polar customers`](/docs/integrate/cli/reference/customers) * [`polar discounts`](/docs/integrate/cli/reference/discounts) * [`polar event_types`](/docs/integrate/cli/reference/event_types) * [`polar events`](/docs/integrate/cli/reference/events) * [`polar files`](/docs/integrate/cli/reference/files) * [`polar license_keys`](/docs/integrate/cli/reference/license_keys) * [`polar meters`](/docs/integrate/cli/reference/meters) * [`polar metrics`](/docs/integrate/cli/reference/metrics) * [`polar orders`](/docs/integrate/cli/reference/orders) * [`polar organizations`](/docs/integrate/cli/reference/organizations) * [`polar payments`](/docs/integrate/cli/reference/payments) * [`polar products`](/docs/integrate/cli/reference/products) * [`polar refunds`](/docs/integrate/cli/reference/refunds) * [`polar subscriptions`](/docs/integrate/cli/reference/subscriptions) * [`polar webhooks`](/docs/integrate/cli/reference/webhooks) ## Global flags These flags work with every command. | Flag | Type | Description | | - | - | - | | `--help`, `-h` | `boolean` | Show help information | | `--version`, `-v` | `boolean` | Show version information | | `--completions` | `` | Print shell completion script (choices: bash, zsh, fish, sh) | | `--log-level` | `` | Sets the minimum log level (choices: all, trace, debug, info, warn, warning, error, fatal, none) | | `--json` | `boolean` | Print the result as JSON | # polar agent Source: https://polar.sh/docs/integrate/cli/reference/agent Set up coding agents to build with Polar ```bash theme={null} polar agent [flags] ``` **Subcommands** * [`polar agent setup`](#polar-agent-setup) Install the Polar plugin, MCP server and skills for your coding agents ## polar agent setup Install the Polar plugin, MCP server and skills for your coding agents ```bash theme={null} polar agent setup [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--status` | `boolean` | Show what is set up without changing anything | | `--confirm`, `-c` | `boolean` | Set up every detected agent without asking | | `--force` | `boolean` | Reinstall even when an agent is already set up | | `--client` | `choice` | Only set up this agent (choices: claude-code, codex, cursor) | | `--skills` | `choice` | Also install the Polar skills into .agents/skills of this directory (project) or your home directory (global), for agents without a Polar plugin (choices: project, global) | **Examples** Detect Claude Code, Codex and Cursor, then choose what to set up ```bash theme={null} polar agent setup ``` Show what is already set up ```bash theme={null} polar agent setup --status ``` Only install the Polar plugin for Claude Code ```bash theme={null} polar agent setup --client claude-code ``` Install the Polar skills into .agents/skills for any other agent ```bash theme={null} polar agent setup --skills project ``` Set up every detected agent without asking, for scripts ```bash theme={null} polar agent setup --confirm --json ``` # polar auth Source: https://polar.sh/docs/integrate/cli/reference/auth Manage your Polar sessions and active organization ```bash theme={null} polar auth [flags] ``` **Subcommands** * [`polar auth login`](#polar-auth-login) Sign in to Polar through your browser * [`polar auth whoami`](#polar-auth-whoami) Show the active organization * [`polar auth list`](#polar-auth-list) List the organizations you have access to * [`polar auth org`](#polar-auth-org) Choose the active organization * [`polar auth token`](#polar-auth-token) Create an organization access token for your app and print it * [`polar auth logout`](#polar-auth-logout) Sign out and remove saved sessions ## polar auth login Sign in to Polar through your browser ```bash theme={null} polar auth login [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--sandbox` | `boolean` | Use the sandbox environment | | `--production` | `boolean` | Use the production environment | | `--new-session` | `boolean` | Sign in again even if a session is already saved | **Examples** Choose sandbox or production, then sign in ```bash theme={null} polar auth login ``` Sign in to sandbox ```bash theme={null} polar auth login --sandbox ``` Sign in to production again, replacing the saved session ```bash theme={null} polar auth login --production --new-session ``` ## polar auth whoami Show the active organization ```bash theme={null} polar auth whoami [flags] ``` ## polar auth list List the organizations you have access to ```bash theme={null} polar auth list [flags] ``` ## polar auth org Choose the active organization ```bash theme={null} polar auth org [flags] ``` ## polar auth token Create an organization access token for your app and print it ```bash theme={null} polar auth token [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--scope` | `string` | Scope to preselect on the token page, e.g. products:read. Repeatable | **Examples** Add a token for the active organization to .env.local ```bash theme={null} echo "POLAR_ACCESS_TOKEN=$(polar auth token)" >> .env.local ``` Preselect scopes and store the token as a GitHub Actions secret without writing it to disk ```bash theme={null} polar auth token --scope products:read --scope checkouts:write | gh secret set POLAR_ACCESS_TOKEN ``` ## polar auth logout Sign out and remove saved sessions ```bash theme={null} polar auth logout [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--sandbox` | `boolean` | Use the sandbox environment | | `--production` | `boolean` | Use the production environment | | `--all` | `boolean` | Remove every saved session | **Examples** Sign out, asking which session only if you have both ```bash theme={null} polar auth logout ``` Remove every saved session ```bash theme={null} polar auth logout --all ``` # polar benefit_grants Source: https://polar.sh/docs/integrate/cli/reference/benefit_grants ```bash theme={null} polar benefit_grants [flags] ``` **Subcommands** * [`polar benefit_grants list`](#polar-benefit_grants-list) List benefit grants across all benefits accessible to the authenticated subject. ## polar benefit_grants list List benefit grants across all benefits accessible to the authenticated subject. ```bash theme={null} polar benefit_grants list [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--organization-id`, `--org` | `string` | Filter by organization ID. Defaults to the active organization. | | `--customer-id` | `string` | Filter by customer ID. | | `--external-customer-id` | `string` | Filter by customer external ID. | | `--is-granted` | `boolean` | Filter by granted status. If `true`, only granted benefits will be returned. If `false`, only revoked benefits will be returned. | | `--page` | `integer` | Page number, defaults to 1. | | `--limit` | `integer` | Size of a page, defaults to 10. Maximum is 100. | | `--sorting` | `choice` | Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. (choices: created_at, -created_at, granted_at, -granted_at, revoked_at, -revoked_at) | # polar benefits Source: https://polar.sh/docs/integrate/cli/reference/benefits ```bash theme={null} polar benefits [flags] ``` **Subcommands** * [`polar benefits create`](#polar-benefits-create) Create a benefit, for example license keys, file downloads or Discord access. * [`polar benefits delete`](#polar-benefits-delete) Delete a benefit. * [`polar benefits files`](#polar-benefits-files) List the downloadable files for a benefit with their download statistics. * [`polar benefits get`](#polar-benefits-get) Get a benefit by ID. * [`polar benefits grants`](#polar-benefits-grants) List the individual grants for a benefit. * [`polar benefits list`](#polar-benefits-list) List benefits. * [`polar benefits update`](#polar-benefits-update) Update a benefit. ## polar benefits create Create a benefit, for example license keys, file downloads or Discord access. ```bash theme={null} polar benefits create [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--metadata` | `string` | Key-value object allowing you to store additional information. JSON: \{"\": string \| integer \| number \| boolean} | | `--type` | `choice` | Required. type (choices: custom, discord, github_repository, downloadables, license_keys, meter_credit, feature_flag, slack_shared_channel) | | `--description` | `string` | Required. The description of the benefit. Will be displayed on products having this benefit. | | `--organization-id`, `--org` | `string` | The ID of the organization owning the benefit. Defaults to the active organization. | | `--visibility` | `choice` | The visibility of the benefit in the customer portal. (choices: draft, private, public) | | `--properties` | `string` | Required. properties JSON: \{...} \| \{"guild_id": string, "role_id": string, "kick_member": boolean} \| \{"repository_owner": string, "repository_name": string, "permission": "pull" \| "triage" \| "push" \| "maintain" \| "admin"} \| \{"files": array of string, ...} \| \{"units": integer, "rollover": boolean, "meter_id": string} \| \{} \| \{"slack_integration_id": string, "channel_name_template": string, ...} | ## polar benefits delete Delete a benefit. ```bash theme={null} polar benefits delete [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--confirm`, `-c` | `boolean` | Skip the confirmation prompt for destructive requests | ## polar benefits files List the downloadable files for a benefit with their download statistics. ```bash theme={null} polar benefits files [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--page` | `integer` | Page number, defaults to 1. | | `--limit` | `integer` | Size of a page, defaults to 10. Maximum is 100. | ## polar benefits get Get a benefit by ID. ```bash theme={null} polar benefits get [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar benefits grants List the individual grants for a benefit. ```bash theme={null} polar benefits grants [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--is-granted` | `boolean` | Filter by granted status. If `true`, only granted benefits will be returned. If `false`, only revoked benefits will be returned. | | `--customer-id` | `string` | Filter by customer. | | `--member-id` | `string` | Filter by member. | | `--page` | `integer` | Page number, defaults to 1. | | `--limit` | `integer` | Size of a page, defaults to 10. Maximum is 100. | ## polar benefits list List benefits. ```bash theme={null} polar benefits list [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--organization-id`, `--org` | `string` | Filter by organization ID. Defaults to the active organization. | | `--type` | `choice` | Filter by benefit type. (choices: custom, discord, github_repository, downloadables, license_keys, meter_credit, feature_flag, slack_shared_channel) | | `--id` | `string` | Filter by benefit IDs. | | `--exclude-id` | `string` | Exclude benefits with these IDs. | | `--query` | `string` | Filter by description. | | `--page` | `integer` | Page number, defaults to 1. | | `--limit` | `integer` | Size of a page, defaults to 10. Maximum is 100. | | `--sorting` | `choice` | Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. (choices: created_at, -created_at, description, -description, type, -type, user_order, -user_order) | | `--metadata` | `string` | Filter by metadata key-value pairs. JSON: \{"\": string \| integer \| boolean \| array of string \| array of integer \| array of boolean} | ## polar benefits update Update a benefit. ```bash theme={null} polar benefits update [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--confirm`, `-c` | `boolean` | Skip the confirmation prompt for destructive requests | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--metadata` | `string` | Key-value object allowing you to store additional information. JSON: \{"\": string \| integer \| number \| boolean} | | `--description` | `string` | The description of the benefit. Will be displayed on products having this benefit. | | `--visibility` | `choice` | The visibility of the benefit in the customer portal. (choices: draft, private, public) | | `--type` | `choice` | Required. type (choices: custom, discord, github_repository, downloadables, license_keys, meter_credit, feature_flag, slack_shared_channel) | | `--properties` | `string` | properties JSON: \{"note": string \| null} \| \{"guild_id": string, "role_id": string, "kick_member": boolean} \| \{"repository_owner": string, "repository_name": string, "permission": "pull" \| "triage" \| "push" \| "maintain" \| "admin"} \| \{"files": array of string, ...} \| \{...} \| \{"units": integer, "rollover": boolean, "meter_id": string} \| \{} \| \{"slack_integration_id": string, "channel_name_template": string, ...} | # polar checkout_links Source: https://polar.sh/docs/integrate/cli/reference/checkout_links ```bash theme={null} polar checkout_links [flags] ``` **Subcommands** * [`polar checkout_links create`](#polar-checkout_links-create) Create a checkout link. * [`polar checkout_links delete`](#polar-checkout_links-delete) Delete a checkout link. * [`polar checkout_links get`](#polar-checkout_links-get) Get a checkout link by ID. * [`polar checkout_links list`](#polar-checkout_links-list) List checkout links. * [`polar checkout_links update`](#polar-checkout_links-update) Update a checkout link. ## polar checkout_links create Create a checkout link. ```bash theme={null} polar checkout_links create [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--metadata` | `string` | Key-value object allowing you to store additional information. JSON: \{"\": string \| integer \| number \| boolean} | | `--trial-interval` | `choice` | The interval unit for the trial period. (choices: day, week, month, year) | | `--trial-interval-count` | `integer` | The number of interval units for the trial period. | | `--payment-processor` | `choice` | Required. Payment processor to use. Currently only Stripe is supported. (choices: stripe) | | `--label` | `string` | Optional label to distinguish links internally | | `--allow-discount-codes` | `boolean` | Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it. | | `--require-billing-address` | `boolean` | Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting. | | `--discount-id` | `string` | ID of the discount to apply to the checkout. If the discount is not applicable anymore when opening the checkout link, it'll be ignored. | | `--seats` | `integer` | Preconfigured number of seats for seat-based pricing. When set, checkout sessions created from this link are locked to this number of seats and the customer won't be able to change it. All products on the link must use seat-based pricing and allow this number of seats. If the products no longer accommodate this value when the link is opened, it'll be ignored. | | `--units` | `integer` | Preconfigured number of units for unit-based pricing. When set, checkout sessions created from this link are locked to this number of units and the customer won't be able to change it. All products on the link must use unit-based pricing and allow this number of units. If the products no longer accommodate this value when the link is opened, it'll be ignored. | | `--success-url` | `string` | URL where the customer will be redirected after a successful payment.You can add the `checkout_id={CHECKOUT_ID}` query parameter to retrieve the checkout session id. | | `--return-url` | `string` | When set, a back button will be shown in the checkout to return to this URL. | | `--product-price-id` | `string` | product_price_id | | `--product-id` | `string` | product_id | | `--products` | `string` | List of products that will be available to select at checkout. | ## polar checkout_links delete Delete a checkout link. ```bash theme={null} polar checkout_links delete [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--confirm`, `-c` | `boolean` | Skip the confirmation prompt for destructive requests | ## polar checkout_links get Get a checkout link by ID. ```bash theme={null} polar checkout_links get [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar checkout_links list List checkout links. ```bash theme={null} polar checkout_links list [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--organization-id`, `--org` | `string` | Filter by organization ID. Defaults to the active organization. | | `--product-id` | `string` | Filter by product ID. | | `--page` | `integer` | Page number, defaults to 1. | | `--limit` | `integer` | Size of a page, defaults to 10. Maximum is 100. | | `--sorting` | `choice` | Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. (choices: created_at, -created_at, label, -label, success_url, -success_url, allow_discount_codes, -allow_discount_codes) | ## polar checkout_links update Update a checkout link. ```bash theme={null} polar checkout_links update [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--trial-interval` | `choice` | The interval unit for the trial period. (choices: day, week, month, year) | | `--trial-interval-count` | `integer` | The number of interval units for the trial period. | | `--metadata` | `string` | Key-value object allowing you to store additional information. JSON: \{"\": string \| integer \| number \| boolean} | | `--products` | `string` | List of products that will be available to select at checkout. | | `--label` | `string` | label | | `--allow-discount-codes` | `boolean` | Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it. | | `--require-billing-address` | `boolean` | Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting. | | `--discount-id` | `string` | ID of the discount to apply to the checkout. If the discount is not applicable anymore when opening the checkout link, it'll be ignored. | | `--seats` | `integer` | Preconfigured number of seats for seat-based pricing. When set, checkout sessions created from this link are locked to this number of seats and the customer won't be able to change it. All products on the link must use seat-based pricing and allow this number of seats. If the products no longer accommodate this value when the link is opened, it'll be ignored. | | `--units` | `integer` | Preconfigured number of units for unit-based pricing. When set, checkout sessions created from this link are locked to this number of units and the customer won't be able to change it. All products on the link must use unit-based pricing and allow this number of units. If the products no longer accommodate this value when the link is opened, it'll be ignored. | | `--success-url` | `string` | URL where the customer will be redirected after a successful payment.You can add the `checkout_id={CHECKOUT_ID}` query parameter to retrieve the checkout session id. | | `--return-url` | `string` | When set, a back button will be shown in the checkout to return to this URL. | # polar checkouts Source: https://polar.sh/docs/integrate/cli/reference/checkouts ```bash theme={null} polar checkouts [flags] ``` **Subcommands** * [`polar checkouts get`](#polar-checkouts-get) Get a checkout session by ID. * [`polar checkouts list`](#polar-checkouts-list) List checkout sessions. ## polar checkouts get Get a checkout session by ID. ```bash theme={null} polar checkouts get [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar checkouts list List checkout sessions. ```bash theme={null} polar checkouts list [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--organization-id`, `--org` | `string` | Filter by organization ID. Defaults to the active organization. | | `--product-id` | `string` | Filter by product ID. | | `--customer-id` | `string` | Filter by customer ID. | | `--external-customer-id` | `string` | Filter by customer external ID. | | `--status` | `choice` | Filter by checkout session status. (choices: open, expired, confirmed, succeeded, failed) | | `--query` | `string` | Filter by customer email. | | `--page` | `integer` | Page number, defaults to 1. | | `--limit` | `integer` | Size of a page, defaults to 10. Maximum is 100. | | `--sorting` | `choice` | Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. (choices: created_at, -created_at, expires_at, -expires_at, status, -status) | # polar custom_fields Source: https://polar.sh/docs/integrate/cli/reference/custom_fields ```bash theme={null} polar custom_fields [flags] ``` **Subcommands** * [`polar custom_fields create`](#polar-custom_fields-create) Create a custom field. * [`polar custom_fields delete`](#polar-custom_fields-delete) Delete a custom field. * [`polar custom_fields get`](#polar-custom_fields-get) Get a custom field by ID. * [`polar custom_fields list`](#polar-custom_fields-list) List custom fields. * [`polar custom_fields update`](#polar-custom_fields-update) Update a custom field. ## polar custom_fields create Create a custom field. ```bash theme={null} polar custom_fields create [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--metadata` | `string` | Key-value object allowing you to store additional information. JSON: \{"\": string \| integer \| number \| boolean} | | `--type` | `choice` | Required. type (choices: text, number, date, checkbox, select) | | `--slug` | `string` | Required. Identifier of the custom field. It'll be used as key when storing the value. Must be unique across the organization.It can only contain ASCII letters, numbers and hyphens. | | `--name` | `string` | Required. Name of the custom field. | | `--organization-id`, `--org` | `string` | The ID of the organization owning the custom field. Defaults to the active organization. | | `--properties` | `string` | Required. properties JSON: \{...} \| \{"options": array of \{"value": string, "label": string}, ...} | ## polar custom_fields delete Delete a custom field. ```bash theme={null} polar custom_fields delete [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--confirm`, `-c` | `boolean` | Skip the confirmation prompt for destructive requests | ## polar custom_fields get Get a custom field by ID. ```bash theme={null} polar custom_fields get [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar custom_fields list List custom fields. ```bash theme={null} polar custom_fields list [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--organization-id`, `--org` | `string` | Filter by organization ID. Defaults to the active organization. | | `--query` | `string` | Filter by custom field name or slug. | | `--type` | `choice` | Filter by custom field type. (choices: text, number, date, checkbox, select) | | `--page` | `integer` | Page number, defaults to 1. | | `--limit` | `integer` | Size of a page, defaults to 10. Maximum is 100. | | `--sorting` | `choice` | Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. (choices: created_at, -created_at, slug, -slug, name, -name, type, -type) | ## polar custom_fields update Update a custom field. ```bash theme={null} polar custom_fields update [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--metadata` | `string` | Key-value object allowing you to store additional information. JSON: \{"\": string \| integer \| number \| boolean} | | `--name` | `string` | name | | `--slug` | `string` | slug | | `--type` | `choice` | Required. type (choices: text, number, date, checkbox, select) | | `--properties` | `string` | properties JSON: \{...} \| \{"options": array of \{"value": string, "label": string}, ...} | # polar customer_meters Source: https://polar.sh/docs/integrate/cli/reference/customer_meters ```bash theme={null} polar customer_meters [flags] ``` **Subcommands** * [`polar customer_meters credits`](#polar-customer_meters-credits) Manually grant credits on a customer meter. (preview, API 2027-01) * [`polar customer_meters get`](#polar-customer_meters-get) Get a customer meter by ID. * [`polar customer_meters list`](#polar-customer_meters-list) List customer meters. ## polar customer_meters credits Manually grant credits on a customer meter. (preview, API 2027-01) ```bash theme={null} polar customer_meters credits [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--confirm`, `-c` | `boolean` | Skip the confirmation prompt for destructive requests | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--units` | `integer` | Required. The number of units to credit. | | `--rollover` | `boolean` | Whether unused credits carry over to the next meter period. | | `--external-id` | `string` | Your unique identifier for this credit. Retrying with the same `external_id` doesn't grant the credit twice. | | `--customer-id` | `string` | The ID of the customer. | | `--meter-id` | `string` | The ID of the meter. | | `--external-customer-id` | `string` | The external ID of the customer. | | `--external-meter-id` | `string` | The external ID of the meter, as set by config as code. | ## polar customer_meters get Get a customer meter by ID. ```bash theme={null} polar customer_meters get [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar customer_meters list List customer meters. ```bash theme={null} polar customer_meters list [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--organization-id`, `--org` | `string` | Filter by organization ID. Defaults to the active organization. | | `--customer-id` | `string` | Filter by customer ID. | | `--external-customer-id` | `string` | Filter by external customer ID. | | `--meter-id` | `string` | Filter by meter ID. | | `--page` | `integer` | Page number, defaults to 1. | | `--limit` | `integer` | Size of a page, defaults to 10. Maximum is 100. | | `--sorting` | `choice` | Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. (choices: created_at, -created_at, modified_at, -modified_at, customer_id, -customer_id, customer_name, -customer_name, meter_id, -meter_id, meter_name, -meter_name, consumed_units, -consumed_units, credited_units, -credited_units, balance, -balance) | # polar customer_seats Source: https://polar.sh/docs/integrate/cli/reference/customer_seats ```bash theme={null} polar customer_seats [flags] ``` **Subcommands** * [`polar customer_seats assign_seat`](#polar-customer_seats-assign_seat) Assign a seat for a subscription or order. * [`polar customer_seats claim_seat`](#polar-customer_seats-claim_seat) Claim a customer seat with an invitation token. * [`polar customer_seats get_claim_info`](#polar-customer_seats-get_claim_info) Get claim information for a customer seat invitation. * [`polar customer_seats list_seats`](#polar-customer_seats-list_seats) List seats for a subscription or order. * [`polar customer_seats resend_invitation`](#polar-customer_seats-resend_invitation) Resend an invitation for a pending customer seat. * [`polar customer_seats revoke_seat`](#polar-customer_seats-revoke_seat) Revoke a customer seat. ## polar customer_seats assign_seat Assign a seat for a subscription or order. ```bash theme={null} polar customer_seats assign_seat [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--subscription-id` | `string` | Subscription ID. Required if neither order_id nor checkout_id is provided. | | `--order-id` | `string` | Order ID for one-time purchases. Required if subscription_id is not provided. | | `--email` | `string` | Email of the customer to assign the seat to | | `--external-customer-id` | `string` | External customer ID for the seat assignment | | `--customer-id` | `string` | Customer ID for the seat assignment | | `--external-member-id` | `string` | External member ID for the seat assignment. Can be used alone (lookup existing member) or with email (create/validate member). | | `--member-id` | `string` | Member ID for the seat assignment. | | `--metadata` | `string` | Additional metadata for the seat (max 10 keys, 1KB total) JSON: \{"\": any} | | `--immediate-claim` | `boolean` | If true, the seat will be immediately claimed without sending an invitation email. API-only feature. | ## polar customer_seats claim_seat Claim a customer seat with an invitation token. ```bash theme={null} polar customer_seats claim_seat [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--environment` | `choice` | Environment for this unauthenticated request (choices: production, sandbox) | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--invitation-token` | `string` | Required. Invitation token to claim the seat | ## polar customer_seats get_claim_info Get claim information for a customer seat invitation. ```bash theme={null} polar customer_seats get_claim_info [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `invitation_token` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--environment` | `choice` | Environment for this unauthenticated request (choices: production, sandbox) | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar customer_seats list_seats List seats for a subscription or order. ```bash theme={null} polar customer_seats list_seats [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--subscription-id` | `string` | subscription_id | | `--order-id` | `string` | order_id | ## polar customer_seats resend_invitation Resend an invitation for a pending customer seat. ```bash theme={null} polar customer_seats resend_invitation [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `seat_id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar customer_seats revoke_seat Revoke a customer seat. ```bash theme={null} polar customer_seats revoke_seat [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `seat_id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--confirm`, `-c` | `boolean` | Skip the confirmation prompt for destructive requests | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | # polar customers Source: https://polar.sh/docs/integrate/cli/reference/customers ```bash theme={null} polar customers [flags] ``` **Subcommands** * [`polar customers create`](#polar-customers-create) Create a customer. * [`polar customers delete`](#polar-customers-delete) Delete a customer. * [`polar customers delete_external`](#polar-customers-delete_external) Delete a customer by external ID. * [`polar customers get`](#polar-customers-get) Get a customer by ID. * [`polar customers get_external`](#polar-customers-get_external) Get a customer by external ID. * [`polar customers get_state`](#polar-customers-get_state) Get a customer state by ID. * [`polar customers get_state_external`](#polar-customers-get_state_external) Get a customer state by external ID. * [`polar customers list`](#polar-customers-list) List customers. * [`polar customers list_payment_methods`](#polar-customers-list_payment_methods) Get saved payment methods of a customer. * [`polar customers list_payment_methods_external`](#polar-customers-list_payment_methods_external) Get saved payment methods of a customer by external ID. * [`polar customers update`](#polar-customers-update) Update a customer. * [`polar customers update_external`](#polar-customers-update_external) Update a customer by external ID. * [`polar customers members`](#polar-customers-members) ## polar customers create Create a customer. ```bash theme={null} polar customers create [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--metadata` | `string` | Key-value object allowing you to store additional information. JSON: \{"\": string \| integer \| number \| boolean} | | `--external-id` | `string` | The ID of the customer in your system. This must be unique within the organization. Once set, it can't be updated. | | `--name` | `string` | name | | `--billing-address` | `string` | billing_address JSON: \{"country": "AD" \| "AE" \| "AF" \| "AG" \| "AI" \| ..., ...} | | `--tax-id` | `string` | tax_id | | `--locale` | `string` | locale | | `--organization-id`, `--org` | `string` | The ID of the organization owning the customer. Defaults to the active organization. | | `--owner` | `string` | Optional owner member to create with the customer. If not provided, an owner member will be automatically created using the customer's email and name. JSON: \{"email": string, ...} | | `--type` | `choice` | type (choices: individual, team) | | `--email` | `string` | The email address of the customer. This must be unique within the organization. The email address of the team customer. Optional for team customers — if omitted, an owner with an email must be provided. | ## polar customers delete Delete a customer. ```bash theme={null} polar customers delete [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--confirm`, `-c` | `boolean` | Skip the confirmation prompt for destructive requests | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--anonymize` | `boolean` | If true, also anonymize the customer's personal data for GDPR compliance. This replaces email with a hashed version, hashes name and billing name (name preserved for businesses with tax_id), clears billing address, and removes OAuth account data. | ## polar customers delete_external Delete a customer by external ID. ```bash theme={null} polar customers delete_external [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `external_id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--confirm`, `-c` | `boolean` | Skip the confirmation prompt for destructive requests | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--anonymize` | `boolean` | If true, also anonymize the customer's personal data for GDPR compliance. | ## polar customers get Get a customer by ID. ```bash theme={null} polar customers get [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar customers get_external Get a customer by external ID. ```bash theme={null} polar customers get_external [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `external_id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar customers get_state Get a customer state by ID. ```bash theme={null} polar customers get_state [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar customers get_state_external Get a customer state by external ID. ```bash theme={null} polar customers get_state_external [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `external_id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar customers list List customers. ```bash theme={null} polar customers list [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--organization-id`, `--org` | `string` | Filter by organization ID. Defaults to the active organization. | | `--email` | `string` | Filter by exact email. | | `--query` | `string` | Filter by name, email, or external ID. | | `--active` | `boolean` | Filter by active customers, i.e. customers with at least one trialing, active or past_due subscription. | | `--page` | `integer` | Page number, defaults to 1. | | `--limit` | `integer` | Size of a page, defaults to 10. Maximum is 100. | | `--sorting` | `choice` | Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. (choices: created_at, -created_at, email, -email, name, -name) | | `--metadata` | `string` | Filter by metadata key-value pairs. JSON: \{"\": string \| integer \| boolean \| array of string \| array of integer \| array of boolean} | ## polar customers list_payment_methods Get saved payment methods of a customer. ```bash theme={null} polar customers list_payment_methods [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--page` | `integer` | Page number, defaults to 1. | | `--limit` | `integer` | Size of a page, defaults to 10. Maximum is 100. | ## polar customers list_payment_methods_external Get saved payment methods of a customer by external ID. ```bash theme={null} polar customers list_payment_methods_external [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `external_id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--page` | `integer` | Page number, defaults to 1. | | `--limit` | `integer` | Size of a page, defaults to 10. Maximum is 100. | ## polar customers update Update a customer. ```bash theme={null} polar customers update [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--confirm`, `-c` | `boolean` | Skip the confirmation prompt for destructive requests | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--metadata` | `string` | Key-value object allowing you to store additional information. JSON: \{"\": string \| integer \| number \| boolean} | | `--email` | `string` | The email address of the customer. This must be unique within the organization. | | `--name` | `string` | name | | `--billing-address` | `string` | billing_address JSON: \{"country": "AD" \| "AE" \| "AF" \| "AG" \| "AI" \| ..., ...} | | `--tax-id` | `string` | tax_id | | `--locale` | `string` | locale | | `--external-id` | `string` | The ID of the customer in your system. This must be unique within the organization. Once set, it can't be updated. | | `--type` | `choice` | The customer type. Can only be upgraded from 'individual' to 'team', never downgraded. (choices: individual, team) | ## polar customers update_external Update a customer by external ID. ```bash theme={null} polar customers update_external [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `external_id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--confirm`, `-c` | `boolean` | Skip the confirmation prompt for destructive requests | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--metadata` | `string` | Key-value object allowing you to store additional information. JSON: \{"\": string \| integer \| number \| boolean} | | `--email` | `string` | The email address of the customer. This must be unique within the organization. | | `--name` | `string` | name | | `--billing-address` | `string` | billing_address JSON: \{"country": "AD" \| "AE" \| "AF" \| "AG" \| "AI" \| ..., ...} | | `--tax-id` | `string` | tax_id | | `--locale` | `string` | locale | ## polar customers members ```bash theme={null} polar customers members [flags] ``` **Subcommands** * [`polar customers members create`](#polar-customers-members-create) Create a new member for a customer. * [`polar customers members create_external`](#polar-customers-members-create_external) Create a new member for a customer identified by its external ID. * [`polar customers members delete`](#polar-customers-members-delete) Delete a member of a customer. * [`polar customers members delete_external`](#polar-customers-members-delete_external) Delete a member by external ID for a customer identified by its external ID. * [`polar customers members get`](#polar-customers-members-get) Get a member of a customer by its ID. * [`polar customers members get_external`](#polar-customers-members-get_external) Get a member by external ID for a customer identified by its external ID. * [`polar customers members list`](#polar-customers-members-list) List the members of a customer. * [`polar customers members list_external`](#polar-customers-members-list_external) List the members of a customer identified by its external ID. * [`polar customers members update`](#polar-customers-members-update) Update a member of a customer. * [`polar customers members update_external`](#polar-customers-members-update_external) Update a member by external ID for a customer identified by its external ID. ## polar customers members create Create a new member for a customer. ```bash theme={null} polar customers members create [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--email` | `string` | Required. The email address of the member. | | `--name` | `string` | name | | `--external-id` | `string` | The ID of the member in your system. This must be unique within the customer. | | `--role` | `choice` | The role of the member within the customer. To assign or transfer ownership, use the member update endpoint. (choices: member, billing_manager) | ## polar customers members create_external Create a new member for a customer identified by its external ID. ```bash theme={null} polar customers members create_external [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `external_id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--email` | `string` | Required. The email address of the member. | | `--name` | `string` | name | | `--external-id` | `string` | The ID of the member in your system. This must be unique within the customer. | | `--role` | `choice` | The role of the member within the customer. To assign or transfer ownership, use the member update endpoint. (choices: member, billing_manager) | ## polar customers members delete Delete a member of a customer. ```bash theme={null} polar customers members delete [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | | `member_id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--confirm`, `-c` | `boolean` | Skip the confirmation prompt for destructive requests | ## polar customers members delete_external Delete a member by external ID for a customer identified by its external ID. ```bash theme={null} polar customers members delete_external [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `external_id` | `string` | | | `member_external_id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--confirm`, `-c` | `boolean` | Skip the confirmation prompt for destructive requests | ## polar customers members get Get a member of a customer by its ID. ```bash theme={null} polar customers members get [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | | `member_id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar customers members get_external Get a member by external ID for a customer identified by its external ID. ```bash theme={null} polar customers members get_external [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `external_id` | `string` | | | `member_external_id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar customers members list List the members of a customer. ```bash theme={null} polar customers members list [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--role` | `choice` | Filter by member role. (choices: owner, billing_manager, member) | | `--page` | `integer` | Page number, defaults to 1. | | `--limit` | `integer` | Size of a page, defaults to 10. Maximum is 100. | | `--sorting` | `choice` | Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. (choices: created_at, -created_at) | ## polar customers members list_external List the members of a customer identified by its external ID. ```bash theme={null} polar customers members list_external [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `external_id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--role` | `choice` | Filter by member role. (choices: owner, billing_manager, member) | | `--page` | `integer` | Page number, defaults to 1. | | `--limit` | `integer` | Size of a page, defaults to 10. Maximum is 100. | | `--sorting` | `choice` | Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. (choices: created_at, -created_at) | ## polar customers members update Update a member of a customer. ```bash theme={null} polar customers members update [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | | `member_id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--confirm`, `-c` | `boolean` | Skip the confirmation prompt for destructive requests | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--name` | `string` | name | | `--email` | `string` | email | | `--role` | `choice` | The role of the member within the customer. (choices: owner, billing_manager, member) | ## polar customers members update_external Update a member by external ID for a customer identified by its external ID. ```bash theme={null} polar customers members update_external [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `external_id` | `string` | | | `member_external_id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--confirm`, `-c` | `boolean` | Skip the confirmation prompt for destructive requests | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--name` | `string` | name | | `--email` | `string` | email | | `--role` | `choice` | The role of the member within the customer. (choices: owner, billing_manager, member) | # polar update Source: https://polar.sh/docs/integrate/cli/reference/update Update the CLI to the latest release ```bash theme={null} polar update [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--method` | `choice` | How the CLI was installed: binary (install.sh), npm, pnpm, bun, yarn or vp (Vite+). Detected when omitted (choices: binary, npm, pnpm, bun, yarn, vp) | **Examples** Update to the latest version of the CLI ```bash theme={null} polar update ``` Update through npm instead of the detected install method ```bash theme={null} polar update --method npm ``` # polar webhook Source: https://polar.sh/docs/integrate/cli/reference/webhook Test webhooks against your local server ```bash theme={null} polar webhook [flags] ``` **Subcommands** * [`polar webhook listen`](#polar-webhook-listen) Forward webhook events for an organization to a local URL * [`polar webhook trigger`](#polar-webhook-trigger) Send a sample webhook event to your local server ## polar webhook listen Forward webhook events for an organization to a local URL ```bash theme={null} polar webhook listen [flags] [] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `url` | `string` | Where to forward webhook events: a port like 3000, or a URL like [http://localhost:3000/api/webhooks](http://localhost:3000/api/webhooks) (optional) | **Flags** | Flag | Type | Description | | - | - | - | | `--org` | `string` | Organization ID or slug for this invocation only | | `--print-secret` | `boolean` | Print the secret that signs forwarded events, then exit | **Examples** Forward events to [http://localhost:3000](http://localhost:3000) ```bash theme={null} polar webhook listen 3000 ``` Forward events to a route on your local server ```bash theme={null} polar webhook listen 3000/api/webhooks ``` Forward events for a specific organization ```bash theme={null} polar webhook listen http://localhost:3000/api/webhooks --org ``` Print the signing secret, e.g. for POLAR_WEBHOOK_SECRET in .env ```bash theme={null} polar webhook listen --print-secret ``` ## polar webhook trigger Send a sample webhook event to your local server ```bash theme={null} polar webhook trigger [flags] [] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `event` | `string` | Webhook event to send, e.g. order.created. Omit to pick from a list (optional) | **Flags** | Flag | Type | Description | | - | - | - | | `--org` | `string` | Organization ID or slug for this invocation only | | `--override` | `string` | Override a payload field, as path=value. Values are sent as text; use null, a JSON object, array or quoted string for other types. Repeatable | | `--seed` | `integer` | Seed for generated IDs, for a reproducible payload | | `--dry-run` | `boolean` | Print the payload that would be sent, without sending it | | `--list` | `boolean` | List every event you can trigger, with descriptions | **Examples** Pick an event from a list ```bash theme={null} polar webhook trigger ``` Send a sample order.paid event ```bash theme={null} polar webhook trigger order.paid ``` Change a field in the payload ```bash theme={null} polar webhook trigger order.paid --override data.customer.email=jane@example.com ``` Generate the same IDs every time ```bash theme={null} polar webhook trigger order.paid --seed 7 ``` Print the payload instead of sending it ```bash theme={null} polar webhook trigger order.paid --dry-run ``` # Webhooks on your machine Source: https://polar.sh/docs/integrate/cli/webhooks Receive real webhook events locally and trigger sample events on demand Polar delivers webhooks to public URLs, which your local server does not have. The CLI bridges that gap: `polar webhook listen` streams your organization's webhook events to a local URL, and `polar webhook trigger` sends realistic sample events whenever you need one, without waiting for a real checkout or subscription. ## Receive webhooks locally **1. Sign in and choose an organization** ```bash Terminal theme={null} polar auth login --sandbox ``` Pick the organization you want to receive events for. See [Authentication](/docs/integrate/cli/authentication) for details. **2. Start listening** Point the CLI at the URL your webhook handler listens on: ```bash Terminal theme={null} polar webhook listen http://localhost:3000/api/webhooks ``` ```text theme={null} ● Connected Acme Forwarding http://localhost:3000/api/webhooks Secret 6t3c8ce2247c493a3ade20uea4484d64 use this to verify signatures locally Waiting for events... press Ctrl+C to stop ``` **3. Set the webhook secret** Events are signed with the secret shown in the banner, exactly like production deliveries. Configure your handler with it so signature verification passes: ```bash .env theme={null} POLAR_WEBHOOK_SECRET=6t3c8ce2247c493a3ade20uea4484d64 ``` Every webhook event for the organization is now forwarded to your URL with the same headers and body a public endpoint would receive, and each delivery is logged with its status code and duration. The connection reconnects on its own if it drops. Press `Ctrl+C` to stop. > [!NOTE] > > Events follow the active organization's environment. Listen with a sandbox > organization while developing, and switch with `polar auth org` when you need > production events. ## Trigger sample events With `polar webhook listen` running in one terminal, send a sample event from another: ```bash Terminal theme={null} polar webhook trigger order.created ``` The CLI generates a realistic payload for the event, delivers it through your `listen` session, and reports where it went. Nothing is created in your organization. Run it without an event name to pick one from a list, or print the catalog: ```bash Terminal theme={null} polar webhook trigger --list ``` ### Shape the payload Override any field with `path=value`, repeating the flag as needed. Values are sent as text unless you pass `null`, a JSON object, an array or a quoted string: ```bash Terminal theme={null} polar webhook trigger order.created \ --override data.customer.email=jane@example.com \ --override data.net_amount=4900 ``` Generated IDs and values are random on every run. Pass any integer as `--seed` to make them deterministic, so the same seed always produces the same payload, which is handy for scripted tests: ```bash Terminal theme={null} polar webhook trigger subscription.active --seed 42 ``` ### Inspect without sending Print the payload instead of delivering it: ```bash Terminal theme={null} polar webhook trigger checkout.created --dry-run ``` ## Next steps * [Webhook events](/docs/integrate/webhooks/events) documents every event and its payload. * [Delivery](/docs/integrate/webhooks/delivery) explains signatures, retries and timeouts for production endpoints. # Customer State Source: https://polar.sh/docs/integrate/customer-state The quickest way to integrate billing in your application Customer State is a concept allowing you to query for the current state of a customer, including their active subscriptions and granted [benefits](/docs/features/benefits/introduction), in a single [API call](/docs/api-reference/current/customers/get-customer-state-by-external-id) or single [webhook event](/docs/api-reference/current/customer_state_changed). Combined with the [External ID](/docs/features/customer-management#external-id) feature, you can get up-and-running in minutes. ## The customer state object The customer state object contains: * All the data about the customer. * The list of their **active** subscriptions. * The list of their **granted** benefits. * The list of their **active** meters, with their current balance. Thus, with that single object, you have all the required information to check if you should provision access to your service or not. > [card] [Get Customer State by External ID](/docs/api-reference/current/customers/get-customer-state-by-external-id) > > One endpoint to rule them all, using your own customer ID. > [card] [Get Customer State](/docs/api-reference/current/customers/get-customer-state) > > The same one, but with internal Polar customer ID. ## The `customer.state_changed` webhook To be notified of the customer state changes, you can listen to the `customer.state_changed` webhook event. It's triggered when: * Customer is created, updated or deleted. * A subscription is created or updated. * A benefit is granted or revoked. By subscribing to this webhook event, you keep your system up-to-date and update your customer's access accordingly. > [card] [customer.state_changed](/docs/api-reference/current/customer_state_changed) > > One webhook to rule them all. # Model Context Protocol (MCP) Source: https://polar.sh/docs/integrate/mcp Connect AI agents to Polar to manage products, customers, subscriptions, orders, and more. Use Polar's remote Model Context Protocol (MCP) server to give AI agents secure access to your Polar organization. Agents can look up data and take actions across your products, customers, subscriptions, orders, benefits, and more. > [!NOTE] > > Polar MCP uses OAuth. When you connect a client, your browser opens so you can sign in and authorize access to your organization. You never need to copy an API key into your agent. ## Set up with the Polar CLI The recommended way to connect your agent: the [Polar CLI](/docs/integrate/cli/introduction) detects Claude Code, Codex and Cursor and sets each one up for you. Claude Code and Codex get the [Polar plugin](https://github.com/polarsource/agent-toolkit), which bundles the MCP servers and skills. Run it again with `--force` to update them. ```bash Terminal theme={null} curl -fsSL https://polar.sh/install.sh | bash polar agent setup ``` Run `polar agent setup --status` to see what is set up. For other agents, `polar agent setup --skills project` installs the Polar skills into `.agents/skills`; then connect the MCP server as described below. ## Connect your agent To connect a client yourself, use the production server at `https://mcp.polar.sh/mcp/polar-mcp` for your live organization. While building or testing, use the sandbox server at `https://mcp.polar.sh/mcp/polar-sandbox` and give it a distinct name such as `polar-sandbox`. Choose your client and add the appropriate server. > [tab] Cursor > > Add the following to `.cursor/mcp.json` in your project, or to `~/.cursor/mcp.json` to make Polar available in every project: > > ```json theme={null} > { > "mcpServers": { > "polar": { > "url": "https://mcp.polar.sh/mcp/polar-mcp" > } > } > } > ``` > > Open Cursor's MCP settings and connect to `polar` to complete authorization. > [tab] Claude Code > > Run: > > ```bash theme={null} > claude mcp add --transport http polar https://mcp.polar.sh/mcp/polar-mcp > ``` > > Then open `/mcp` in Claude Code and authenticate `polar` with OAuth. > [tab] ChatGPT > > In ChatGPT, open **Settings** → **Connectors**, enable developer mode if prompted, and add a custom connector with: > > * **Name:** `Polar` > * **MCP server URL:** `https://mcp.polar.sh/mcp/polar-mcp` > > Save the connector, select **Connect**, and complete authorization in the browser. > [tab] Claude Desktop > > Open **Settings** → **Connectors**, select **Add custom connector**, and enter: > > * **Name:** `Polar` > * **MCP server URL:** `https://mcp.polar.sh/mcp/polar-mcp` > > Save the connector, select **Connect**, and complete authorization in the browser. > [tab] Codex > > Run: > > ```bash theme={null} > codex mcp add "polar" --url "https://mcp.polar.sh/mcp/polar-mcp" > ``` > > Complete the OAuth authorization when prompted. > [tab] OpenCode > > Run: > > ```bash theme={null} > opencode mcp add polar --url https://mcp.polar.sh/mcp/polar-mcp > ``` > > Complete the OAuth authorization when prompted. > [tab] Other clients > > If your client accepts a remote MCP URL, add: > > ```text theme={null} > https://mcp.polar.sh/mcp/polar-mcp > ``` > > If it only supports local commands, use the `mcp-remote` bridge: > > ```json theme={null} > { > "mcpServers": { > "polar": { > "command": "npx", > "args": [ > "mcp-remote", > "https://mcp.polar.sh/mcp/polar-mcp" > ] > } > } > } > ``` ## How the tools work Polar exposes more than a hundred API operations. Instead of sending every operation and its input schema to your agent at the start of every conversation, the server gives it a few tools and lets it write short JavaScript snippets to find and call what it needs: | Tool | What it does | | - | - | | `search` | Searches Polar's API specification for operations, parameters and response schemas. | | `execute` | Calls the Polar API with `polar.request`. The agent can chain calls, page through results and return only the fields it needs. | | `search_docs` | Searches the Polar documentation. | | `read_docs_page` | Reads a Polar documentation page as Markdown. | | `feedback` | Sends your agent's feedback about Polar, these tools or the docs to Polar. Available while telemetry is on. | **1. Search** The agent calls `search` to find the operations for its task, such as "find a customer and check their active subscriptions", and their exact inputs. **2. Execute** The agent calls `execute` with code that makes the API calls and returns the result. Code runs in an isolated sandbox. It can only call the Polar operations listed below, with the access you granted when you authorized the client, and it cannot reach any other host. ## Read-only mode For agents that should look up data but never change it, add `?readonly=true` to the server URL, for example `https://mcp.polar.sh/mcp/polar-mcp?readonly=true`. Only read operations are available, and the agent asks for read-only access when you authorize it. ## Telemetry The server sends one event per tool call to help us improve it, plus a second event carrying the feedback itself when your agent calls the `feedback` tool. Each tool-call event carries: * The tool name, whether the call succeeded, the error type and status code, and the duration. * Your agent's name and version, when its client reports them. * The API operations the call used (for example `GET /v1/products/{id}`) with their status codes, and the names of any fields the API rejected (for example `body.prices.0.price_amount`). * The size of the result. * For `search`, the JavaScript engine's error message when the agent's script fails. Search runs against the public API specification without network access, so the message cannot contain your data. * The `intent` your agent passes: one sentence on the goal of the call. * What your agent writes in the `feedback` tool. Events from the same account share an identifier, a keyed one-way hash of your user or organization ID, so we can see how a session unfolds. Never sent: the ID itself, access tokens, every other tool argument (including the code that `execute` runs), results, field values, request and response bodies, and IDs in URLs. `intent` and `feedback` are the only text your agent writes that the server sends. Every tool asks the agent to write them without customer names, emails or IDs, and before they are sent or logged the server redacts anything that looks like an identifier or a secret, such as emails, IDs, card numbers and API keys. Redaction matches shapes, not meaning, so a name written in plain words can still pass. If your agent handles data you don't want to share with us at all, opt out. To opt out, add `?telemetry=false` (or `0`, `no`, `off`) to the server URL, for example `https://mcp.polar.sh/mcp/polar-mcp?telemetry=false`. The server then ignores `intent`, which is neither sent nor written to its request logs, and removes the `feedback` tool. It combines with read-only mode: `?readonly=true&telemetry=false`. The server still keeps request logs to operate and secure the service, as the Polar API does. ## Available operations > [accordion] Available operations (103) > > | Operation | Description | > | - | - | > | `organizations_list` | List organizations. | > | `organizations_get` | Get an organization by ID. | > | `subscriptions_list` | List subscriptions. | > | `subscriptions_get` | Get a subscription by ID. | > | `subscriptions_update` | Update a subscription. | > | `subscriptions_revoke` | Revoke a subscription, i.e cancel immediately. | > | `benefits_list` | List benefits. | > | `benefits_create` | Create a benefit, for example license keys, file downloads or Discord access. | > | `benefits_get` | Get a benefit by ID. | > | `benefits_update` | Update a benefit. | > | `benefits_delete` | Delete a benefit. Every grants associated with the benefit will be revoked. Users will lose access to the benefit. | > | `benefits_files` | List the downloadable files for a benefit with their download statistics. | > | `benefits_grants` | List the individual grants for a benefit. It's especially useful to check if a user has been granted a benefit. | > | `benefit_grants_list` | List benefit grants across all benefits accessible to the authenticated subject. | > | `webhooks_list_webhook_endpoints` | List webhook endpoints. | > | `webhooks_create_webhook_endpoint` | Create a webhook endpoint. | > | `webhooks_get_webhook_endpoint` | Get a webhook endpoint by ID. | > | `webhooks_update_webhook_endpoint` | Update a webhook endpoint. | > | `webhooks_delete_webhook_endpoint` | Delete a webhook endpoint. | > | `webhooks_reset_webhook_endpoint_secret` | Regenerate a webhook endpoint secret. | > | `webhooks_list_webhook_deliveries` | List webhook deliveries. Deliveries are all the attempts to deliver a webhook event to an endpoint. | > | `webhooks_redeliver_webhook_event` | Schedule the re-delivery of a webhook event. | > | `products_list` | List products. | > | `products_create` | Create a product. | > | `products_get` | Get a product by ID. | > | `products_update` | Update a product. | > | `products_delete` | Delete a product. Only products without orders, subscriptions, trials or discounts can be deleted. Products that are in use can only be archived. | > | `products_update_benefits` | Update benefits granted by a product. | > | `orders_list` | List orders. | > | `orders_get` | Get an order by ID. | > | `orders_update` | Update an order. | > | `orders_invoice` | Get an order's invoice data. | > | `orders_generate_invoice` | Trigger generation of an order's invoice. | > | `orders_receipt` | Get a presigned URL to download an order's receipt PDF. | > | `refunds_list` | List refunds. | > | `refunds_create` | Create a refund. | > | `checkouts_list` | List checkout sessions. | > | `checkouts_get` | Get a checkout session by ID. | > | `files_list` | List files. | > | `files_delete` | Delete a file. | > | `metrics_get` | Get metrics about your orders and subscriptions. Currency values are output in cents. | > | `metrics_limits` | Get the interval limits for the metrics endpoint. | > | `license_keys_list` | Get license keys connected to the given organization & filters. | > | `license_keys_get` | Get a license key. | > | `license_keys_update` | Update a license key. | > | `license_keys_rotate` | Rotate a license key. Generates a new key string for the same license key record. The previous key string immediately stops validating. Status, usage, limits, expiry, and activations are preserved. | > | `license_keys_get_activation` | Get a license key activation. | > | `checkout_links_list` | List checkout links. | > | `checkout_links_create` | Create a checkout link. | > | `checkout_links_get` | Get a checkout link by ID. | > | `checkout_links_update` | Update a checkout link. | > | `checkout_links_delete` | Delete a checkout link. | > | `custom_fields_list` | List custom fields. | > | `custom_fields_create` | Create a custom field. | > | `custom_fields_get` | Get a custom field by ID. | > | `custom_fields_update` | Update a custom field. | > | `custom_fields_delete` | Delete a custom field. | > | `discounts_list` | List discounts. | > | `discounts_create` | Create a discount. | > | `discounts_get` | Get a discount by ID. | > | `discounts_update` | Update a discount. | > | `discounts_delete` | Delete a discount. | > | `customers_list` | List customers. | > | `customers_create` | Create a customer. Set `external_id` to the customer's ID in your system to look it up by that ID. | > | `customers_get` | Get a customer by ID. | > | `customers_update` | Update a customer. | > | `customers_delete` | Delete a customer. This action cannot be undone and will immediately: - Cancel any active subscriptions for the customer - Revoke all their benefits - Clear any `external_id` Use it only in the context of deleting a user within your own service. Otherwise, use more granular API endpoints to cancel a specific subscription or revoke certain benefits. Note: The customers information will nonetheless be retained for historic orders and subscriptions. Set `anonymize=true` to also anonymize PII for GDPR compliance. | > | `customers_get_external` | Get a customer by external ID. | > | `customers_update_external` | Update a customer by external ID. | > | `customers_delete_external` | Delete a customer by external ID. Immediately cancels any active subscriptions and revokes any active benefits. Set `anonymize=true` to also anonymize PII for GDPR compliance. | > | `customers_get_state` | Get a customer state by ID. The customer state includes information about the customer's active subscriptions and benefits. It's the ideal endpoint to use when you need to get a full overview of a customer's status. | > | `customers_get_state_external` | Get a customer state by external ID. The customer state includes information about the customer's active subscriptions and benefits. It's the ideal endpoint to use when you need to get a full overview of a customer's status. | > | `customers_list_payment_methods` | Get saved payment methods of a customer. | > | `customers_list_payment_methods_external` | Get saved payment methods of a customer by external ID. | > | `customers_members_list` | List the members of a customer. | > | `customers_members_create` | Create a new member for a customer. Only B2B customers with the member management feature enabled can add members. The authenticated user or organization must have access to the customer's organization. | > | `customers_members_list_external` | List the members of a customer identified by its external ID. | > | `customers_members_create_external` | Create a new member for a customer identified by its external ID. | > | `customers_members_get` | Get a member of a customer by its ID. | > | `customers_members_update` | Update a member of a customer. Only name, email and role can be updated. | > | `customers_members_delete` | Delete a member of a customer. | > | `customers_members_get_external` | Get a member by external ID for a customer identified by its external ID. | > | `customers_members_update_external` | Update a member by external ID for a customer identified by its external ID. | > | `customers_members_delete_external` | Delete a member by external ID for a customer identified by its external ID. | > | `customer_seats_list_seats` | List seats for a subscription or order. | > | `customer_seats_assign_seat` | Assign a seat for a subscription or order. | > | `customer_seats_revoke_seat` | Revoke a customer seat. | > | `customer_seats_resend_invitation` | Resend an invitation for a pending customer seat. | > | `customer_seats_get_claim_info` | Get claim information for a customer seat invitation. | > | `customer_seats_claim_seat` | Claim a customer seat with an invitation token. | > | `events_list_names` | List event names. | > | `events_get` | Get an event by ID. | > | `event_types_list` | List event types with aggregated statistics. | > | `event_types_update` | Update an event type's label. | > | `meters_list` | List meters. | > | `meters_create` | Create a meter. | > | `meters_get` | Get a meter by ID. | > | `meters_update` | Update a meter. | > | `meters_quantities` | Get quantities of a meter over a time period. | > | `customer_meters_list` | List customer meters. | > | `customer_meters_get` | Get a customer meter by ID. | > | `payments_list` | List payments. | > | `payments_get` | Get a payment by ID. | # Organization Access Tokens Source: https://polar.sh/docs/integrate/oat > [!NOTE] > > All bearer tokens should be kept private and never shared or exposed in client-side code. Organization Access Tokens (OAT) are tied to **one** of your organization. You can create them from your organization settings as follows: **1. Go to Organization Settings** Open [**Settings → Access Tokens**](https://polar.sh/to/dashboard/settings/access-tokens) for your organization in the Polar dashboard. ![](https://mintcdn.com/polar/0Af3hN6-oIM4IHT3/assets/integrate/authentication/settings.png?fit=max\&auto=format\&n=0Af3hN6-oIM4IHT3\&q=85\&s=d33456ce526066fd59bcb8419f2d6937) **2. Create an access token** Click **Create token** **3. Configure the token details** * **Give your token a name**: Choose a descriptive name so you remember what this token is used for. * **Set an expiration date**: Decide how long the token should be valid. * **Select the required scopes**: Pick the permissions your token needs. ![](https://mintcdn.com/polar/0Af3hN6-oIM4IHT3/assets/integrate/authentication/oat-configuration.png?fit=max\&auto=format\&n=0Af3hN6-oIM4IHT3\&q=85\&s=e482aa0793b8465a49e548c26de4a496) # Sandbox Environment Source: https://polar.sh/docs/integrate/sandbox A separate environment, isolated from your production data To test Polar or work on your integration without worrying about actual money processing or breaking your live organization, you can use our [sandbox environment](https://sandbox.polar.sh/start). It's a dedicated server, completely isolated from the production instance where you can do all the experiments you want. > [!NOTE] > > **Why a dedicated environment instead of a test mode?** > > Since we're dealing with money and need to keep track of all movements to assure our Merchant of Record service, we found it safer to isolate live data from test data so it never interferes. Besides, it allows you to create an unlimited number of account and organization to test lot of different scenarios. Consider it as your own development server! ## Get started You can access the sandbox environment directly on [sandbox.polar.sh](https://sandbox.polar.sh/start) or by clicking on `Go to sandbox` from the organization switcher. You'll then need to create a dedicated user account and organization, the same way described in our [Quick Start guide](/docs/introduction). ### Testing payments The sandbox environment allows you to experience the complete customer funnel, including checkout. You can perform test payments using Stripe's [test card numbers](https://docs.stripe.com/testing#cards). The easiest one to test a successful payment is to use the following card number with a future expiration date and random CVC: ``` 4242 4242 4242 4242 ``` ## API and SDK To make requests to our [API](/docs/api-reference), all you need to do is to switch the base URL from `https://api.polar.sh` to `https://sandbox-api.polar.sh`. You'll also need to create an access token in the **sandbox environment**, the access token created in the production environment can't be used in the sandbox. Our official SDKs support the sandbox environment through a dedicated parameter. ```ts TypeScript theme={null} import { createPolar } from "@polar-sh/sdk/2026-10"; const polar = createPolar({ accessToken: process.env.POLAR_ACCESS_TOKEN!, environment: "sandbox", }); ``` ```py Python theme={null} import os from polar.v2026_10 import Polar polar = Polar( os.environ["POLAR_ACCESS_TOKEN"], environment="sandbox", ) ``` ## Limitations The limitations listed below only apply to sandbox and doesn't reflect the behavior in production. * Customer-facing emails (order confirmations, subscription renewal reminders, etc.) are only delivered to recipients who are members of your organization. Manage these in [**Settings → Members**](https://polar.sh/to/dashboard/settings/members). Sub-addressing aliases like `you+test@example.com` are accepted. # BetterAuth Source: https://polar.sh/docs/integrate/sdk/adapters/better-auth Payments and Checkouts made dead simple with BetterAuth ## @polar-sh/better-auth A [Better Auth](https://github.com/better-auth/better-auth) plugin for integrating [Polar](https://polar.sh) payments and subscriptions into your authentication flow. ### Features * [Automatic Customer creation on signup](#automatic-customer-creation-on-signup) * [Sync customer deletion](#sync-customer-deletion) * [Organization billing](#organization-billing) * [Checkout Integration](#checkout-plugin) * [Event Ingestion & Customer Meters for flexible Usage Based Billing](#usage-plugin) * [Handle Polar Webhooks securely with signature verification](#webhooks-plugin) * [Customer Portal](#portal-plugin) ## Examples * [With Next.js, Better Auth and Cloudflare Workers](https://github.com/polarsource/examples/tree/main/with-nextjs-better-auth-cloudflare-workers) ## Installation Install the required Better Auth and Polar packages using the following command: > [tab] npm > > ```bash Terminal theme={null} > npm install better-auth zod @polar-sh/better-auth @polar-sh/sdk@1.0.0 > ``` > [tab] yarn > > ```bash Terminal theme={null} > yarn add better-auth zod @polar-sh/better-auth @polar-sh/sdk@1.0.0 > ``` > [tab] pnpm > > ```bash Terminal theme={null} > pnpm add better-auth zod @polar-sh/better-auth @polar-sh/sdk@1.0.0 > ``` > [tab] bun > > ```bash Terminal theme={null} > bun add better-auth zod @polar-sh/better-auth @polar-sh/sdk@1.0.0 > ``` The plugin requires Better Auth 1.7 or later and Node.js 22 or later. ## Integrate Polar with BetterAuth **1. Configure Polar Access Token** Go to your Polar Organization Settings, create an Organization Access Token, and add it to the environment variables of your application. ```bash .env theme={null} POLAR_ACCESS_TOKEN=... ``` **2. Configure BetterAuth Server** The Polar plugin comes with it's own set of plugins to add functionality to your stack: * **checkout** - Enable seamless checkout integration * **portal** - Make it possible for your customers to manage their orders, subscriptions & benefits * **usage** - List customer meters & ingest events for Usage Based Billing * **webhooks** - Listen for relevant Polar webhooks ```typescript icon="square-js" auth.ts theme={null} import { betterAuth } from "better-auth"; import { polar, checkout, portal, usage, webhooks } from "@polar-sh/better-auth"; // [!code ++] import { createPolarCore } from "@polar-sh/sdk/2026-10"; // [!code ++] const polarClient = createPolarCore({ // [!code ++] accessToken: process.env.POLAR_ACCESS_TOKEN!, // [!code ++] // Use 'sandbox' if you're using the Polar Sandbox environment // Remember that access tokens, products, etc. are completely separated between environments. // Access tokens obtained in Production are for instance not usable in the Sandbox environment. environment: 'sandbox' // [!code ++] }); // [!code ++] const auth = betterAuth({ // ... Better Auth config plugins: [ polar({ // [!code ++] client: polarClient, // [!code ++] createCustomerOnSignUp: true, // [!code ++] use: [ // [!code ++] checkout({ // [!code ++] products: [ // [!code ++] { // [!code ++] productId: "123-456-789", // ID of Product from Polar Dashboard // [!code ++] slug: "pro" // Custom slug for easy reference in Checkout URL, e.g. /checkout/pro // [!code ++] } // [!code ++] ], // [!code ++] successUrl: "/success?checkout_id={CHECKOUT_ID}", // [!code ++] authenticatedUsersOnly: true // [!code ++] }), // [!code ++] portal(), // [!code ++] usage(), // [!code ++] webhooks({ // [!code ++] secret: process.env.POLAR_WEBHOOK_SECRET!, // [!code ++] // Triggered when anything regarding a customer changes onCustomerStateChanged: async (payload) => {}, // [!code ++] // Triggered when an order was paid (purchase, subscription renewal, etc.) onOrderPaid: async (payload) => {}, // [!code ++] // ... Over 40 granular webhook handlers // Called for every event onPayload: async (payload) => {}, // [!code ++] }) // [!code ++] ], // [!code ++] }) // [!code ++] ] }); ``` #### Polar Plugin Configuration Options ```typescript theme={null} // ... const auth = betterAuth({ // ... Better Auth config plugins: [ polar({ client: polarClient, // [!code ++] createCustomerOnSignUp: true, // [!code ++] getCustomerCreateParams: async ({ user }) => ({ // [!code ++] metadata: { // [!code ++] myCustomProperty: 123, // [!code ++] }, // [!code ++] }), // [!code ++] use: [ // [!code ++] // This is where you add Polar plugins // [!code ++] ], // [!code ++] }), ], }); ``` * `client` (required): Polar core client, created with `createPolarCore` from `@polar-sh/sdk/2026-10` * `use` (required): Array of Polar plugins to enable specific functionality (checkout, portal, usage, and webhooks). Pass at least one plugin. * `createCustomerOnSignUp` (optional): Automatically create a Polar customer when a user signs up * `getCustomerCreateParams` (optional): Async function that returns additional metadata for new customers * `experimental_organizationSync` (optional): Mirror Better Auth organizations to Polar team customers. See [Organization billing](#organization-billing). The core client has no service properties such as `customers` or `events`. To call the Polar API yourself, import the operation you need and pass the client to it: ```typescript theme={null} import { getStateExternalCustomers } from "@polar-sh/sdk/2026-10/services/customers"; const customerState = await getStateExternalCustomers(polarClient)(userId); ``` Responses and webhook payloads use the SDK's snake_case field names. **3. Configure BetterAuth Client** You will be using the BetterAuth Client to interact with the Polar functionalities. ```typescript icon="square-js" auth-client.ts theme={null} import { createAuthClient } from "better-auth/react"; import { polarClient } from "@polar-sh/better-auth/client"; // [!code ++] import { organizationClient } from "better-auth/client/plugins"; // [!code ++] // All Polar plugins, etc. should be attached to BetterAuth server export const authClient = createAuthClient({ // [!code ++] plugins: [organizationClient(), polarClient()], // [!code ++] }); // [!code ++] ``` `organizationClient()` is only needed if you use Better Auth's organization plugin. ## Automatic Customer creation on signup Enable the `createCustomerOnSignUp` [Polar plugin configuration option](#polar-plugin-configuration-options) to automatically create a new Polar Customer when a new User is added in the BetterAuth database. Customer creation runs after Better Auth inserts the user, so the initial Polar creation request includes `external_id: user.id`. Applications that reject user creation in a `before` database hook do not create a Polar customer. `getCustomerCreateParams` runs only when a new customer is needed and receives the persisted user. It can add metadata; the user ID, email, and name remain authoritative. An existing customer with the same email and no external ID is linked once. An existing customer linked to the same user is reused; a different external ID produces a conflict without reassigning the customer. When a user's email or name changes in Better Auth, the plugin updates the Polar customer. Anonymous users are skipped. ## Sync Customer deletion With `createCustomerOnSignUp` enabled, the plugin also deletes the Polar customer whose external ID matches the user when that user is deleted in Better Auth. You don't need your own `afterDelete` hook. ## Organization billing The plugin supports two ways to bill Better Auth organizations. ### Metadata-based billing with `reference_id` Pass the organization ID as `reference_id` when creating a checkout. The checkout stays attached to the user's personal Polar customer, and the ID is saved as `metadata.referenceId` on the checkout, order and subscription. ```typescript icon="square-js" Checkout for an organization theme={null} const organizationId = (await authClient.organization.list()).data?.[0]?.id; await authClient.checkout({ slug: "pro", reference_id: organizationId, }); ``` List the subscriptions for that organization with the same `reference_id`: ```typescript icon="square-js" List Organization Subscriptions Example theme={null} const { data: subscriptions } = await authClient.customer.subscriptions.list({ query: { reference_id: organizationId, active: true, }, }); const userShouldHaveAccess = subscriptions?.items.some( (subscription) => subscription.product_id === "123-456-789", ); ``` > [!WARNING] > > The plugin doesn't check that the user belongs to the organization passed as > `reference_id`, and the list includes every subscription in your Polar > organization with that `metadata.referenceId`. Verify membership in your > application before using the result to grant access. ### Team customers with `experimental_organizationSync` > [!WARNING] > > This integration is experimental. If your application already bills > organizations another way, for example with `reference_id`, don't enable it: > existing subscriptions, orders, benefits and seats aren't migrated, so Better > Auth and Polar can end up inconsistent. With Better Auth's `organization()` plugin and `experimental_organizationSync: { enabled: true }`, each Better Auth organization is mirrored to a Polar team customer. The organization ID becomes the team customer's external ID, and members are mirrored as Polar members with their user ID as external ID. ```typescript icon="square-js" auth.ts theme={null} import { organization } from "better-auth/plugins"; const auth = betterAuth({ plugins: [ organization(), polar({ client: polarClient, createCustomerOnSignUp: true, experimental_organizationSync: { enabled: true, getTeamCustomerCreateParams: async ({ organization, owner }) => ({ metadata: { createdBy: owner.id }, }), }, use: [checkout(), portal(), usage(), webhooks({ secret: process.env.POLAR_WEBHOOK_SECRET! })], }), ], }); ``` `experimental_organizationSync` accepts: * `enabled` (required): Turn synchronization on * `getTeamCustomerCreateParams` (optional): Add metadata, billing details or other fields to new team customers * `mapBetterAuthRoleToPolarRole` (optional): Map non-owner Better Auth roles to `member` or `billing_manager` * `syncSeats` (optional): Size and assign seat-based subscriptions from the Better Auth roster. Requires the `webhooks` plugin and the `subscription.created` and `subscription.active` events. * `selectSeatProductsForMember` (optional): Choose which seat products each member receives when `syncSeats` is enabled Organization billing is always explicit. Pass `organization_id` to `authClient.checkout()`, `organizationId` to `authClient.usage.ingest()`, and `query: { organizationId }` to the portal, state, benefits, subscriptions, orders and meters methods. The plugin verifies the user's membership before calling Polar, and checkout also requires a billing-capable role. The access token needs the `customers:read`, `customers:write`, `members:read` and `members:write` scopes. See the [package README](https://github.com/polarsource/polar/tree/main/clients/adapters/better-auth#experimental-organization-synchronization) for the full role mapping and seat management behaviour. ## Checkout Plugin [Source code](https://github.com/polarsource/polar/blob/main/clients/adapters/better-auth/src/plugins/checkout.ts) To support [checkouts](/docs/features/checkout/links) in your app, you would pass the `checkout` plugin in the `use` property. The checkout plugin accepts the following configuration options: * **`products`** (optional): An array of product mappings or a function that returns them asynchronously. Each mapping contains a `productId` and a `slug` that allows you to reference products by a friendly slug instead of their full ID. * **`successUrl`** (optional): The relative path or absolute URL where customers will be redirected after a successful checkout completion. Relative paths resolve against your auth server URL. You can use the `{CHECKOUT_ID}` placeholder in the URL to include the checkout session ID in the redirect. * **`returnUrl`** (optional): An optional relative path or absolute URL which renders a back-button in the Checkout. * **`authenticatedUsersOnly`** (optional): When `true`, checkouts are rejected for signed-out and anonymous users. When `false`, anonymous checkouts are allowed. Either way, a signed-in user is attached to the checkout as the customer. * **`theme`** (optional): A string that can be used to enforce the theme of the checkout page. Can be either `light` or `dark`. * **`customerIpAddress`** (optional): A function `(headers) => ip` to resolve the customer IP address yourself, or `false` to not send it. By default the IP is resolved with Better Auth's `getIP` (see `advanced.ipAddress`) and sent to Polar to show the customer's local currency. **1. Use Checkout Plugin** Update the `use` property of the Polar plugin on your BetterAuth server to include the `checkout` plugin. ```typescript icon="square-js" Checkout Plugin Example theme={null} import { polar, checkout // [!code ++] } from "@polar-sh/better-auth"; const auth = betterAuth({ // ... Better Auth config plugins: [ polar({ ... use: [ checkout({ // [!code ++] // Optional field - will make it possible to pass a slug to checkout instead of Product ID products: [ { productId: "123-456-789", slug: "pro" } ], // [!code ++] // Relative path or absolute URL to redirect to when checkout is successfully completed successUrl: "/success?checkout_id={CHECKOUT_ID}", // [!code ++] // Whether you want to allow unauthenticated checkout sessions or not authenticatedUsersOnly: true, // [!code ++] // An optional URL which renders a back-button in the Checkout returnUrl: "https://myapp.com" // [!code ++] }) // [!code ++] ], }) ] }); ``` **2. Create checkouts using BetterAuth client** When the `checkout` plugin is passed, you are then able to initialize Checkout Sessions using the `checkout` method on the BetterAuth client. This will redirect the user to the product's checkout link. ```typescript icon="square-js" BetterAuth Checkout with Polar Example theme={null} await authClient.checkout({ // Polar Product IDs products: ["e651f46d-ac20-4f26-b769-ad088b123df2"], // [!code ++] // OR // if "products" in passed in the checkout plugin's config, you may pass the slug // slug: "pro", // [!code ++] }); ``` The `checkout` method accepts the following snake_case properties: * **`products`** (optional): A Polar Product ID or an array of them * **`slug`** (optional): A string that can be used as a reference to the `products` defined in the Checkout config * **`reference_id`** (optional): An identifier saved as `referenceId` in the metadata of the checkout, order & subscription object. See [Organization billing](#organization-billing). * **`organization_id`** (optional): Bill a synchronized team customer. See [Organization billing](#organization-billing). * **`metadata`**, **`custom_field_data`** (optional): Metadata and custom field values for the checkout * **`allow_discount_codes`** (optional, defaults to `true`), **`discount_id`**, **`discount_code`** (optional): Discount settings. `discount_id` takes precedence when both are supplied. * **`seats`**, **`min_seats`**, **`max_seats`** (optional): Seat-based pricing settings * **`allow_trial`**, **`trial_interval`**, **`trial_interval_count`** (optional): Trial settings * **`success_url`**, **`return_url`** (optional): Override the plugin's `successUrl` and `returnUrl` * **`redirect`** (optional, defaults to `true`): Set to `false` to get the checkout `url` back without redirecting **3. Embed the checkout (optional)** Use `checkoutEmbed` to open the checkout as an embed on your site instead of redirecting. It accepts the same properties as `checkout`. ```typescript icon="square-js" BetterAuth Checkout Embed Example theme={null} const embed = await authClient.checkoutEmbed({ products: ["e651f46d-ac20-4f26-b769-ad088b123df2"], }); embed.addEventListener("success", (event) => { console.log("Purchase successful!", event.detail); }); ``` ## Usage Plugin [Source code](https://github.com/polarsource/polar/blob/main/clients/adapters/better-auth/src/plugins/usage.ts) A plugin for Usage Based Billing that allows you to [ingest events](#1-event-ingestion) from your application and list the [authenticated user's Usage Meter](#2-customer-meters). To enable [usage based billing](/docs/features/usage-based-billing/introduction) in your app, you would pass the `usage` plugin in the `use` property. ```typescript icon="square-js" Usage Plugin Example theme={null} import { polar, checkout, portal, usage // [!code ++] } from "@polar-sh/better-auth"; const auth = betterAuth({ // ... Better Auth config plugins: [ polar({ ... use: [ checkout(...), portal(), usage() // [!code ++] ], }) ] }); ``` ### 1. Event Ingestion Polar's Usage Based Billing builds entirely on event ingestion. Ingest events from your application, create Meters to represent that usage, and add metered prices to Products to charge for it. > [!WARNING] > > **Ingest events from your server, not from the browser.** Events drive billing, so the client must never be trusted to decide what is consumed. Always ingest from the same server-side handler that performs the metered action (e.g. the route that generated the AI video, processed the upload, etc.) so that the recorded usage cannot be forged or bypassed. Because `createCustomerOnSignUp: true` sets the Polar customer's external ID to the BetterAuth user ID, you can pass `external_customer_id: session.user.id` when ingesting — no extra lookup is needed. The example below calls the Polar SDK directly from a server route handler, reusing the `polarClient` you configured in `auth.ts`: ```typescript icon="square-js" app/api/ai/video/route.ts (Next.js App Router) theme={null} import { auth } from "@/lib/auth"; import { polarClient } from "@/lib/polar"; import { ingestEvents } from "@polar-sh/sdk/2026-10/services/events"; import { headers } from "next/headers"; export async function POST(request: Request) { const session = await auth.api.getSession({ headers: await headers() }); if (!session) { return new Response("Unauthorized", { status: 401 }); } // Run the metered work on the server const { video, tokensConsumed } = await makeNewVideo(request); // Ingest the resulting usage against the authenticated user await ingestEvents(polarClient)({ events: [ { name: "ai-video", external_customer_id: session.user.id, metadata: { tokensConsumed, }, }, ], }); return Response.json({ video }); } ``` Each event accepts: * `name` (string): The name of the event to ingest. For example, `ai_usage`, `video_streamed` or `file_uploaded`. * `external_customer_id` (string): The BetterAuth user ID. Pass `session.user.id` from the server-side session. * `metadata` (object): A record of key-value pairs that describe the event. Values can be strings, numbers, or booleans. Use this to store information that can be filtered on or used to compute usage — duration, token count, file size, etc. #### Client-side ingestion endpoint The `usage` plugin also registers a BetterAuth endpoint that is callable from the client as `authClient.usage.ingest(...)`. It forwards to Polar from the BetterAuth server and attaches the authenticated user automatically. Anonymous users are rejected: ```typescript icon="square-js" auth-client.ts theme={null} const { data: ingested } = await authClient.usage.ingest({ event: "file-uploads", metadata: { uploadedFiles: 12, }, }); ``` > [!WARNING] > > This endpoint trusts whatever the client sends it, so a user can call it from their browser and claim any usage they want. Only use it for events that genuinely originate on the client and that you are comfortable not being authoritative (e.g. analytics-like signals). For billable usage, stick to server-side ingestion as shown above. ### 2. Customer Meters A method to list the authenticated user's Usage Meters (aka Customer Meters). A Customer Meter contains all the information about their consumption on your defined meters. The `meters` method of the `usage` plugin accepts the following parameters: * `page` (number): The page number for pagination (starts from 1). * `limit` (number): The maximum number of meters to return per page. ```typescript icon="square-js" Customer Meters with Usage Plugin Example theme={null} const { data: customerMeters } = await authClient.usage.meters.list({ query: { page: 1, limit: 10, }, }); ``` The `meters` method returns the following fields in the response object: * **Customer Information**: Details about the authenticated customer * **Meter Information**: Configuration and settings of the usage meter * **Customer Meter Information**: * **Consumed Units**: Total units consumed by the customer * **Credited Units**: Total units credited to the customer * **Balance**: The balance of the meter, i.e. the difference between credited and consumed units. ## Webhooks Plugin [Source code](https://github.com/polarsource/polar/blob/main/clients/adapters/better-auth/src/plugins/webhooks.ts) The `webhooks` plugin can be used to capture incoming events from your Polar organization. To set up the Polar `webhooks` plugin on your BetterAuth server, follow the steps below: **1. Configure Webhook Endpoints in Polar** Configure a Webhook endpoint in your Polar Organization Settings page by following [this guide](/docs/integrate/webhooks/endpoints). The endpoint is served at `/polar/webhooks` under your Better Auth base path, which is `/api/auth/polar/webhooks` by default. **2. Add the Webhook Secret** Add the obtained webhook secret to your application environment as an environment variable (to be used as `process.env.POLAR_WEBHOOK_SECRET`): ```bash .env theme={null} POLAR_WEBHOOK_SECRET="..." ``` **3. Use Webhooks Plugin in BetterAuth server** Pass the `webhooks` plugin in the `use` property. ```typescript icon="square-js" Webhooks Plugin Example theme={null} import { polar, webhooks // [!code ++] } from "@polar-sh/better-auth"; const auth = betterAuth({ // ... Better Auth config plugins: [ polar({ ... use: [ webhooks({ // [!code ++] secret: process.env.POLAR_WEBHOOK_SECRET!, // [!code ++] // Triggered when anything regarding a customer changes onCustomerStateChanged: async (payload) => {}, // [!code ++] // Triggered when an order was paid (purchase, subscription renewal, etc.) onOrderPaid: async (payload) => {}, // [!code ++] // ... Over 40 granular webhook handlers // Called for every event onPayload: async (payload) => {}, // [!code ++] }) // [!code ++] ], }) ] }); ``` The `webhooks` plugin allows you to invoke handlers for all Polar webhook events: Every handler is an `async` function that receives the full webhook payload (`{ type, timestamp, data }`). Fields use the SDK's snake_case names, for example `payload.data.customer_id`. * `onPayload` - Called for every incoming webhook event, in addition to the matching handler below * `onCheckoutCreated` - Triggered when a checkout is created * `onCheckoutExpired` - Triggered when a checkout expires * `onCheckoutUpdated` - Triggered when a checkout is updated * `onOrderCreated` - Triggered when an order is created * `onOrderUpdated` - Triggered when an order is updated * `onOrderPaid` - Triggered when an order is paid * `onOrderRefunded` - Triggered when an order is refunded * `onRefundCreated` - Triggered when a refund is created * `onRefundUpdated` - Triggered when a refund is updated * `onSubscriptionCreated` - Triggered when a subscription is created * `onSubscriptionUpdated` - Triggered when a subscription is updated * `onSubscriptionActive` - Triggered when a subscription becomes active * `onSubscriptionCanceled` - Triggered when a subscription is canceled * `onSubscriptionCycled` - Triggered when a subscription enters a new billing period * `onSubscriptionPastDue` - Triggered when a subscription payment fails and it becomes past due * `onSubscriptionPaused` - Triggered when a subscription is paused * `onSubscriptionResumed` - Triggered when a paused subscription is resumed * `onSubscriptionRevoked` - Triggered when a subscription is revoked * `onSubscriptionUncanceled` - Triggered when a subscription cancellation is reversed * `onProductCreated` - Triggered when a product is created * `onProductUpdated` - Triggered when a product is updated * `onOrganizationUpdated` - Triggered when an organization is updated * `onBenefitCreated` - Triggered when a benefit is created * `onBenefitUpdated` - Triggered when a benefit is updated * `onBenefitGrantCreated` - Triggered when a benefit grant is created * `onBenefitGrantCycled` - Triggered when a benefit grant renews with its subscription * `onBenefitGrantUpdated` - Triggered when a benefit grant is updated * `onBenefitGrantRevoked` - Triggered when a benefit grant is revoked * `onCustomerCreated` - Triggered when a customer is created * `onCustomerUpdated` - Triggered when a customer is updated * `onCustomerDeleted` - Triggered when a customer is deleted * `onCustomerStateChanged` - Triggered when a customer state changes * `onCustomerSeatAssigned` - Triggered when a seat is assigned to a customer * `onCustomerSeatClaimed` - Triggered when a customer claims an assigned seat * `onCustomerSeatRevoked` - Triggered when a seat is revoked from a customer * `onDiscountCreated` - Triggered when a discount is created * `onDiscountUpdated` - Triggered when a discount is updated * `onDiscountDeleted` - Triggered when a discount is deleted * `onMemberCreated` - Triggered when a member is added to a team customer * `onMemberUpdated` - Triggered when a member of a team customer is updated * `onMemberDeleted` - Triggered when a member is removed from a team customer The handler verifies the `webhook-id`, `webhook-timestamp` and `webhook-signature` headers against your webhook secret before calling any handler: * A missing or invalid signature returns `403`. * A malformed payload returns `400`. * A signed event type that the installed SDK doesn't know yet returns `200` and is ignored, so new event types don't cause retries. * If a handler throws, the error propagates and the request fails, so Polar retries the delivery. ## Portal Plugin [Source code](https://github.com/polarsource/polar/blob/main/clients/adapters/better-auth/src/plugins/portal.ts) A plugin which enables customer management of their purchases, orders and subscriptions. ```typescript icon="square-js" Portal Plugin Example theme={null} import { polar, checkout, portal // [!code ++] } from "@polar-sh/better-auth"; const auth = betterAuth({ // ... Better Auth config plugins: [ polar({ ... use: [ checkout(...), portal({ // [!code ++] returnUrl: "https://myapp.com", // An optional absolute URL which renders a back-button in the Customer Portal // [!code ++] theme: "dark", // Enforces the theme - System-preferred theme will be set if left omitted // [!code ++] }) // [!code ++] ], }) ] }); ``` The `portal` plugin gives the BetterAuth Client a set of customer management methods, scoped under `authClient.customer` object. To act on a [synchronized team customer](#organization-billing) instead of the user, pass `query: { organizationId }` to the list and state methods, or `fetchOptions: { query: { organizationId } }` to `portal()`. ### 1. Customer Portal Management The following method will redirect the user to the Polar Customer Portal, where they can see their orders, purchases, subscriptions, benefits, etc. ```typescript icon="square-js" Open Customer Portal Example theme={null} await authClient.customer.portal(); ``` Pass `{ redirect: false }` to get the portal `url` back without redirecting. Anonymous users are rejected. ### 2. Customer State The portal plugin also adds a convenient method to retrieve the Customer State. ```typescript icon="square-js" Retrieve Customer State Example theme={null} const { data: customerState } = await authClient.customer.state(); ``` The customer state object contains: * All the data about the customer. * The list of their active subscriptions. * The list of their granted benefits. * The list of their active meters, with their current balance. Using the customer state object, you can determine whether to provision access for the user to your service. The user needs a Polar customer, so enable `createCustomerOnSignUp` or the request fails. Learn more about the Polar Customer State [in the Polar Docs](/docs/integrate/customer-state). ### 3. Benefits, Orders & Subscriptions The portal plugin adds the following 3 convenient methods for listing benefits, orders & subscriptions relevant to the authenticated user/customer. Each returns a paginated list with `items` and `pagination`. #### 3.1 Benefits This method only lists granted benefits for the authenticated user/customer. ```typescript icon="square-js" List User Benefits Example theme={null} const { data: benefits } = await authClient.customer.benefits.list({ query: { page: 1, limit: 10, }, }); ``` #### 3.2 Orders This method lists orders like purchases and subscription renewals for the authenticated user/customer. ```typescript icon="square-js" List User Orders Example theme={null} const { data: orders } = await authClient.customer.orders.list({ query: { page: 1, limit: 10, productBillingType: "one_time", // or 'recurring' }, }); ``` #### 3.3 Subscriptions This method lists the subscriptions associated with authenticated user/customer. ```typescript icon="square-js" List User Subscriptions Example theme={null} const { data: subscriptions } = await authClient.customer.subscriptions.list({ query: { page: 1, limit: 10, active: true, }, }); ``` To list the subscriptions of an organization, pass `reference_id` or `organizationId`. See [Organization billing](#organization-billing). You can't combine the two. # Framework Adapters Source: https://polar.sh/docs/integrate/sdk/adapters/introduction Drop-in adapters that wire Polar checkouts and webhooks into your framework Framework adapters make it dead simple to add Polar checkouts and webhooks to your stack. Pick your framework to get started. > [card] [Next.js](/docs/integrate/sdk/adapters/nextjs) > [card] [Nuxt](/docs/integrate/sdk/adapters/nuxt) > [card] [TanStack Start](/docs/integrate/sdk/adapters/tanstack-start) > [card] [Laravel](/docs/integrate/sdk/adapters/laravel) > [card] [BetterAuth](/docs/integrate/sdk/adapters/better-auth) ## Legacy adapters These adapters are deprecated. For these frameworks, we recommend a direct integration using our [SDKs](/docs/integrate/sdk/introduction) instead. > [card] [Astro](/docs/integrate/sdk/adapters/astro) > [card] [Deno](/docs/integrate/sdk/adapters/deno) > [card] [Elysia](/docs/integrate/sdk/adapters/elysia) > [card] [Express](/docs/integrate/sdk/adapters/express) > [card] [Fastify](/docs/integrate/sdk/adapters/fastify) > [card] [Hono](/docs/integrate/sdk/adapters/hono) > [card] [Remix](/docs/integrate/sdk/adapters/remix) > [card] [Supabase](/docs/integrate/sdk/adapters/supabase) > [card] [SvelteKit](/docs/integrate/sdk/adapters/sveltekit) # Laravel Source: https://polar.sh/docs/integrate/sdk/adapters/laravel Payments and Checkouts made dead simple with Laravel Seamlessly integrate Polar.sh subscriptions and payments into your Laravel application. This package provides an elegant way to handle subscriptions, manage recurring payments, and interact with Polar's API. With built-in support for webhooks, subscription management, and a fluent API, you can focus on building your application while we handle the complexities of subscription billing. > [!NOTE] > > This provider is not maintained or officially supported by Polar. Use at your own discretion. If you have questions about the provider, please contact the project maintainer. ## Installation **Step 1:** You can install the package via composer: ```bash Terminal theme={null} composer require danestves/laravel-polar ``` **Step 2:** Run `:install`: ```bash Terminal theme={null} php artisan polar:install ``` This will publish the config, migrations and views, and ask to run the migrations. Or publish and run the migrations individually: ```bash Terminal theme={null} php artisan vendor:publish --tag="polar-migrations" ``` ```bash Terminal theme={null} php artisan vendor:publish --tag="polar-config" ``` ```bash Terminal theme={null} php artisan vendor:publish --tag="polar-views" ``` ```bash Terminal theme={null} php artisan migrate ``` This is the contents of the published config file: ```php theme={null} Settings | under the "Developers" section. | */ 'access_token' => env('POLAR_ACCESS_TOKEN'), /* |-------------------------------------------------------------------------- | Polar Webhook Secret |-------------------------------------------------------------------------- | | The Polar webhook secret is used to verify that the webhook requests | are coming from Polar. You can find your webhook secret in the Polar | dashboard > Settings > Webhooks on each registered webhook. | | We (the developers) recommend using a single webhook for all your | integrations. This way you can use the same secret for all your | integrations and you don't have to manage multiple webhooks. | */ 'webhook_secret' => env('POLAR_WEBHOOK_SECRET'), /* |-------------------------------------------------------------------------- | Polar Url Path |-------------------------------------------------------------------------- | | This is the base URI where routes from Polar will be served | from. The URL built into Polar is used by default; however, | you can modify this path as you see fit for your application. | */ 'path' => env('POLAR_PATH', 'polar'), /* |-------------------------------------------------------------------------- | Default Redirect URL |-------------------------------------------------------------------------- | | This is the default redirect URL that will be used when a customer | is redirected back to your application after completing a purchase | from a checkout session in your Polar account. | */ 'redirect_url' => null, /* |-------------------------------------------------------------------------- | Currency Locale |-------------------------------------------------------------------------- | | This is the default locale in which your money values are formatted in | for display. To utilize other locales besides the default "en" locale | verify you have to have the "intl" PHP extension installed on the system. | */ 'currency_locale' => env('POLAR_CURRENCY_LOCALE', 'en'), ]; ``` ## Usage ### Access Token Configure your access token. Create a new token in the Polar Dashboard > Settings > Access Tokens and paste it in the `.env` file. * [https://sandbox.polar.sh/dashboard/ORG_SLUG/settings/access-tokens](https://sandbox.polar.sh/dashboard/ORG_SLUG/settings/access-tokens) (Sandbox) * [https://polar.sh/dashboard/ORG_SLUG/settings/access-tokens](https://polar.sh/dashboard/ORG_SLUG/settings/access-tokens) (Production) ```bash Terminal theme={null} POLAR_ACCESS_TOKEN="" ``` ### Webhook Secret Configure your webhook secret. Create a new webhook in the Polar Dashboard > Settings > Webhooks. * [https://sandbox.polar.sh/dashboard/ORG_SLUG/settings/webhooks](https://sandbox.polar.sh/dashboard/ORG_SLUG/settings/webhooks) (Sandbox) * [https://polar.sh/dashboard/ORG_SLUG/settings/webhooks](https://polar.sh/dashboard/ORG_SLUG/settings/webhooks) (Production) Configure the webhook for the following events that this package supports: * `order.created` * `order.updated` * `subscription.created` * `subscription.updated` * `subscription.active` * `subscription.canceled` * `subscription.revoked` * `benefit_grant.created` * `benefit_grant.updated` * `benefit_grant.revoked` ```bash Terminal theme={null} POLAR_WEBHOOK_SECRET="" ``` ### Billable Trait Let’s make sure everything’s ready for your customers to checkout smoothly. 🛒 First, we’ll need to set up a model to handle billing—don’t worry, it’s super simple! In most cases, this will be your app’s User model. Just add the Billable trait to your model like this (you’ll import it from the package first, of course): ```php theme={null} use Danestves\LaravelPolar\Billable; class User extends Authenticatable { use Billable; } ``` Now the user model will have access to the methods provided by the package. You can make any model billable by adding the trait to it, not just the User model. ### Polar Script Polar includes a JavaScript script that you can use to initialize the [Polar Embedded Checkout](https://polar.sh/docs/features/checkout/embed). If you going to use this functionality, you can use the `@polarEmbedScript` directive to include the script in your views inside the `` tag. ```blade theme={null} ... @polarEmbedScript ``` ### Webhooks This package includes a webhook handler that will handle the webhooks from Polar. #### Webhooks & CSRF Protection Incoming webhooks should not be affected by [CSRF protection](https://laravel.com/docs/csrf). To prevent this, add your webhook path to the except list of your `App\Http\Middleware\VerifyCsrfToken` middleware: ```php theme={null} protected $except = [ 'polar/*', ]; ``` Or if you're using Laravel v11 and up, you should exclude `polar/*` in your application's `bootstrap/app.php` file: ```php theme={null} ->withMiddleware(function (Middleware $middleware) { $middleware->validateCsrfTokens(except: [ 'polar/*', ]); }) ``` ### Commands This package includes a list of commands that you can use to retrieve information about your Polar account. | Command | Description | | - | - | | `php artisan polar:products` | List all available products with their ids | ### Checkouts #### Single Payments To create a checkout to show only a single payment, pass a single items to the array of products when creating the checkout. ```php theme={null} use Illuminate\Http\Request; Route::get('/subscribe', function (Request $request) { return $request->user()->checkout(['product_id_123']); }); ``` If you want to show multiple products that the user can choose from, you can pass an array of product ids to the `checkout` method. ```php theme={null} use Illuminate\Http\Request; Route::get('/subscribe', function (Request $request) { return $request->user()->checkout(['product_id_123', 'product_id_456']); }); ``` This could be useful if you want to offer monthly, yearly, and lifetime plans for example. > [!NOTE] > > If you are requesting the checkout a lot of times we recommend you to cache the URL returned by the `checkout` method. #### Custom Price You can override the price of a product using the `charge` method. ```php theme={null} use Illuminate\Http\Request; Route::get('/subscribe', function (Request $request) { return $request->user()->charge(1000, ['product_id_123']); }); ``` #### Embedded Checkout Instead of redirecting the user you can create the checkout link, pass it to the page and use our blade component: ```php theme={null} use Illuminate\Http\Request; Route::get('/billing', function (Request $request) { $checkout = $request->user()->checkout(['product_id_123']); return view('billing', ['checkout' => $checkout]); }); ``` Now we can use the button like this: ```blade theme={null} ``` The component accepts the normal props that a link element accepts. You can change the theme of the embedded checkout by using the following prop: ```blade theme={null} ``` It defaults to light theme, so you only need to pass the prop if you want to change it. ### Prefill Customer Information You can override the user data using the following methods in your models provided by the `Billable` trait. ```php theme={null} public function polarName(): ?string; // default: $model->name public function polarEmail(): ?string; // default: $model->email ``` ### Redirects After Purchase You can redirect the user to a custom page after the purchase using the `withSuccessUrl` method: ```php theme={null} $request->user()->checkout('variant-id') ->withSuccessUrl(url('/success')); ``` You can also add the `checkout_id={CHECKOUT_ID}` query parameter to the URL to retrieve the checkout session id: ```php theme={null} $request->user()->checkout('variant-id') ->withSuccessUrl(url('/success?checkout_id={CHECKOUT_ID}')); ``` ### Custom metadata and customer metadata You can add custom metadata to the checkout session using the `withMetadata` method: ```php theme={null} $request->user()->checkout('variant-id') ->withMetadata(['key' => 'value']); ``` You can also add customer metadata to the checkout session using the `withCustomerMetadata` method: ```php theme={null} $request->user()->checkout('variant-id') ->withCustomerMetadata(['key' => 'value']); ``` These will then be available in the relevant webhooks for you. #### Reserved Keywords When working with custom data, this library has a few reserved terms. * `billable_id` * `billable_type` * `subscription_type` Using any of these will result in an exception being thrown. ### Customers #### Customer Portal Customers can update their personal information (e.g., name, email address) by accessing their [self-service customer portal](https://polar.sh/docs/features/customer-portal). To redirect customers to this portal, call the `redirectToCustomerPortal()` method on your billable model (e.g., the User model). ```php theme={null} use Illuminate\Http\Request; Route::get('/customer-portal', function (Request $request) { return $request->user()->redirectToCustomerPortal(); }); ``` Optionally, you can obtain the signed customer portal URL directly: ```php theme={null} $url = $user->customerPortalUrl(); ``` ### Orders #### Retrieving Orders You can retrieve orders by using the `orders` relationship on the billable model: ```blade theme={null} @foreach ($user->orders as $order) @endforeach
{{ $order->ordered_at->toFormattedDateString() }} {{ $order->polar_id }} {{ $order->amount }} {{ $order->tax_amount }} {{ $order->refunded_amount }} {{ $order->refunded_tax_amount }} {{ $order->currency }}
``` #### Check order status You can check the status of an order by using the `status` attribute: ```php theme={null} $order->status; ``` Or you can use some of the helper methods offers by the `Order` model: ```php theme={null} $order->paid(); ``` Aside from that, you can run two other checks: refunded, and partially refunded. If the order is refunded, you can utilize the refunded_at timestamp: ```blade theme={null} @if ($order->refunded()) Order {{ $order->polar_id }} was refunded on {{ $order->refunded_at->toFormattedDateString() }} @endif ``` You may also see if an order was for a certain product: ```php theme={null} if ($order->hasProduct('product_id_123')) { // ... } ``` Or for an specific price: ```php theme={null} if ($order->hasPrice('price_id_123')) { // ... } ``` Furthermore, you can check if a consumer has purchased a specific product: ```php theme={null} if ($user->hasPurchasedProduct('product_id_123')) { // ... } ``` Or for an specific price: ```php theme={null} if ($user->hasPurchasedPrice('price_id_123')) { // ... } ``` ### Subscriptions #### Creating Subscriptions Starting a subscription is simple. For this, we require our product's variant id. Copy the product id and start a new subscription checkout using your billable model: ```php theme={null} use Illuminate\Http\Request; Route::get('/subscribe', function (Request $request) { return $request->user()->subscribe('product_id_123'); }); ``` When a customer completes their checkout, the incoming `SubscriptionCreated` event webhook connects it to your billable model in the database. You may then get the subscription from your billable model: ```php theme={null} $subscription = $user->subscription(); ``` #### Checking Subscription Status Once a consumer has subscribed to your services, you can use a variety of methods to check on the status of their subscription. The most basic example is to check if a customer has a valid subscription. ```php theme={null} if ($user->subscribed()) { // ... } ``` You can utilize this in a variety of locations in your app, such as middleware, rules, and so on, to provide services. To determine whether an individual subscription is valid, you can use the `valid` method: ```php theme={null} if ($user->subscription()->valid()) { // ... } ``` This method, like the subscribed method, returns true if your membership is active, on trial, past due, or cancelled during its grace period. You may also check if a subscription is for a certain product: ```php theme={null} if ($user->subscription()->hasProduct('product_id_123')) { // ... } ``` Or for a certain price: ```php theme={null} if ($user->subscription()->hasPrice('price_id_123')) { // ... } ``` If you wish to check if a subscription is on a specific price while being valid, you can use: ```php theme={null} if ($user->subscribedToPrice('price_id_123')) { // ... } ``` Alternatively, if you use different [subscription types](#multiple-subscriptions), you can pass a type as an additional parameter: ```php theme={null} if ($user->subscribed('swimming')) { // ... } if ($user->subscribedToPrice('price_id_123', 'swimming')) { // ... } ``` #### Cancelled Status To see if a user has cancelled their subscription, you can use the cancelled method: ```php theme={null} if ($user->subscription()->cancelled()) { // ... } ``` When they are in their grace period, you can utilize the `onGracePeriod` check. ```php theme={null} if ($user->subscription()->onGracePeriod()) { // ... } ``` #### Past Due Status If a recurring payment fails, the subscription will become past due. This indicates that the subscription is still valid, but your customer's payments will be retried automatically over a 21-day period. ```php theme={null} if ($user->subscription()->pastDue()) { // ... } ``` #### Subscription Scopes There are several subscription scopes available for querying subscriptions in specific states: ```php theme={null} // Get all active subscriptions... $subscriptions = Subscription::query()->active()->get(); // Get all of the cancelled subscriptions for a specific user... $subscriptions = $user->subscriptions()->cancelled()->get(); ``` Here's all available scopes: ```php theme={null} Subscription::query()->incomplete(); Subscription::query()->incompleteExpired(); Subscription::query()->onTrial(); Subscription::query()->active(); Subscription::query()->pastDue(); Subscription::query()->unpaid(); Subscription::query()->cancelled(); ``` #### Changing Plans When a consumer is on a monthly plan, they may desire to upgrade to a better plan, alter their payments to an annual plan, or drop to a lower-cost plan. In these cases, you can allow them to swap plans by giving a different product id to the `swap` method: ```php theme={null} use App\Models\User; $user = User::find(1); $user->subscription()->swap('product_id_123'); ``` This will change the customer's subscription plan, however billing will not occur until the next payment cycle. If you want to immediately invoice the customer, you can use the `swapAndInvoice` method instead. ```php theme={null} $user = User::find(1); $user->subscription()->swapAndInvoice('product_id_123'); ``` #### Multiple Subscriptions In certain situations, you may wish to allow your consumer to subscribe to numerous subscription kinds. For example, a gym may provide a swimming and weight lifting subscription. You can let your customers subscribe to one or both. To handle the various subscriptions, you can offer a type of subscription as the second argument when creating a new one: ```php theme={null} $user = User::find(1); $checkout = $user->subscribe('product_id_123', 'swimming'); ``` You can now always refer to this specific subscription type by passing the type argument when getting it: ```php theme={null} $user = User::find(1); // Retrieve the swimming subscription type... $subscription = $user->subscription('swimming'); // Swap plans for the gym subscription type... $user->subscription('gym')->swap('product_id_123'); // Cancel the swimming subscription... $user->subscription('swimming')->cancel(); ``` #### Cancelling Subscriptions To cancel a subscription, call the `cancel` method. ```php theme={null} $user = User::find(1); $user->subscription()->cancel(); ``` This will cause your subscription to be cancelled. If you cancel your subscription in the middle of the cycle, it will enter a grace period, and the ends_at column will be updated. The customer will continue to have access to the services offered for the duration of the period. You may check the grace period by calling the `onGracePeriod` method: ```php theme={null} if ($user->subscription()->onGracePeriod()) { // ... } ``` Polar does not offer immediate cancellation. To resume a subscription while it is still in its grace period, use the resume method. ```php theme={null} $user->subscription()->resume(); ``` When a cancelled subscription approaches the end of its grace period, it becomes expired and cannot be resumed. ### Handling Webhooks Polar can send webhooks to your app, allowing you to react. By default, this package handles the majority of the work for you. If you have properly configured webhooks, it will listen for incoming events and update your database accordingly. We recommend activating all event kinds so you may easily upgrade in the future. #### Webhook Events * `Danestves\LaravelPolar\Events\BenefitGrantCreated` * `Danestves\LaravelPolar\Events\BenefitGrantUpdated` * `Danestves\LaravelPolar\Events\BenefitGrantRevoked` * `Danestves\LaravelPolar\Events\OrderCreated` * `Danestves\LaravelPolar\Events\OrderRefunded` * `Danestves\LaravelPolar\Events\SubscriptionActive` * `Danestves\LaravelPolar\Events\SubscriptionCanceled` * `Danestves\LaravelPolar\Events\SubscriptionCreated` * `Danestves\LaravelPolar\Events\SubscriptionRevoked` * `Danestves\LaravelPolar\Events\SubscriptionUpdated` Each of these events has a billable `$model` object and an event `$payload`. The subscription events also include the `$subscription` object. These can be accessed via the public properties. If you wish to respond to these events, you must establish listeners for them. For example, you may wish to react when a subscription is updated. ```php theme={null} payload['type'] === 'subscription.updated') { // Handle the incoming event... } } } ``` The [Polar documentation](https://polar.sh/docs/integrate/webhooks/events) includes an example payload. Laravel v11 and up will automatically discover the listener. If you're using Laravel v10 or lower, you should configure it in your app's `EventServiceProvider`: ```php theme={null} [ PolarEventListener::class, ], ]; } ``` ## Testing ```bash Terminal theme={null} composer test ``` ## Changelog Please see [CHANGELOG](https://github.com/danestves/laravel-polar/blob/main/CHANGELOG.md) for more information on what has changed recently. ## License The MIT License (MIT). Please see [License File](https://github.com/danestves/laravel-polar/blob/main/LICENSE.md) for more information. # Next.js Source: https://polar.sh/docs/integrate/sdk/adapters/nextjs Payments and Checkouts made dead simple with Next.js ## Examples * [With Next.js](https://github.com/polarsource/examples/tree/main/with-nextjs) * [With Next.js and Upstash QStash](https://github.com/polarsource/examples/tree/main/with-nextjs-qstash-schedule-downgrades) * [With Next.js, Better Auth and Cloudflare Workers](https://github.com/polarsource/examples/tree/main/with-nextjs-better-auth-cloudflare-workers) ## Installation Install the required Polar packages using the following command: > [tab] npm > > ```bash Terminal theme={null} > npm install @polar-sh/nextjs > ``` > [tab] yarn > > ```bash Terminal theme={null} > yarn add @polar-sh/nextjs > ``` > [tab] pnpm > > ```bash Terminal theme={null} > pnpm add @polar-sh/nextjs > ``` > [tab] bun > > ```bash Terminal theme={null} > bun add @polar-sh/nextjs > ``` The adapter works with App Router route handlers on Next.js 15 and 16. ## Checkout Create a Checkout handler which takes care of redirections. ```typescript icon="square-js" checkout/route.ts theme={null} import { Checkout } from "@polar-sh/nextjs"; export const GET = Checkout({ accessToken: process.env.POLAR_ACCESS_TOKEN!, successUrl: process.env.SUCCESS_URL, returnUrl: "https://myapp.com", // An optional URL which renders a back-button in the Checkout environment: "sandbox", // Use sandbox if you're testing Polar - omit the parameter or pass 'production' otherwise theme: "dark", // Enforces the theme - System-preferred theme will be set if left omitted }); ``` `successUrl` and `returnUrl` must be absolute URLs. The handler appends `checkout_id={CHECKOUT_ID}` to `successUrl`; pass `includeCheckoutId: false` to turn this off. ### Query Params Pass query params to this route. * products `?products=123` - Repeat the parameter for multiple products: `?products=123&products=456` * customer_id (optional) `?products=123&customer_id=xxx` * external_customer_id (optional) `?products=123&external_customer_id=xxx` * customer_email (optional) `?products=123&customer_email=janedoe@gmail.com` * customer_name (optional) `?products=123&customer_name=Jane` * customer_billing_address (optional) `URL-Encoded JSON string` * customer_tax_id (optional) `?products=123&customer_tax_id=xxx` * customer_ip_address (optional) `?products=123&customer_ip_address=xxx` * customer_metadata (optional) `URL-Encoded JSON string` * allow_discount_codes (optional) `?products=123&allow_discount_codes=false` * discount_id (optional) `?products=123&discount_id=xxx` * discount_code (optional) `?products=123&discount_code=SAVE20` - Applied before redirecting. `discount_id` takes precedence when both are supplied. * seats (optional) `?products=123&seats=5` - Number of seats for seat-based products * metadata (optional) `URL-Encoded JSON string` The handler returns `400` when `products` is missing. ## Customer Portal Create a customer portal where your customer can view orders and subscriptions. ```typescript icon="square-js" portal/route.ts theme={null} import { CustomerPortal } from "@polar-sh/nextjs"; import type { NextRequest } from "next/server"; export const GET = CustomerPortal({ accessToken: process.env.POLAR_ACCESS_TOKEN!, getCustomerId: async (req: NextRequest) => "", // Function to resolve a Polar Customer ID returnUrl: "https://myapp.com", // An optional URL which renders a back-button in the Customer Portal environment: "sandbox", // Use sandbox if you're testing Polar - omit the parameter or pass 'production' otherwise }); ``` If you identify customers by your own user ID, pass `getExternalCustomerId` instead of `getCustomerId`. The handler returns `400` when the function resolves to an empty value. ## Webhooks A simple utility which verifies the signature of incoming webhook payloads with your webhook secret. ```typescript icon="square-js" api/webhook/polar/route.ts theme={null} import { Webhooks } from "@polar-sh/nextjs"; export const POST = Webhooks({ webhookSecret: process.env.POLAR_WEBHOOK_SECRET!, onPayload: async (payload) => { // Handle the payload // No need to return an acknowledge response }, }); ``` ### Payload Handlers The Webhook handler also supports granular handlers for easy integration. Every handler is an `async` function that receives the full webhook payload (`{ type, timestamp, data }`). Fields use the SDK's snake_case names, for example `payload.data.customer_id`. * `onPayload` - Called for every incoming webhook event, in addition to the matching handler below * `onCheckoutCreated` - Triggered when a checkout is created * `onCheckoutExpired` - Triggered when a checkout expires * `onCheckoutUpdated` - Triggered when a checkout is updated * `onOrderCreated` - Triggered when an order is created * `onOrderUpdated` - Triggered when an order is updated * `onOrderPaid` - Triggered when an order is paid * `onOrderRefunded` - Triggered when an order is refunded * `onRefundCreated` - Triggered when a refund is created * `onRefundUpdated` - Triggered when a refund is updated * `onSubscriptionCreated` - Triggered when a subscription is created * `onSubscriptionUpdated` - Triggered when a subscription is updated * `onSubscriptionActive` - Triggered when a subscription becomes active * `onSubscriptionCanceled` - Triggered when a subscription is canceled * `onSubscriptionCycled` - Triggered when a subscription enters a new billing period * `onSubscriptionPastDue` - Triggered when a subscription payment fails and it becomes past due * `onSubscriptionPaused` - Triggered when a subscription is paused * `onSubscriptionResumed` - Triggered when a paused subscription is resumed * `onSubscriptionRevoked` - Triggered when a subscription is revoked * `onSubscriptionUncanceled` - Triggered when a subscription cancellation is reversed * `onProductCreated` - Triggered when a product is created * `onProductUpdated` - Triggered when a product is updated * `onOrganizationUpdated` - Triggered when an organization is updated * `onBenefitCreated` - Triggered when a benefit is created * `onBenefitUpdated` - Triggered when a benefit is updated * `onBenefitGrantCreated` - Triggered when a benefit grant is created * `onBenefitGrantCycled` - Triggered when a benefit grant renews with its subscription * `onBenefitGrantUpdated` - Triggered when a benefit grant is updated * `onBenefitGrantRevoked` - Triggered when a benefit grant is revoked * `onCustomerCreated` - Triggered when a customer is created * `onCustomerUpdated` - Triggered when a customer is updated * `onCustomerDeleted` - Triggered when a customer is deleted * `onCustomerStateChanged` - Triggered when a customer state changes * `onCustomerSeatAssigned` - Triggered when a seat is assigned to a customer * `onCustomerSeatClaimed` - Triggered when a customer claims an assigned seat * `onCustomerSeatRevoked` - Triggered when a seat is revoked from a customer * `onDiscountCreated` - Triggered when a discount is created * `onDiscountUpdated` - Triggered when a discount is updated * `onDiscountDeleted` - Triggered when a discount is deleted * `onMemberCreated` - Triggered when a member is added to a team customer * `onMemberUpdated` - Triggered when a member of a team customer is updated * `onMemberDeleted` - Triggered when a member is removed from a team customer The handler verifies the `webhook-id`, `webhook-timestamp` and `webhook-signature` headers against your webhook secret before calling any handler: * A missing or invalid signature returns `403`. * A malformed payload returns `400`. * A signed event type that the installed SDK doesn't know yet returns `200` and is ignored, so new event types don't cause retries. * If a handler throws, the error propagates and the request fails, so Polar retries the delivery. # Nuxt Source: https://polar.sh/docs/integrate/sdk/adapters/nuxt Payments and Checkouts made dead simple with Nuxt ## Examples * [With Nuxt](https://github.com/polarsource/examples/tree/main/with-nuxt) ## Installation Install the required Polar packages using the following command: > [tab] npm > > ```bash Terminal theme={null} > npm install zod @polar-sh/nuxt > ``` > [tab] yarn > > ```bash Terminal theme={null} > yarn add zod @polar-sh/nuxt > ``` > [tab] pnpm > > ```bash Terminal theme={null} > pnpm add zod @polar-sh/nuxt > ``` > [tab] bun > > ```bash Terminal theme={null} > bun add zod @polar-sh/nuxt > ``` The module requires Nuxt 4 and Node.js 22 or later. ### Register the module Add the module to your `nuxt.config.ts`, along with the runtime config the handlers below read from: ```typescript theme={null} export default defineNuxtConfig({ modules: ["@polar-sh/nuxt"], runtimeConfig: { private: { polarAccessToken: "", // NUXT_PRIVATE_POLAR_ACCESS_TOKEN polarServer: "", // NUXT_PRIVATE_POLAR_SERVER - "sandbox" or "production" polarCheckoutSuccessUrl: "", // NUXT_PRIVATE_POLAR_CHECKOUT_SUCCESS_URL polarWebhookSecret: "", // NUXT_PRIVATE_POLAR_WEBHOOK_SECRET }, }, }); ``` The module auto-imports `Checkout`, `CustomerPortal` and `Webhooks` in your `server/` code. ## Checkout Create a Checkout handler which takes care of redirections. ```typescript icon="square-js" server/routes/api/checkout.get.ts theme={null} export default defineEventHandler((event) => { const { private: { polarAccessToken, polarCheckoutSuccessUrl, polarServer }, } = useRuntimeConfig(); const checkoutHandler = Checkout({ accessToken: polarAccessToken, successUrl: polarCheckoutSuccessUrl, returnUrl: "https://myapp.com", // An optional URL which renders a back-button in the Checkout environment: polarServer as "sandbox" | "production", theme: "dark", // Enforces the theme - System-preferred theme will be set if left omitted }); return checkoutHandler(event); }); ``` `successUrl` and `returnUrl` must be absolute URLs. The handler appends `checkout_id={CHECKOUT_ID}` to `successUrl`; pass `includeCheckoutId: false` to turn this off. ### Query Params Pass query params to this route. * products `?products=123` - Separate multiple products with commas: `?products=123,456` * customer_id (optional) `?products=123&customer_id=xxx` * external_customer_id (optional) `?products=123&external_customer_id=xxx` * customer_email (optional) `?products=123&customer_email=janedoe@gmail.com` * customer_name (optional) `?products=123&customer_name=Jane` * customer_billing_address (optional) `URL-Encoded JSON string` * customer_tax_id (optional) `?products=123&customer_tax_id=xxx` * customer_ip_address (optional) `?products=123&customer_ip_address=xxx` * customer_metadata (optional) `URL-Encoded JSON string` * allow_discount_codes (optional) `?products=123&allow_discount_codes=false` * discount_id (optional) `?products=123&discount_id=xxx` * discount_code (optional) `?products=123&discount_code=SAVE20` - Applied before redirecting. `discount_id` takes precedence when both are supplied. * seats (optional) `?products=123&seats=5` - Number of seats for seat-based products * metadata (optional) `URL-Encoded JSON string` The handler returns `400` when the query params are invalid, for example when `products` is missing, and `500` when the checkout can't be created. ## Customer Portal Create a customer portal where your customer can view orders and subscriptions. ```typescript icon="square-js" server/routes/api/portal.get.ts theme={null} export default defineEventHandler((event) => { const { private: { polarAccessToken, polarServer }, } = useRuntimeConfig(); const customerPortalHandler = CustomerPortal({ accessToken: polarAccessToken, returnUrl: "https://myapp.com", // An optional URL which renders a back-button in the Customer Portal environment: polarServer as "sandbox" | "production", getCustomerId: (event) => { // Use your own logic to get the Polar customer ID - from a database, session, etc. return Promise.resolve("9d89909b-216d-475e-8005-053dba7cff07"); }, }); return customerPortalHandler(event); }); ``` `getCustomerId` must resolve to a Polar customer ID. The handler returns `400` when it resolves to an empty value. ## Webhooks A simple utility which verifies the signature of incoming webhook payloads with your webhook secret. ```typescript icon="square-js" server/routes/webhook/polar.post.ts theme={null} export default defineEventHandler((event) => { const { private: { polarWebhookSecret }, } = useRuntimeConfig(); const webhooksHandler = Webhooks({ webhookSecret: polarWebhookSecret, onPayload: async (payload) => { // Handle the payload // No need to return an acknowledge response }, }); return webhooksHandler(event); }); ``` ### Payload Handlers The Webhook handler also supports granular handlers for easy integration. Every handler is an `async` function that receives the full webhook payload (`{ type, timestamp, data }`). Fields use the SDK's snake_case names, for example `payload.data.customer_id`. * `onPayload` - Called for every incoming webhook event, in addition to the matching handler below * `onCheckoutCreated` - Triggered when a checkout is created * `onCheckoutExpired` - Triggered when a checkout expires * `onCheckoutUpdated` - Triggered when a checkout is updated * `onOrderCreated` - Triggered when an order is created * `onOrderUpdated` - Triggered when an order is updated * `onOrderPaid` - Triggered when an order is paid * `onOrderRefunded` - Triggered when an order is refunded * `onRefundCreated` - Triggered when a refund is created * `onRefundUpdated` - Triggered when a refund is updated * `onSubscriptionCreated` - Triggered when a subscription is created * `onSubscriptionUpdated` - Triggered when a subscription is updated * `onSubscriptionActive` - Triggered when a subscription becomes active * `onSubscriptionCanceled` - Triggered when a subscription is canceled * `onSubscriptionCycled` - Triggered when a subscription enters a new billing period * `onSubscriptionPastDue` - Triggered when a subscription payment fails and it becomes past due * `onSubscriptionPaused` - Triggered when a subscription is paused * `onSubscriptionResumed` - Triggered when a paused subscription is resumed * `onSubscriptionRevoked` - Triggered when a subscription is revoked * `onSubscriptionUncanceled` - Triggered when a subscription cancellation is reversed * `onProductCreated` - Triggered when a product is created * `onProductUpdated` - Triggered when a product is updated * `onOrganizationUpdated` - Triggered when an organization is updated * `onBenefitCreated` - Triggered when a benefit is created * `onBenefitUpdated` - Triggered when a benefit is updated * `onBenefitGrantCreated` - Triggered when a benefit grant is created * `onBenefitGrantCycled` - Triggered when a benefit grant renews with its subscription * `onBenefitGrantUpdated` - Triggered when a benefit grant is updated * `onBenefitGrantRevoked` - Triggered when a benefit grant is revoked * `onCustomerCreated` - Triggered when a customer is created * `onCustomerUpdated` - Triggered when a customer is updated * `onCustomerDeleted` - Triggered when a customer is deleted * `onCustomerStateChanged` - Triggered when a customer state changes * `onCustomerSeatAssigned` - Triggered when a seat is assigned to a customer * `onCustomerSeatClaimed` - Triggered when a customer claims an assigned seat * `onCustomerSeatRevoked` - Triggered when a seat is revoked from a customer * `onDiscountCreated` - Triggered when a discount is created * `onDiscountUpdated` - Triggered when a discount is updated * `onDiscountDeleted` - Triggered when a discount is deleted * `onMemberCreated` - Triggered when a member is added to a team customer * `onMemberUpdated` - Triggered when a member of a team customer is updated * `onMemberDeleted` - Triggered when a member is removed from a team customer The handler verifies the `webhook-id`, `webhook-timestamp` and `webhook-signature` headers against your webhook secret before calling any handler: * A missing or invalid signature returns `403`. * A malformed payload returns `400`. * A signed event type that the installed SDK doesn't know yet returns `200` and is ignored, so new event types don't cause retries. * If a handler throws, the error propagates and the request fails, so Polar retries the delivery. # TanStack Start Source: https://polar.sh/docs/integrate/sdk/adapters/tanstack-start Payments and Checkouts made dead simple with TanStack Start ## Examples * [With TanStack Start](https://github.com/polarsource/examples/tree/main/with-tanstack-start) ## Installation Install the required Polar packages using the following command: > [tab] npm > > ```bash Terminal theme={null} > npm install @polar-sh/tanstack-start > ``` > [tab] yarn > > ```bash Terminal theme={null} > yarn add @polar-sh/tanstack-start > ``` > [tab] pnpm > > ```bash Terminal theme={null} > pnpm add @polar-sh/tanstack-start > ``` > [tab] bun > > ```bash Terminal theme={null} > bun add @polar-sh/tanstack-start > ``` ## Checkout Create a Checkout handler which takes care of redirections. ```typescript icon="square-js" routes/api/checkout.ts theme={null} import { Checkout } from "@polar-sh/tanstack-start"; import { createFileRoute } from "@tanstack/react-router"; export const Route = createFileRoute("/api/checkout")({ server: { handlers: { GET: Checkout({ accessToken: process.env.POLAR_ACCESS_TOKEN!, successUrl: process.env.SUCCESS_URL, returnUrl: "https://myapp.com", // An optional URL which renders a back-button in the Checkout environment: "sandbox", // Use sandbox if you're testing Polar - omit the parameter or pass 'production' otherwise theme: "dark", // Enforces the theme - System-preferred theme will be set if left omitted }), }, }, }); ``` `successUrl` and `returnUrl` must be absolute URLs. The handler appends `checkout_id={CHECKOUT_ID}` to `successUrl`; pass `includeCheckoutId: false` to turn this off. ### Query Params Pass query params to this route. * products `?products=123` - Repeat the parameter for multiple products: `?products=123&products=456` * customer_id (optional) `?products=123&customer_id=xxx` * external_customer_id (optional) `?products=123&external_customer_id=xxx` * customer_email (optional) `?products=123&customer_email=janedoe@gmail.com` * customer_name (optional) `?products=123&customer_name=Jane` * customer_billing_address (optional) `URL-Encoded JSON string` * customer_tax_id (optional) `?products=123&customer_tax_id=xxx` * customer_ip_address (optional) `?products=123&customer_ip_address=xxx` * customer_metadata (optional) `URL-Encoded JSON string` * allow_discount_codes (optional) `?products=123&allow_discount_codes=false` * discount_id (optional) `?products=123&discount_id=xxx` * discount_code (optional) `?products=123&discount_code=SAVE20` - Applied before redirecting. `discount_id` takes precedence when both are supplied. * seats (optional) `?products=123&seats=5` - Number of seats for seat-based products * metadata (optional) `URL-Encoded JSON string` The handler returns `400` when `products` is missing and `500` when the checkout can't be created. ## Customer Portal Create a customer portal where your customer can view orders and subscriptions. ```typescript icon="square-js" routes/api/portal.ts theme={null} import { CustomerPortal } from "@polar-sh/tanstack-start"; import { createFileRoute } from "@tanstack/react-router"; export const Route = createFileRoute("/api/portal")({ server: { handlers: { GET: CustomerPortal({ accessToken: process.env.POLAR_ACCESS_TOKEN!, getCustomerId: async (request: Request) => "", // Function to resolve a Polar Customer ID returnUrl: "https://myapp.com", // An optional URL which renders a back-button in the Customer Portal environment: "sandbox", // Use sandbox if you're testing Polar - omit the parameter or pass 'production' otherwise }), }, }, }); ``` `getCustomerId` must resolve to a Polar customer ID. The handler returns `400` when it resolves to an empty value. ## Webhooks A simple utility which verifies the signature of incoming webhook payloads with your webhook secret. ```typescript icon="square-js" routes/api/webhook/polar.ts theme={null} import { Webhooks } from "@polar-sh/tanstack-start"; import { createFileRoute } from "@tanstack/react-router"; export const Route = createFileRoute("/api/webhook/polar")({ server: { handlers: { POST: Webhooks({ webhookSecret: process.env.POLAR_WEBHOOK_SECRET!, onPayload: async (payload) => { // Handle the payload // No need to return an acknowledge response }, }), }, }, }); ``` ### Payload Handlers The Webhook handler also supports granular handlers for easy integration. Every handler is an `async` function that receives the full webhook payload (`{ type, timestamp, data }`). Fields use the SDK's snake_case names, for example `payload.data.customer_id`. * `onPayload` - Called for every incoming webhook event, in addition to the matching handler below * `onCheckoutCreated` - Triggered when a checkout is created * `onCheckoutExpired` - Triggered when a checkout expires * `onCheckoutUpdated` - Triggered when a checkout is updated * `onOrderCreated` - Triggered when an order is created * `onOrderUpdated` - Triggered when an order is updated * `onOrderPaid` - Triggered when an order is paid * `onOrderRefunded` - Triggered when an order is refunded * `onRefundCreated` - Triggered when a refund is created * `onRefundUpdated` - Triggered when a refund is updated * `onSubscriptionCreated` - Triggered when a subscription is created * `onSubscriptionUpdated` - Triggered when a subscription is updated * `onSubscriptionActive` - Triggered when a subscription becomes active * `onSubscriptionCanceled` - Triggered when a subscription is canceled * `onSubscriptionCycled` - Triggered when a subscription enters a new billing period * `onSubscriptionPastDue` - Triggered when a subscription payment fails and it becomes past due * `onSubscriptionPaused` - Triggered when a subscription is paused * `onSubscriptionResumed` - Triggered when a paused subscription is resumed * `onSubscriptionRevoked` - Triggered when a subscription is revoked * `onSubscriptionUncanceled` - Triggered when a subscription cancellation is reversed * `onProductCreated` - Triggered when a product is created * `onProductUpdated` - Triggered when a product is updated * `onOrganizationUpdated` - Triggered when an organization is updated * `onBenefitCreated` - Triggered when a benefit is created * `onBenefitUpdated` - Triggered when a benefit is updated * `onBenefitGrantCreated` - Triggered when a benefit grant is created * `onBenefitGrantCycled` - Triggered when a benefit grant renews with its subscription * `onBenefitGrantUpdated` - Triggered when a benefit grant is updated * `onBenefitGrantRevoked` - Triggered when a benefit grant is revoked * `onCustomerCreated` - Triggered when a customer is created * `onCustomerUpdated` - Triggered when a customer is updated * `onCustomerDeleted` - Triggered when a customer is deleted * `onCustomerStateChanged` - Triggered when a customer state changes * `onCustomerSeatAssigned` - Triggered when a seat is assigned to a customer * `onCustomerSeatClaimed` - Triggered when a customer claims an assigned seat * `onCustomerSeatRevoked` - Triggered when a seat is revoked from a customer * `onDiscountCreated` - Triggered when a discount is created * `onDiscountUpdated` - Triggered when a discount is updated * `onDiscountDeleted` - Triggered when a discount is deleted * `onMemberCreated` - Triggered when a member is added to a team customer * `onMemberUpdated` - Triggered when a member of a team customer is updated * `onMemberDeleted` - Triggered when a member is removed from a team customer The handler verifies the `webhook-id`, `webhook-timestamp` and `webhook-signature` headers against your webhook secret before calling any handler: * A missing or invalid signature returns `403`. * A malformed payload returns `400`. * A signed event type that the installed SDK doesn't know yet returns `200` and is ignored, so new event types don't cause retries. * If a handler throws, the error propagates and the request fails, so Polar retries the delivery. # SDKs Source: https://polar.sh/docs/integrate/sdk/introduction Official, fully typed clients for the Polar API Call the Polar API with full type safety using one of our official SDKs. > [card] [TypeScript](/docs/integrate/sdk/typescript) > > For JavaScript runtimes — Node.js and the browser. > [card] [Python](/docs/integrate/sdk/python) > > For Django, Flask, and FastAPI applications. # Python SDK Source: https://polar.sh/docs/integrate/sdk/python Fully typed Python client for the Polar API The official Python SDK provides fully typed synchronous and asynchronous clients for the Polar API. ## Installation The SDK requires Python 3.11 or later. > [tab] uv > > ```bash Terminal theme={null} > uv add polar-sdk > ``` > [tab] pip > > ```bash Terminal theme={null} > pip install polar-sdk > ``` ## Quickstart Create an [organization access token](/docs/integrate/oat), store it in `POLAR_ACCESS_TOKEN`, and make your first request: ```python main.py theme={null} import os from polar.v2026_10 import Polar polar = Polar(os.environ["POLAR_ACCESS_TOKEN"]) customer_state = polar.customers.get_state_external("customer_external_id") print(customer_state) ``` ### Async client Use `PolarAsync` in asynchronous applications: ```python async_main.py theme={null} import asyncio import os from polar.v2026_10 import PolarAsync async def main() -> None: polar = PolarAsync(os.environ["POLAR_ACCESS_TOKEN"]) customer_state = await polar.customers.get_state_external( "customer_external_id" ) print(customer_state) asyncio.run(main()) ``` The import path pins your client to the `2026-10` API version. ## Context managers Both clients support context managers to close their HTTP connections automatically when the block exits. For synchronous applications, use `Polar` with `with`: ```python theme={null} import os from polar.v2026_10 import Polar with Polar(os.environ["POLAR_ACCESS_TOKEN"]) as polar: customer_state = polar.customers.get_state_external("customer_external_id") print(customer_state) ``` For asynchronous applications, use `PolarAsync` with `async with`: ```python theme={null} import asyncio import os from polar.v2026_10 import PolarAsync async def main() -> None: async with PolarAsync(os.environ["POLAR_ACCESS_TOKEN"]) as polar: customer_state = await polar.customers.get_state_external( "customer_external_id" ) print(customer_state) asyncio.run(main()) ``` ## Sandbox environment The client uses production by default. Pass `environment="sandbox"` to use the isolated [sandbox environment](/docs/integrate/sandbox): ```python theme={null} polar = Polar( os.environ["POLAR_ACCESS_TOKEN"], environment="sandbox", ) ``` [View the source code on GitHub](https://github.com/polarsource/polar/tree/main/sdk/python). # TypeScript SDK Source: https://polar.sh/docs/integrate/sdk/typescript SDK for JavaScript runtimes (Node.js and Browser) The official TypeScript SDK provides a fully typed client for the Polar API. ## Installation > [tab] npm > > ```bash Terminal theme={null} > npm install @polar-sh/sdk > ``` > [tab] yarn > > ```bash Terminal theme={null} > yarn add @polar-sh/sdk > ``` > [tab] pnpm > > ```bash Terminal theme={null} > pnpm add @polar-sh/sdk > ``` ## Quickstart Create an [organization access token](/docs/integrate/oat) for server-side use, keep it out of browser bundles, store it in `POLAR_ACCESS_TOKEN`, and make your first request: ```typescript icon="square-js" index.js theme={null} import { createPolar } from "@polar-sh/sdk/2026-10"; const polar = createPolar({ accessToken: process.env.POLAR_ACCESS_TOKEN!, }); const customerState = await polar.customers.getStateExternal("customer_external_id"); console.log(customerState); ``` The import path pins your client to the `2026-10` API version. ## Sandbox environment The client uses production by default. Pass `environment: "sandbox"` to use the isolated [sandbox environment](/docs/integrate/sandbox): ```typescript theme={null} const polar = createPolar({ accessToken: process.env.POLAR_ACCESS_TOKEN!, environment: "sandbox", }); ``` [View the source code on GitHub](https://github.com/polarsource/polar/tree/main/sdk/typescript). ## Framework adapters Implement Checkout & Webhook handlers in few lines of code. * [Better Auth](/docs/integrate/sdk/adapters/better-auth) * [Next.js](/docs/integrate/sdk/adapters/nextjs) * [Nuxt](/docs/integrate/sdk/adapters/nuxt) * [TanStack Start](/docs/integrate/sdk/adapters/tanstack-start) Adapters for other frameworks are deprecated, use the SDK directly instead. The [`polar-integration` skill](https://github.com/polarsource/agent-toolkit/tree/main/skills/polar-integration) can help you integrate or migrate: ```bash theme={null} npx skills add https://github.com/polarsource/agent-toolkit --skill polar-integration ``` # Handle & monitor webhook deliveries Source: https://polar.sh/docs/integrate/webhooks/delivery How to parse, validate and handle webhooks and monitor their deliveries on Polar ![](https://mintcdn.com/polar/0Af3hN6-oIM4IHT3/assets/integrate/webhooks/delivery.light.png?fit=max\&auto=format\&n=0Af3hN6-oIM4IHT3\&q=85\&s=1c5f560bcca11607c67cc7f8b467dca4) Once a webhook endpoint is setup you will have access to the delivery overview page. Here you can: * See historic deliveries * Review payload sent * Trigger redelivery in case of failure Now, let's integrate our endpoint route to validate, parse & handle incoming webhooks. ## Validate & parse webhooks You now need to setup a route handler for the endpoint registered on Polar to receive, validate and parse webhooks before handling them according to your needs. ### Using our SDKs Our TypeScript & Python SDKs come with a built-in helper function to easily validate and parse the webhook event - see full examples below. ```typescript icon="square-js" JS (Express) theme={null} import express, { NextFunction, Request, Response } from 'express' import { webhooks } from '@polar-sh/sdk/2026-10' const app = express() app.post( '/webhook', express.raw({ type: 'application/json' }), async (req: Request, res: Response, next: NextFunction) => { try { const event = await webhooks.validateEvent( req.body, { 'webhook-id': req.header('webhook-id') ?? '', 'webhook-timestamp': req.header('webhook-timestamp') ?? '', 'webhook-signature': req.header('webhook-signature') ?? '', }, process.env['POLAR_WEBHOOK_SECRET'] ?? '', ) // Process the event res.status(202).send('') } catch (error) { if (error instanceof webhooks.PolarWebhookVerificationError) { res.status(403).send('') return } if (error instanceof webhooks.PolarWebhookUnknownTypeError) { // Event type added after this SDK version: acknowledge it so Polar doesn't retry res.status(202).send('') return } next(error) } }, ) ``` ```python Python (Flask) theme={null} import os from flask import Flask, request from polar.v2026_10.webhooks import ( PolarWebhookUnknownTypeError, PolarWebhookVerificationError, validate_event, ) app = Flask(__name__) @app.route('/webhook', methods=['POST']) def webhook(): try: event = validate_event( request.get_data(), dict(request.headers), os.getenv('POLAR_WEBHOOK_SECRET', ''), ) # Process the event return "", 202 except PolarWebhookVerificationError: return "", 403 except PolarWebhookUnknownTypeError: # Event type added after this SDK version: acknowledge it so Polar doesn't retry return "", 202 ``` Both examples above expect an environment variable named `POLAR_WEBHOOK_SECRET` to be set to the secret you configured during the endpoint setup. ### Custom validation Use a [Standard Webhooks library](https://github.com/standard-webhooks/standard-webhooks/tree/main/libraries) or follow the [specification](https://github.com/standard-webhooks/standard-webhooks/blob/main/spec/standard-webhooks.md). Secrets generated on or after 8 September 2026, 00:00 UTC are Standard Webhooks. Older secrets are Polar HMAC. > [!NOTE] > > **Signing schemes** > > Polar sends one `webhook-signature`. The HMAC key is which secret you have. > > **Before 8 September 2026, 00:00 UTC:** Polar HMAC. Key is the UTF-8 bytes of > the full `whsec_…` string. Base64-encode that string before you hand it to a > Standard Webhooks library. > > **On or after that instant:** [Standard Webhooks](https://github.com/standard-webhooks/standard-webhooks/blob/main/spec/standard-webhooks.md). > Pass the `whsec_…` secret to the library as-is. > > Polar SDKs 1.0.0-alpha.19 and later try both keys. Pass the `whsec_…` secret > from the dashboard. ## IP Allowlist If you are using a firewall or a reverse proxy that requires IP allowlisting, here are the IPs range you need to allow: > [!CAUTION] > > **New IP address** > > A new IP address will soon start sending production webhooks. Allow it now so > deliveries aren't blocked when we start using it: > > ``` > 3.134.178.243 > ``` ```txt Production theme={null} 3.134.238.10 3.129.111.220 52.15.118.168 3.134.178.243 74.220.50.0/24 74.220.58.0/24 ``` ```txt Sandbox theme={null} 3.134.238.10 3.129.111.220 52.15.118.168 18.117.215.101 74.220.50.0/24 74.220.58.0/24 ``` ## Failure Handling ### Delivery Retries If we hit an error while trying to reach your endpoint, whether it is a temporary network error or a bug, we'll retry to send the event up to **10 times** with an exponential backoff. ### Delivery Timeouts We currently timeout our requests to your endpoint after **10 seconds**, triggering a retry attempt after a delay as explained above. However, we strongly recommend you optimize your endpoint route to respond within **2 seconds** to ensure reliable delivery. We may lower the timeout threshold in the future, so we advise implementing your webhook handler to queue a background worker task to handle the payload asynchronously. ### Endpoint Disabling Webhook endpoints are automatically disabled after **10 consecutive failed deliveries** (non-2xx responses). When this happens: * The endpoint is marked as disabled and will no longer receive new events. * All organization members will receive an email notification. To re-enable a disabled endpoint, open your organization's [webhook settings](https://polar.sh/to/dashboard/settings/webhooks) and manually enable it. Before re-enabling, ensure your endpoint is properly configured and reachable to avoid repeated disabling. ## Troubleshooting ### Not receiving webhooks Seeing deliveries on Polar, but not receiving them on your end? Below are some common techniques to resolve the issue depending on the reported error status. **General** *Start ngrok or similar* Make sure you have started `ngrok` or whatever tunneling service you're using during local development. *Add excessive logging* E.g `console.log('webhook.handler_called')`, `console.log('webhook.validate_signature')`, `console.log('webhook.signature_validated')` etc. So you can easily confirm if the handler is called and how far it gets before any issues arise. `HTTP 404` * Try `curl -vvv -X POST ` in your terminal to confirm the route exists and see any issues along the way * Try adding trailing `/` to the URL on Polar. Often `/foo` is resolved to `/foo/` by frameworks. `HTTP 3xx` Redirect responses (301, 302, 307, etc.) are treated as failures. Polar does not follow redirects for webhook deliveries. Update your webhook URL to the final destination URL to avoid redirects. A common cause is hosting providers like Vercel that redirect between `www` and non-`www` domains. Make sure your configured URL matches your actual domain. `HTTP 403` * Using middleware for authorization? Make sure to exclude the webhook route from it since it needs to be publicly accessible * Using Cloudflare? * Check the firewall logs to verify if they are blocking our requests and setup a custom WAF rule to accept incoming requests from Polar. * Webhook delivery failures with 403 errors can occur when Cloudflare's Bot Fight Mode is enabled. Bot Fight Mode automatically blocks requests it identifies as bots, including legitimate webhook requests from Polar. Adding Polar's IP addresses to your IP Allow List or creating custom WAF rules will not resolve this issue. To fix webhook delivery problems, disable Bot Fight Mode in your Cloudflare dashboard under Security > Bots. Alternatively, you can check your Cloudflare firewall logs to confirm if requests are being blocked and create appropriate firewall rules if needed. ### Invalid signature exceptions Rolling your own validation? Older secrets are Polar HMAC: base64-encode the entire `whsec_…` string. Secrets generated on or after 8 September 2026, 00:00 UTC are Standard Webhooks: pass the secret as-is. Polar SDKs 1.0.0-alpha.19 and later try both. # Setup Webhooks Source: https://polar.sh/docs/integrate/webhooks/endpoints Get notifications asynchronously when events occur instead of having to poll for updates Secrets generated on or after 8 September 2026, 00:00 UTC follow [Standard Webhooks](https://www.standardwebhooks.com/). Older secrets use Polar HMAC. See [Handle incoming webhooks](/docs/integrate/webhooks/delivery#custom-validation). Our SDKs offer: * Built-in webhook signature validation * Fully typed webhook payloads In addition, our webhooks offer built-in support for **Slack** & **Discord** formatting. Making it a breeze to setup in-chat notifications for your team. ## Get Started > [!NOTE] > > **Use our sandbox environment during development** > > So you can easily test purchases, subscriptions, cancellations and refunds to > automatically trigger webhook events without spending a dime. **1. Add new endpoint** Head over to [**Settings → Webhooks**](https://polar.sh/to/dashboard/settings/webhooks) and click on the `Add Endpoint` button to create a new webhook. ![](https://mintcdn.com/polar/0Af3hN6-oIM4IHT3/assets/integrate/webhooks/create.light.png?fit=max\&auto=format\&n=0Af3hN6-oIM4IHT3\&q=85\&s=23eb5510c1dbd2f511461dfe1e262485) **2. Specify your endpoint URL** Enter the URL to which the webhook events should be sent. ![](https://mintcdn.com/polar/0Af3hN6-oIM4IHT3/assets/integrate/webhooks/url.light.png?fit=max\&auto=format\&n=0Af3hN6-oIM4IHT3\&q=85\&s=7ef69a33df9105e42fd8ab618a30669d) **3. Choose a delivery format** For standard, custom integrations, leave this parameter on **Raw**. This will send a payload in JSON format. If you wish to send notifications to a Discord or Slack channel, you can select the corresponding format here. Polar will then adapt the payload so properly formatted messages are sent to your channel. ![](https://mintcdn.com/polar/0Af3hN6-oIM4IHT3/assets/integrate/webhooks/format.light.png?fit=max\&auto=format\&n=0Af3hN6-oIM4IHT3\&q=85\&s=77c7f9e6a2f2c3bd1bede381f692908c) If you paste a Discord or Slack Webhook URL, the format will be automatically selected. **4. Set a secret** We cryptographically sign the requests using this secret. So you can easily verify them using our SDKs to ensure they are legitimate webhook payloads from Polar. You can set your own or generate a random one. ![](https://mintcdn.com/polar/0Af3hN6-oIM4IHT3/assets/integrate/webhooks/secret.light.png?fit=max\&auto=format\&n=0Af3hN6-oIM4IHT3\&q=85\&s=e9fa8ce33d0e86d6331813f4a37ab509) **5. Subscribe to events** Finally, select all the events you want to be notified about and you're done 🎉 > [!TIP] > > **Developing locally?** > > The [Polar CLI](/docs/integrate/cli/webhooks) forwards your organization's webhooks to a URL on your machine, so you can test handlers without deploying them. > > ```bash Terminal theme={null} > curl -fsSL https://polar.sh/install.sh | bash > polar auth login --production > polar webhook listen http://localhost:3000/api/webhooks > ``` > > It also sends sample events on demand with `polar webhook trigger`. [Now, it's time to integrate our endpoint to receive events →](/docs/integrate/webhooks/delivery) # Webhook Events Source: https://polar.sh/docs/integrate/webhooks/events Our webhook events and in which context they are useful ## Billing Events ### Checkout > [card] [checkout.created](/docs/api-reference/current/checkout_created) > [card] [checkout.updated](/docs/api-reference/current/checkout_updated) > [card] [checkout.expired](/docs/api-reference/current/checkout_expired) > > Fired when a checkout link has expired without being completed. ### Customers > [card] [customer.created](/docs/api-reference/current/customer_created) > > Fired when a new customer has been created. > [card] [customer.updated](/docs/api-reference/current/customer_updated) > > Fired when a customer has been updated. > [card] [customer.deleted](/docs/api-reference/current/customer_deleted) > > Fired when a customer has been deleted. > [card] [customer.state_changed](/docs/api-reference/current/customer_state_changed) > > Fired when a customer's state has changed. Includes active subscriptions and > granted benefits. ### Subscriptions In order to properly implement logic for handling subscriptions, you should look into the following events. > [card] [subscription.created](/docs/api-reference/current/subscription_created) > > Fired when a new subscription has been created. > [card] [subscription.active](/docs/api-reference/current/subscription_active) > [card] [subscription.uncanceled](/docs/api-reference/current/subscription_uncanceled) > [card] [subscription.cycled](/docs/api-reference/current/subscription_cycled) > > Fired when a subscription enters a new billing period, before the renewal order exists and whether or not the payment succeeds. > [card] [subscription.canceled](/docs/api-reference/current/subscription_canceled) > [card] [subscription.past_due](/docs/api-reference/current/subscription_past_due) > > Fired when a subscription payment has failed. The customer can recover by updating their payment method. > [card] [subscription.updated](/docs/api-reference/current/subscription_updated) > > Use this event if you want to handle cancellations, un-cancellations, etc. The > updated event is a catch-all event for `subscription.active`, > `subscription.canceled`, `subscription.uncanceled`, `subscription.cycled`, > `subscription.past_due`, `subscription.revoked`, `subscription.paused`, > `subscription.resumed` and `subscription.migrated`. > [card] [order.created](/docs/api-reference/current/order_created) > > Carries a `billing_reason` field, which can be `purchase`, > `subscription_create`, `subscription_cycle`, `subscription_update` and > `subscription_meter_cycle`. To act > on a renewal, listen to `subscription.cycled` instead: it fires whether or not > the renewal payment succeeds. > [card] [subscription.revoked](/docs/api-reference/current/subscription_revoked) > [card] [subscription.paused](/docs/api-reference/current/subscription_paused) > > Fired when a scheduled pause takes effect at the end of the period. Billing stops and benefits are revoked until the subscription resumes. > [card] [subscription.resumed](/docs/api-reference/current/subscription_resumed) > > Fired when a paused subscription resumes. A new billing period starts and the customer is charged immediately. > [card] [subscription.migrated](/docs/api-reference/current/subscription_migrated) > > Fired when Polar takes over billing of a subscription migrated from another provider. Includes `provider` and `provider_subscription_id` so you can correlate the two. Does not send `subscription.created` or `subscription.active`. #### Cancellation Sequences When a subscription is canceled, the events triggered depend on whether the cancellation is immediate or scheduled for the end of the billing period. **End-of-Period Cancellation (default)** When a subscription is **canceled** (by customer action from the portal or by the merchant from the dashboard/API), the following events are sent immediately: 1. `subscription.updated` 2. `subscription.canceled` Both events contain the same subscription data. The subscription will still have `active` status, but the `cancel_at_period_end` flag will be set to `true`. When the end of the current billing period arrives, the subscription is definitively revoked: billing cycles stop and benefits are revoked. The following events are then sent: 3. `subscription.updated` 4. `subscription.revoked` Both events contain the same subscription data. The subscription will have the `canceled` status. **Immediate Revocation** When a merchant cancels a subscription with **immediate revocation**, those events are sent at once: 1. `subscription.updated` 2. `subscription.canceled` 3. `subscription.revoked` All three events contain the same subscription data. The subscription will have the `canceled` status immediately. #### Renewal Sequences When a subscription is renewed for a new cycle, the webhook events are triggered in a specific sequence to help you track the renewal process and handle billing logic appropriately. **Initial Renewal Events** When a subscription reaches its renewal date, the following events are sent immediately (if enabled on the webhook): 1. `subscription.cycled` 2. `subscription.updated` 3. `order.created` `subscription.cycled` fires only on a new billing period, so you can act on a renewal without inspecting `billing_reason` on the order. It also fires when a trial converts to a paid subscription, since that starts a period too: read `status` to tell the two apart. The subscription data will reflect the new billing period through the `current_period_start` and `current_period_end` properties, showing the updated cycle dates. The order data represents the new invoice for the upcoming cycle, with a total representing what the customer will pay for this new period. If usage-based billing is involved, their consumption for the past period will be included in the total. The status of this order is `pending` at this stage. **Payment Processing Events** Shortly after the initial renewal events, the platform will trigger a payment for the new order. Once the payment is successfully processed, the following events are sent: 4. `order.updated` 5. `order.paid` Both events will contain the same order data, with the order status changed to `paid`. #### Pause Sequences Pausing is scheduled for the end of the current billing period, much like an end-of-period cancellation. When a subscription is **paused** (by customer action from the portal or by the merchant from the dashboard/API), only one event is sent immediately, because the subscription stays `active` until the period ends: 1. `subscription.updated` The `pause_at_period_end` flag is set to `true`, and `resumes_at` holds the scheduled resume date if you set one. When the end of the current billing period arrives, the pause takes effect: billing stops and benefits are revoked. The following events are then sent: 2. `subscription.updated` 3. `subscription.paused` Both events contain the same subscription data, now with the `paused` status. **Resume** When a paused subscription resumes, either immediately when you resume it or automatically on its `resumes_at` date, a new billing period starts and the customer is charged right away. The following events are sent: 1. `subscription.updated` 2. `subscription.resumed` 3. `order.created` The subscription data reflects the new period through `current_period_start` and `current_period_end`, and the order represents the immediate charge for the new cycle. #### Migration Sequences When Polar takes over billing of a subscription imported from another provider, these events are sent at cutover: * `subscription.updated` * `subscription.migrated` * `customer.state_changed` * `benefit_grant.created`, for any benefits attached to the product (seat-based products grant them when seats are claimed) * `customer.updated`, if Polar sets the copied card as the customer's default payment method Polar enqueues `subscription.updated` before `subscription.migrated`, but delivery order isn't guaranteed. `subscription.migrated` carries `provider` and `provider_subscription_id` so you can match the Polar subscription to the source. Polar does not send `subscription.created`, `subscription.active`, or `subscription.resumed` for this path. A subscription already set to cancel at the end of its period arrives with `cancel_at_period_end` set, and gets `subscription.canceled` and `subscription.revoked` when that period ends. ### Orders > [card] [order.created](/docs/api-reference/current/order_created) > [card] [order.paid](/docs/api-reference/current/order_paid) > [card] [order.updated](/docs/api-reference/current/order_updated) > [card] [order.refunded](/docs/api-reference/current/order_refunded) ### Refunds > [card] [refund.created](/docs/api-reference/current/refund_created) > [card] [refund.updated](/docs/api-reference/current/refund_updated) ### Benefit Grants > [card] [benefit_grant.created](/docs/api-reference/current/benefit_grant_created) > [card] [benefit_grant.updated](/docs/api-reference/current/benefit_grant_updated) > [card] [benefit_grant.revoked](/docs/api-reference/current/benefit_grant_revoked) ## Organization Events ### Benefits > [card] [benefit.created](/docs/api-reference/current/benefit_created) > [card] [benefit.updated](/docs/api-reference/current/benefit_updated) ### Products > [card] [product.created](/docs/api-reference/current/product_created) > [card] [product.updated](/docs/api-reference/current/product_updated) ### Discounts > [card] [discount.created](/docs/api-reference/current/discount_created) > [card] [discount.updated](/docs/api-reference/current/discount_updated) > [card] [discount.deleted](/docs/api-reference/current/discount_deleted) ### Organization > [card] [organization.updated](/docs/api-reference/current/organization_updated) # Polar: Turn Your Software into a Business Source: https://polar.sh/docs/introduction The next generation unicorns will be built by smaller teams. Polar makes that dream possible. ![](https://mintcdn.com/polar/4USyJwN59kbPHT7o/assets/welcome.png?fit=max\&auto=format\&n=4USyJwN59kbPHT7o\&q=85\&s=09976c4c1a9f4f17f30532ad8b0a711b) ## What is Polar? Turn your software into a business with Polar. Sell digital products, subscriptions, and more without the hassle of traditional payment systems. > [card] Beyond Payment Processing > > Unlike Stripe that only handles transactions, we provide complete billing > infrastructure with tax compliance, product management, and automated access > & delivery. > [card] Merchant of Record > > We handle all international tax compliance, so you can sell globally without > worrying about VAT, GST, or sales tax regulations. ## Problems We Solve > [accordion] Tax Compliance Nightmare > > **The Problem**: Selling digital products globally means dealing with VAT, GST, and sales tax in dozens of jurisdictions, each with different rates, rules, and filing requirements. Most developers either ignore this (risky) or avoid international sales entirely. > > **Polar's Solution**: As your Merchant of Record, we handle all international tax compliance. We calculate, collect, and remit taxes worldwide. You focus on building; we handle the paperwork. > [accordion] Complex Billing Infrastructure > > **The Problem**: Building subscription billing, product catalogs, customer portals, and payment flows from scratch takes months of development time and ongoing maintenance. > > **Polar's Solution**: Complete billing infrastructure out-of-the-box with APIs that let you integrate in minutes. No need to build customer portals, handle subscription lifecycle, or manage failed payments. > [accordion] Manual Access & Delivery Overhead > > **The Problem**: Manually sending license keys, granting repository access, or managing Discord invites for every purchase doesn't scale and creates delays for customers. > > **Polar's Solution**: Automated benefit delivery for common developer needs - license keys, file downloads, GitHub repo access, Discord roles, and more. Customers get instant access. > [accordion] High Processing Costs > > **The Problem**: Traditional MoR solutions charge 5-8% per transaction plus monthly fees, eating into your profits before you even start. > > **Polar's Solution**: Transparent fee structure starting at 5% + 50¢ per transaction on the free Starter plan, with optional paid plans that lower your rate. We earn when you earn. ## Core Features ### Flexible Product Management > [card] One-time Purchases > > Sell digital products, courses, templates, or software licenses with instant > delivery > [card] Subscriptions > > Recurring billing with automatic renewals and dunning management > [card] Flexible Pricing > > Fixed price, pay-what-you-want, or free products with optional minimums ### Powerful Checkout Experience ![](https://mintcdn.com/polar/0Af3hN6-oIM4IHT3/assets/introduction/checkout.light.png?fit=max\&auto=format\&n=0Af3hN6-oIM4IHT3\&q=85\&s=46584e16a18277dd02826c4cb7bd022e) > [card] [Checkout Links](/docs/features/checkout/links) > > No-code solution for quick product sales. Create and share instantly. > [card] [Embedded Checkout](/docs/features/checkout/embed) > > Integrate seamlessly into your website with customizable branding. > [card] [Checkout API](/docs/api-reference) > > Programmatically create dynamic checkout sessions for custom flows. ### Automated Benefits (Entitlements) **Set it and forget it**: Configure once, and customers get instant access to their benefits automatically. No manual work required. > [card] [License Keys](/docs/features/benefits/license-keys) > > Generate and deliver software licenses automatically with custom formats > [card] [File Downloads](/docs/features/benefits/file-downloads) > > Secure delivery of digital assets up to 10GB with download tracking > [card] [GitHub Access](/docs/features/benefits/github-access) > > Auto-invite customers to private repositories and manage permissions > [card] [Discord Access](/docs/features/benefits/discord-access) > > Automatic role assignment and server invites for community access ### Global Merchant of Record * **Worldwide Tax Compliance** - We handle VAT, GST, and sales tax in all jurisdictions * **EU VAT Handling** - Proper B2B reverse charge and B2C tax collection * **Automatic Tax Calculation** - Real-time tax rates for every transaction ## Quick Start Guide > [!TIP] > > Working with an AI agent? Tell it to read [`https://polar.sh/auth.md`](https://polar.sh/auth.md). It can sign up on its own, set up your products and checkouts, and hand the organization over to you. **1. Create Your Account** [Sign up for Polar](https://polar.sh/signup) using GitHub, Google, or email. Create an organization to manage your products and customers. **2. Create Your First Product** Set up a digital product in minutes: * Choose between one-time purchase or subscription * Set your pricing (fixed, pay-what-you-want, or free) * Configure automated benefits for instant delivery Learn more about [Products →](/docs/features/products) **3. Choose Your Integration** Pick the approach that fits your needs: > [tab] No-Code (Fastest) > > Perfect for getting started quickly: > > * Create [Checkout Links](/docs/features/checkout/links) from your dashboard > * Share via email, social media, or embed in websites > * Start accepting payments immediately > [tab] Embedded > > Integrate into your existing website: > > * Add our [Embedded Checkout](/docs/features/checkout/embed) component > * Maintain your site's look and feel > * Customers never leave your domain > [tab] Full API (Maximum Control) > > Maximum flexibility for custom workflows: > > * Use our [SDKs](/docs/integrate/sdk/typescript) for any language > * Build custom checkout flows and experiences > * Integrate with your existing tech stack **4. Set Up Webhooks** Stay synchronized with customer events: * Configure webhook endpoints in your dashboard * React to purchases, subscription changes, and customer events * Keep your database in sync automatically Read the [Webhooks guide →](/docs/integrate/webhooks/endpoints) ## Integration Options ### Native SDKs (Recommended) > [card] [JS/TS](/docs/integrate/sdk/typescript) > > For web and Node.js applications > [card] [Python](/docs/integrate/sdk/python) > > For Django, Flask, FastAPI frameworks ### Framework Adapters > [card] [Browse framework adapters](/docs/integrate/sdk/adapters/introduction) > > Drop-in adapters that wire Polar checkouts and webhooks into your stack, including Next.js, Nuxt, TanStack Start, Laravel, and BetterAuth. ## Why Choose Polar? > [tab] Individual Developers > > > [card] Ship Faster > > > > Focus on your product, not billing infrastructure. Get to market weeks faster. > > > [card] Global Reach > > > > Sell worldwide without worrying about tax compliance or regional restrictions. > > > [card] Automated Delivery > > > > License keys and downloads handled automatically. No manual work required. > > > [card] Transparent Pricing > > > > Transparent, pay-as-you-earn pricing with no hidden fees. > [tab] Small Teams > > > [card] No Engineering Overhead > > > > Complete billing solution without months of custom development work. > > > [card] Scalable Pricing > > > > Pay only when you earn, no monthly minimums or setup fees. > > > [card] Team Collaboration > > > > Multiple team members can manage products, customers, and analytics. > > > [card] Professional Checkout > > > > Branded experience that builds customer trust and increases conversions. > [tab] Growing Businesses > > > [card] Enterprise Features > > > > Advanced analytics, custom fields, bulk operations, and priority support. > > > [card] API Flexibility > > > > Full programmatic control over products, customers, orders, and subscriptions. > > > [card] Webhook Reliability > > > > Reliable real-time synchronization with your systems and database. ## Transparent Pricing > [card] 5% + 50¢ or lower > > **Per successful transaction** > > Optional paid plans to get even lower transaction fees > [!NOTE] > > **Additional fees may apply**: Some transactions may incur additional fees > (e.g. international cards). Payout fees are charged by payment providers. See > our [detailed fees page](/docs/merchant-of-record/fees) for complete information. ## Open Source & Community Polar is built in the open with full transparency and a growing community of contributors. > [card] [Open Source Codebase](https://github.com/polarsource/polar) > > Apache 2.0 license with 36+ contributors and growing > [card] [Public Development](https://github.com/polarsource/polar/issues) > > Feature requests, roadmap, and issues - all developed in public > [card] Transparent Pricing > > No hidden fees or surprise charges. What you see is what you pay. > [!WARNING] > > While self-hosting is technically possible, we recommend using our hosted > service to get the full Merchant of Record benefits including global tax > compliance. ## Ready to Start? > [card] [Create Account](https://polar.sh/signup) > > **Free signup, no credit card required** > > Get started in under 2 minutes > [card] [Read the Guides](/docs/guides/nextjs) > > **Framework-specific tutorials** > > Step-by-step integration guides > [card] [Explore the API](/docs/api-reference) > > **Complete API documentation** > > Interactive examples and SDKs > [card] [Join Our Community](https://discord.gg/Pnhfz3UThd) > > **Get help from our team** > > Active community and support # Acceptable Use Source: https://polar.sh/docs/merchant-of-record/acceptable-use/introduction What you can sell with Polar, and why we have a policy for it ### What is the Acceptable Use Policy? The Acceptable Use Policy (AUP) defines which products and business models can be sold through Polar. Polar is built for software companies, so the policy covers digital goods and services such as: * Software & SaaS * Digital products: templates, eBooks, code, icons, fonts, design assets, and similar * Premium content & access: courses, private GitHub repositories, Discord servers, and subscription content It also lists what isn't supported — for example physical goods, human services, marketplaces, and high-risk or regulated categories — along with businesses that require a closer review. ### Why do we have one? As your [Merchant of Record](/docs/merchant-of-record/introduction), Polar is the legal seller of your products. That means we're accountable to card networks, payment partners, and tax authorities for every transaction on the platform. The AUP keeps the platform compliant, protects buyers from fraud and abuse, and keeps chargeback and risk levels low so we can keep offering great rates and fast payouts to everyone. Every organization is reviewed against the AUP before its first payout and monitored continuously afterwards. Learn more in [Account Reviews](/docs/merchant-of-record/account-reviews). > [card] [Read the full Acceptable Use Policy](https://polar.sh/legal/acceptable-use-policy) > > The complete and binding list of acceptable, prohibited, and restricted products. # Account reviews Source: https://polar.sh/docs/merchant-of-record/account-reviews As a Merchant of Record (MoR), Polar resells your digital goods and services on your behalf. To do this responsibly, we verify that every business using Polar complies with our [Acceptable Use Policy](https://polar.sh/legal/acceptable-use-policy), and we continuously monitor transactions to prevent fraud, abuse, and high-risk activity. We process every review as quickly as we can and resolve every single one. ### First payout review > [!TIP] > > **Build first, submit second.** It's tempting to get approved before doing the integration work, but a complete setup is what makes a review fast and clean. Configure your [products and benefits](/docs/features/products), wire up your integration (checkout links, API keys, webhooks), and have a live website pointing to it. The more we can see end-to-end, the more confidently — and quickly — we can approve your account. Before your first payout, you'll go through our main account review. You can submit everything yourself from [**Finance → Account**](https://polar.sh/to/dashboard/finance/account) in your Polar dashboard, in three steps: 1. **Submit for approval.** Tell us about your business, your products, and how you intend to use Polar. 2. **Identity verification (KYC).** The organization owner verifies their identity with a passport, ID card, or driver's license along with a selfie — secure, easy, and quick through Stripe Identity. 3. **Connect a payout account.** Set up a [payout account](/docs/features/finance/accounts) via Stripe Connect Express so we can transfer your earnings to you. Initial reviews can take **up to 14 days** to complete, depending on volume, weekends, and holidays. This review keeps us compliant with our [Acceptable Use Policy](https://polar.sh/legal/acceptable-use-policy) and meets our own KYC/AML requirements as a billing platform. ### Continuous reviews We continuously monitor all transactions across our platform to proactively prevent fraud, and we run asynchronous reviews of accounts at certain sales thresholds. Most of these reviews don't require any additional information from you. You can always request a [payout](/docs/features/finance/payouts). A request made while your organization is under review shows as "Held for review" until approval, then is paid out automatically. Your customers are unaffected: new purchases keep going through, and existing subscriptions renew as usual. In a continuous review, we look at two things: that your use case is still within our [Acceptable Use Policy](https://polar.sh/legal/acceptable-use-policy) and consistent with what was approved during your first review, and that your account is in good financial health — refunds, chargebacks, and risk scores across recent transactions. > [!NOTE] > > **Chargebacks and card networks.** Credit card networks (e.g. Visa, Mastercard) consider chargebacks above 0.7% of sales excessive. Exceeding that threshold can lead to monitoring programs with extra costs, penalties, and ultimately termination from the network. We might reach out proactively to collaborate on lowering your chargeback ratio before it approaches these thresholds. ## Operational Guidelines ### Customer Support You're responsible for supporting your own customers. The volume of support requests we receive about your account, and how you handle them when we loop you in, both factor into our reviews. When we include you in a customer support thread, we expect a response within **48 hours**. If we don't hear back, we may refund the affected customers and issue a warning. Repeated unresponsiveness leads to offboarding. ### Test Transactions Don't run test purchases with real card details. Payment processors flag this as "card testing" and can block the card or your account, and it triggers our own account reviews. Use our sandbox environment instead. If you need to verify something in production, set up a free product or a 100% discount code so no real money changes hands. ### Chargeback Management We hold accounts to a **0.4% chargeback rate** — well below the 0.7% threshold the card networks themselves treat as excessive. Customers can file chargebacks up to 120 days after a transaction, so we monitor these continuously. If your rate climbs toward our threshold, we'll reach out first to collaborate on bringing it down. If that doesn't work, we may take the following actions, in order of severity: 1. Refund individual transactions as needed. 2. Hold payouts pending review, until the 120-day chargeback window for those transactions has closed. 3. Pause future payments. 4. Block the account and refund customers. We don't take any of these actions lightly and always try to resolve issues with you first. > [!NOTE] > > We integrate with credit card networks to receive early chargeback signals before they're officially filed. Below a certain transaction value, we automatically refund the order, cancel any related subscription, and revoke the customer's benefits to reduce chargebacks proactively. If we issue a proactive refund, we'll notify you by email. Keep in mind that benefits the customer has already consumed — such as downloaded files or forked repositories — can't be taken back. ### Policy Violations When an account violates our [Acceptable Use Policy](https://polar.sh/legal/acceptable-use-policy) — separately from chargeback issues — we offboard the merchant. Payment processing is blocked and payouts are held pending review. If we suspect fraud or intentional abuse, we block the account immediately. Otherwise, we reach out and give you 48 hours to respond; failure to respond may result in refunds to affected customers. We may also run test transactions ourselves to verify account status. We aim to work with you on the best path forward, but for compliance and risk reasons we have to cancel subscriptions and refund payments made in violation of the policy. ## FAQ > [accordion] Why is my account under review again? > > Your account may go through multiple reviews as your business grows. We perform [continuous reviews](#continuous-reviews) at certain sales thresholds to maintain platform integrity and prevent fraud. This is a standard practice across payment platforms and is part of our ongoing risk management process. > [accordion] Why do you need my social media in settings? > > We request social media information as part of our identity verification and fraud prevention processes. This helps us: > > * Verify that you're a real business or creator with an online presence > * Understand your products and services better > * Ensure compliance with our [acceptable use policies](https://polar.sh/legal/acceptable-use-policy) > > Providing accurate social media information helps speed up the review process and demonstrates the legitimacy of your business. > [accordion] Are social media settings visible publicly? > > No, your social media settings are not publicly visible. This information is used internally for verification and compliance purposes only. We treat all merchant information with strict confidentiality and use it solely for risk assessment and account review processes. > [accordion] Why do I need to share a video recording showing the product working? > > To help us verify that everything is working correctly in line with our acceptable use policy, our team would ask you to share a 100% discount code by email. This is our preferred method, as it allows the team to go through the full journey themselves and confirm the automated fulfillment from an unpaid user to a paid user. > > Alternatively, you can provide a video recording that clearly shows the complete flow from an unpaid user to a paid user, including how the product is automatically accessible after purchase. > [accordion] How do I transfer my organization to a new admin? > > To transfer admin ownership of an organization: > > 1. Invite the new admin to the team via `Settings` > `Members` in the Polar dashboard > 2. Ask that new admin to complete identity verification under `Finance` > `Account` after logging in via that email in the Polar dashboard > 3. Make sure no payout is pending > 4. Send an email from the current admin email to our support confirming the transfer to the new admin > > If you need assistance with changing organization ownership or have special circumstances, please contact [support@polar.sh](mailto:support@polar.sh). # Fees Source: https://polar.sh/docs/merchant-of-record/fees Transparent, public pricing — pick the plan that fits ## Plans Polar offers a free Starter plan plus three optional paid plans — Pro, Growth, and Scale — that lower your variable rate and prioritize your support inquiries. You can switch between plans anytime, and your rate adjusts immediately. | Plan | Monthly fee | Per transaction | Support | Included | | - | - | - | - | - | | **Starter** | Free | 5% + 50¢ | Standard Support | | | **Pro** | \$20 /mo | 3.8% + 40¢ | Prioritized Support | | | **Growth** | \$100 /mo | 3.6% + 35¢ | Prioritized Support | | | **Scale** | \$400 /mo | 3.4% + 30¢ | Slack + Prioritized Support | [Single Sign-On](/docs/features/sso) | The paid plans replace the per-transaction Merchant of Record premium with a fixed monthly fee and a lower variable rate. ### When does a paid plan pay off? Each paid plan crosses over to save you money at a predictable monthly sales threshold. | Plan | Breakeven vs. Starter | | - | - | | **Pro** | \~\$1,379 /mo in sales | | **Growth** | \~\$5,634 /mo in sales | | **Scale** | \~\$19,048 /mo in sales | Below your plan's threshold, a lower tier is the better deal. Above it, the paid plan saves money — and you get faster support on top. ## Preview features Paid plans also unlock early access to features that are still in preview. While in preview, each of these is available only on paid plans: * [Shared Slack Channel benefit](/docs/features/benefits/slack-shared-channel) — automatically give each customer a shared Slack channel via Slack Connect. * [`reset` proration behavior](/docs/features/subscriptions/proration#charge-full-amount-and-reset-cycle-reset) — on a plan change, charge the full new-plan price and restart the billing cycle, with no proration. * [Off-session charges](/docs/features/orders#arbitrary-charges) — charge a customer's saved payment method for an arbitrary amount, outside of a checkout or renewal. ## Early Member Organizations created before **May 27, 2026** stay on the Early Member rate indefinitely. This was the rate we offered while Polar was catching up on feature parity with other Merchant of Record providers, and we've committed to honoring it for everyone who signed up under it. | Monthly fee | Per transaction | Subscription fee | | - | - | - | | Free | 4% + 40¢ | +0.5% | **One trade-off worth understanding:** Early Member is yours forever as long as you stay on it. The moment you upgrade to a paid plan, Early Member is retired for that organization. You can still switch freely between the paid plans afterwards, but downgrading to Starter lands you on the new 5% + 50¢ rate, not your original Early Member rate. Organizations created on or after May 27, 2026 start on Starter (5% + 50¢). This applies to new organizations even if they're created by customers who signed up earlier. ## Additional Fees These apply on top of your plan's per-transaction fee. * **+1.5%** for international cards (non-US) * **+0.5%** for subscription payments — **Early Member only**. Starter, Pro, Growth, and Scale have no separate subscription fee. * *We also reserve the right to pass on any other fees Stripe might impose in the future.* ### Example Below is a \$30 purchase from Sweden (25% VAT) paid with an international card. | Item | Amount | | - | - | | Product Price | \$30 | | VAT (25%) | \$7.5 | | **Total Transaction Value** | **\$37.5** | Here's how the fees on that \$37.5 transaction compare across plans. | Plan | Transaction Fee | International (+1.5%) | Total Fees | | - | - | - | - | | **Starter** (5% + 50¢) | \$2.38 | \$0.56 | **\$2.94** | | **Pro** (3.8% + 40¢) | \$1.83 | \$0.56 | **\$2.39** | | **Growth** (3.6% + 35¢) | \$1.70 | \$0.56 | **\$2.26** | | **Scale** (3.4% + 30¢) | \$1.58 | \$0.56 | **\$2.14** | ## Refunds You can issue both full or partial refunds on Polar to your customers. However, the initial transaction fees are not refunded to you since credit card networks and PSPs charge them regardless of a future refund. Please note: Polar reserves the right to issue refunds at our own discretion up to 60 days after the purchase as part of our efforts to continuously and proactively reduce disputes & chargebacks which cost you \$15/dispute. We only leverage this right for this purpose and in the interest of reducing chargebacks and fees for you. [Learn more about refunds →](/docs/features/refunds) ## Dispute/Chargeback Fees Sometimes, customers can open a **dispute/chargeback** via their bank for a purchase. **Disputes cost \$15 per dispute** regardless of outcome and is deducted from your balance directly. This fee is charged by the underlying credit card networks & PSPs regardless of outcome and therefore something we cannot refund. However, we continuously work to proactively reduce the rate of chargebacks across Polar to be at or lower than industry standards. Credit card networks impose monitoring programs, penalties and higher chargeback costs for sellers with high chargeback rates (\~0.7%+). Since Polar is the Merchant of Record, we therefore always monitor and proactively prevent our rate coming close to these thresholds. Therefore, we might need to intervene and even suspend your account unless swift and proactive measures are taken to reduce chargebacks to an acceptable industry standard. ## Payout Fees While payouts may incur fees charged by our payout provider (Stripe), Polar does not add any extra fees or markup. These are strictly Stripe's fees, and Polar does not profit from them. In addition, Polar offers manual withdrawals for developers. Keeping you in control of when to issue payouts. *Unless you have a Polar balance that you haven't withdrawn for several months, at which point we'll eventually need to trigger a payout on your behalf.* **Fees (Stripe)** * \$2 per month of active payout(s) * 0.25% + \$0.25 per payout * Cross border fees (currency conversion): 0.25% (EU) - 1% in other countries. ## Volume pricing Large or fast-growing business? The published Scale plan is our cheapest public rate. If you need something custom on top of that, [reach out to us](/docs/support). # Merchant of Record Source: https://polar.sh/docs/merchant-of-record/introduction An open source and transparent Merchant of Record ### What is a Merchant of Record? We take on the liability of international sales taxes globally for you. So you can focus on growing your business vs. accounting bills. Leave billing infrastructure and international sales tax headaches to us. ### Payment Service Providers vs. Merchants of Record **Payment Service Providers (PSPs)** Stripe and other Payment Service Providers (PSPs) offer an accessible and convenient abstraction to faciliate transactions on top of underlying credit card networks & banks. * ✅ Powerful, flexibile & low-level APIs to facilitate transactions * ✅ Can be used to power all business- and pricing models under the sun. * ❌ You are responsible for all liabilities associated with transactions, e.g international taxes * ❌ Low-level APIs require more development even for common use cases **Merchants of Record (MoRs)** Merchants of Record offer yet another layer of convenient abstraction to facilitate digital orders on top of the underlying PSPs and transactions. E.g Polar is built on Stripe (+ more PSPs in the future). * ✅ Higher-level Dashboard, APIs & SDKs to better facilitate digital products, services & orders beyond the underlying transactions * ✅ The platform (Polar) handles international taxes by being a reseller of your digital goods & services. Of course, without being in the way of your relationship with your customers. * ❌ Less flexibility & control in terms of advanced business- and pricing models. * ❌ Higher fees per payment **What should you choose?** **Ship with what you feel comfortable with vs. others tell you to** Just like in programming, abstractions are super helpful to ship faster with fewer low-level concerns, but in exchange for reduced flexibility and higher costs. So what's the right level of abstraction for you? As always, it depends (tm). **Go with Stripe (PSP) if...** * You've already integrated it? Just ship already - we salute builders however they ship * You're comfortable with the Stripe API and prefer absolute control with low-level APIs. * You're looking for the lowest fees possible. * You're fine with handling international taxes yourself (you absolutely can). **Go with Polar (MoR) if...** * You want product-, customer-, order- and subscription management via an intuitive and easy dashboard * You want to offer file downloads, license keys, Discord- and/or private GitHub repository invites with ease - with more built-in automations to come. * You prefer a more high-level API optimized for making monetization easier. We're only getting started here and have some big things coming * You want us to handle international taxes for you ### Polar MoR **We take on the liability of international sales taxes globally for you. So you can focus on building your passion. Leaving billing infrastructure and sales tax headaches to us.** So how does Polar offer a Merchant of Record (MoR) service and handle international sale taxes? All other Merchants of Record simply state they handle it internationally - don't worry about it. We do too. But we believe in transparency and don't want to scare customers into thinking it's impossible to manage it themselves. So below we'll share how exactly we go about doing this. #### International Sales Taxes Most countries, states and jurisdictions globally impose sales taxes on digital goods and services (VAT, GST, US Sales Tax etc). Regardless of whether the merchant (seller) is a resident there or not - they're doing business there. For example, a \$10/month subscription should cost \$12.5/month for a Swedish (25% VAT) consumer, but \$10/month for a Swedish business with VAT registration (reverse charge). Merchants are responsible for 1) capturing & 2) remitting sales taxes to the local tax authorities. What does that mean in our example? 1. **Capturing**. Charging the Swedish consumer \$12.5/month and saving \$2.5/month for the Swedish tax authorities. Stripe Tax is an excellent service to automate this and the one Polar uses today. 2. **Remitting**. Filing & paying the captured sales taxes with the tax authorities on time. Stripe Tax does not do this, i.e the merchant is liable to register, file and pay taxes to local tax authorities. Many jurisdictions, however, don't require this until you reach a certain threshold in terms of sales volume. But others require registration even before the first sale - or after a very low threshold. In addition to having different rates and rules on which goods are taxable and whether they're deductable or not for business customers. For example, United Kingdom and EU countries require upfront registration for international companies, but Texas (United States) does not until you've sold for more than \$500,000 🇺🇸🦅 In short: It's complex and hard. Even large and well-known businesses don't do it perfectly. Arguably, it's almost impossible and at least highly impracticle and expensive to comply perfectly upfront. Many companies even delay compliance as a calculated risk, i.e focus on validating & growing their business with the risk of paying back taxes + penalities later. **PSP (Stripe)** * ✅ Your volume alone is what counts towards international thresholds vs. the MoR platform, i.e customers might not need to pay sales taxes with you, but would via a MoR. * ✅ You can deduct inbound VAT against purchases your business does with VAT * ❌ You're liable for capturing & remitting international sales taxes * ❌ Stripe Tax is great to monitor & automate capturing, but registration and remittance is up to you. **MoR (Polar)** * ✅ We are liable for all of the above as your reseller, i.e we have to worry about it vs. you. * ✅ Offer EU VAT for B2B sales (expected and desired within EU for businesses) without having to register, capture and remit it yourself. * ❌ Sales taxes would be added for more customers vs. with you selling directly * ❌ You cannot leverage inbound VAT towards VAT expense deductions yourself Merchants of Record (MoR) handles sales taxes, e.g US Sales Tax, EU VAT, Canadian GST etc. **However, you're always responsible for your own income/revenue tax** in your country of residency. #### Polar Coverage **We support global payments and take on the liability for international sales taxes on your behalf.** Polar is registered in jurisdictions around the world and works with global accounting firms to monitor sales volumes, register in new markets as thresholds are reached, and handle filings and remittance on an ongoing basis. You don't need to track where you owe taxes, or when — that's our job. **Want to do this yourself?** Selling a lot and want to handle this yourself, i.e worth the ongoing costs? Feel free to reach out and we'd be happy to introduce you to our contacts at the accounting firms we use. We consider MoR a key value-add to Polar, but not the sole reason for Polar to exist. Our ambition is to be the easiest way to monetize for developers. However, we're never going to be the right solution for all use cases. But we'll always salute and help anyone who ships software - regardless of billing platform. ## Frequently Asked Questions > [accordion] Why doesn't my accounting software recognize Polar's EU OSS VAT number (EU372061545)? > > OSS VAT numbers use the `EU` prefix instead of country-specific prefixes (like `IE` for > Ireland). Some accounting software predates the OSS program or lacks support for this format. > You can manually enter the number if your software allows overriding validation, or contact your > software vendor to request OSS number support. # Supported countries Source: https://polar.sh/docs/merchant-of-record/supported-countries ### Payments & Merchant of Record We support payments globally except from countries with US sanctions (Cuba, Russia, Iran, North Korea, and Syria). As your Merchant of Record (MoR) we take on the [liability for international sales taxes](/docs/merchant-of-record/introduction). ### Payouts Polar uses Stripe Connect Express to issue payouts to residents or businesses in any of the countries below. See [Payout Accounts](/docs/features/finance/accounts) for how to connect one. > [!NOTE] > > **FAQ: Stripe isn't available in my country. Can I still use Polar?** > > As the Merchant of Record, Polar takes care of charging customers, so Stripe Payments doesn't need to be available in your country. All you need is to be in a country supported by Stripe Connect Express to receive payouts. > > Stripe Connect Express country coverage is much broader, and includes everywhere listed below. * 🇦🇱 Albania * 🇩🇿 Algeria * 🇦🇴 Angola * 🇦🇬 Antigua and Barbuda * 🇦🇷 Argentina * 🇦🇲 Armenia * 🇦🇺 Australia * 🇦🇹 Austria * 🇦🇿 Azerbaijan * 🇧🇸 Bahamas * 🇧🇭 Bahrain * 🇧🇩 Bangladesh * 🇧🇪 Belgium * 🇧🇯 Benin * 🇧🇹 Bhutan * 🇧🇴 Bolivia * 🇧🇦 Bosnia and Herzegovina * 🇧🇼 Botswana * 🇧🇳 Brunei * 🇧🇬 Bulgaria * 🇰🇭 Cambodia * 🇨🇦 Canada * 🇨🇱 Chile * 🇨🇴 Colombia * 🇨🇷 Costa Rica * 🇭🇷 Croatia * 🇨🇾 Cyprus * 🇨🇿 Czech Republic * 🇩🇰 Denmark * 🇩🇴 Dominican Republic * 🇪🇨 Ecuador * 🇪🇬 Egypt * 🇸🇻 El Salvador * 🇪🇪 Estonia * 🇪🇹 Ethiopia * 🇫🇮 Finland * 🇫🇷 France * 🇬🇦 Gabon * 🇬🇲 Gambia * 🇩🇪 Germany * 🇬🇭 Ghana * 🇬🇷 Greece * 🇬🇹 Guatemala * 🇬🇾 Guyana * 🇭🇰 Hong Kong * 🇭🇺 Hungary * 🇮🇸 Iceland * 🇮🇳 India * 🇮🇩 Indonesia * 🇮🇪 Ireland * 🇮🇱 Israel * 🇮🇹 Italy * 🇨🇮 Ivory Coast * 🇯🇲 Jamaica * 🇯🇵 Japan * 🇯🇴 Jordan * 🇰🇿 Kazakhstan * 🇰🇪 Kenya * 🇰🇼 Kuwait * 🇱🇦 Laos * 🇱🇻 Latvia * 🇱🇮 Liechtenstein * 🇱🇹 Lithuania * 🇱🇺 Luxembourg * 🇲🇴 Macao * 🇲🇬 Madagascar * 🇲🇾 Malaysia * 🇲🇹 Malta * 🇲🇺 Mauritius * 🇲🇽 Mexico * 🇲🇩 Moldova * 🇲🇨 Monaco * 🇲🇳 Mongolia * 🇲🇿 Mozambique * 🇳🇦 Namibia * 🇳🇱 Netherlands * 🇳🇿 New Zealand * 🇳🇪 Niger * 🇳🇬 Nigeria * 🇲🇰 North Macedonia * 🇳🇴 Norway * 🇴🇲 Oman * 🇵🇰 Pakistan * 🇵🇦 Panama * 🇵🇾 Paraguay * 🇵🇪 Peru * 🇵🇭 Philippines * 🇵🇱 Poland * 🇵🇹 Portugal * 🇶🇦 Qatar * 🇷🇴 Romania * 🇷🇼 Rwanda * 🇱🇨 Saint Lucia * 🇸🇲 San Marino * 🇸🇦 Saudi Arabia * 🇸🇳 Senegal * 🇷🇸 Serbia * 🇸🇬 Singapore * 🇸🇰 Slovakia * 🇸🇮 Slovenia * 🇿🇦 South Africa * 🇰🇷 South Korea * 🇪🇸 Spain * 🇱🇰 Sri Lanka * 🇸🇪 Sweden * 🇨🇭 Switzerland * 🇹🇼 Taiwan * 🇹🇿 Tanzania * 🇹🇭 Thailand * 🇹🇹 Trinidad and Tobago * 🇹🇳 Tunisia * 🇹🇷 Turkey * 🇦🇪 United Arab Emirates * 🇬🇧 United Kingdom * 🇺🇸 United States * 🇺🇾 Uruguay * 🇺🇿 Uzbekistan * 🇻🇳 Vietnam ## Frequently Asked Questions > [accordion] Can I use Polar in countries (e.g. India) where Stripe is invite-only? > > \[!NOTE] Stripe Connect Express is a different product than the regular Stripe payments. > Yes, any individual or company operating in our [supported countries](/docs/merchant-of-record/supported-countries) can receive payouts from Polar even if Stripe standalone is invite-only there. > > This is possible as Polar is the Merchant of Record, all payments from customers are made to Polar (US). [Stripe Connect Express](https://docs.stripe.com/connect/express-accounts) is then used to issue payouts, and is supported in more countries via cross-border transfer than Stripe Payments standalone. > > You might still see a warning in Stripe Connect Express that payments are invite-only, but don't worry. No direct sales are made directly to the Stripe Connect Express account. They're all made to Polar (US) as a platform and the merchant of record. We only use the transfer and payout feature of Stripe Connect Express which is available in all of our [supported countries](/docs/merchant-of-record/supported-countries). > [accordion] Can I use Polar as an individual to make sales globally? > > Yes, given that Stripe Connect Express supports individual as a business type in your region. > > To know which business type is supported in your country, follow steps as below: > > * Open required [verification information](https://docs.stripe.com/connect/required-verification-information#US+RS+express+recipient+individual+transfers) by Stripe to set up a business or personal account in your country. > * Ensure `Platform Country` is set to `United States (US)`. > * Ensure `Dashboard Type` is set to `express`. > * Ensure `Service Agreement` is set to `recipient`. > * Ensure `Capability` is set to `transfers`. > * Select the correct `Account Country` relevant to you. > * Click on the toggle for `Business Type` which will allow you know if individual, business, company or LLC/LLP is supported by Stripe Connect Express in that region. # Migrate from Stripe Source: https://polar.sh/docs/migrate Move customers, products, subscriptions, and payment data from Stripe to Polar. Polar currently supports migrations from Stripe. Polar helps you safely migrate customers, products, subscriptions, and payment data. ## Before you begin You need an active Polar organization that is ready to sell, plus access to the Stripe account so you can create API keys. The mode of your Stripe key must match the Polar environment: live for production or test for sandbox. Stripe Connect platform accounts and Stripe accounts in India cannot connect to the automated flow. ## How coexistence works During the migration, your merchant app talks to both billing systems. New customers check out on Polar. Existing subscriptions keep renewing on Stripe until you switch them through Polar. Merchant app Routes each customer Stripe Existing renewals Polar New sales Each subscription has one system responsible for its next renewal. New checkouts go to Polar; Stripe keeps renewing what it already owns until you switch them. ## Migration overview The first and last stages happen in your application. The four stages in the middle match the journey under **Settings → Migrations** in Polar. 1. **Move new sales to Polar** — Polar becomes the billing system for every new customer. 2. **Connect your Stripe account** — Polar gets read and cutover access only. 3. **Assess and import your catalog** — Products and customers land in Polar; billing stays on Stripe. 4. **Move saved cards** — Stripe copies cards to Polar for renewals after the switch. 5. **Switch billing to Polar** — Selected subscriptions stop renewing on Stripe and continue on Polar. 6. **Reconcile and clean up** — Confirm your application data is correct, then complete the cleanup. The sections below walk through each stage in full. ## 1. Move new sales to Polar **Goal:** Make Polar the billing system for every new customer. Integrate the [Polar API](/docs/api-reference) and [webhooks](/docs/integrate/webhooks/endpoints) into your application. New checkouts create their orders and subscriptions in Polar. Existing Stripe subscriptions continue renewing in Stripe. | Customer type | Checkout | Next renewal | | - | - | - | | New signup | Polar | Polar | | Existing Stripe subscriber | Unchanged | Stripe | Set `external_customer_id` to your stable application customer ID when creating a checkout. Polar stores it as the customer's `external_id`, making it easy to map your IDs to Polar once and look up the customer later. Keep Stripe IDs in your database while subscriptions still renew there. **Continue when:** You have tested a complete purchase. ## 2. Connect your Stripe account **Goal:** Give Polar only the access needed to prepare and perform the migration. Create a restricted API key in Stripe and add it to your migration in Polar. The Polar dashboard asks for the minimum permissions needed to read and migrate your billing data, then validates the account before continuing. Nothing has moved yet. Stripe still owns every existing subscription. **Continue when:** Polar shows the Stripe account as connected. ## 3. Assess and import your catalog **Goal:** Decide what can move and prepare the records those subscriptions need in Polar. Polar assesses your recurring products, prices, customers, and subscriptions. You review what is ready and what needs attention, then import your selection. | After import | In Polar | Still renews in | | - | - | - | | Products and prices | Created | — | | Customers | Created or reused | — | | Subscriptions you plan to switch | Not created yet | Stripe | | Unsupported subscriptions | Left alone | Stripe | Polar does not create Polar subscriptions or change Stripe billing at this stage. Leave unsupported subscriptions on Stripe until you resolve them or choose another path. **Continue when:** You are clear on which subscriptions and related data will be imported. ## 4. Move saved cards **Goal:** Give Polar a payment method for the subscriptions it will renew. Follow the checklist in Polar to start an account-to-account copy in Stripe. Stripe sends saved card details directly to Polar's payment processor. They never pass through your application or the migration interface. **Continue when:** Stripe has completed the card copy. Sandbox can verify application behavior, but real card copies require live Stripe accounts. See **Saved card transfer** under [Migration details](#migration-details) for timing and the `migreq_…` ID. ## 5. Switch billing to Polar **Goal:** Make Polar responsible for future renewals of the subscriptions you select. Polar rechecks each selected subscription, prepares its matching Polar subscription, stops it on Stripe, and activates it in Polar with the same paid period. The next renewal happens in Polar; the customer is not charged again for time they already paid for. Polar handles both sides of the switch. Do not manually activate a matching Polar subscription, as this can cause double billing. What changes when a subscription switches If a subscription renews within 24 hours, Polar leaves it on Stripe to avoid a billing conflict and give you time to react if something goes wrong. A subscription set to cancel at the end of its period moves even if that end is within 24 hours: Polar keeps the end and does not renew it. A subscription set to end on any other date stays on Stripe. At the next renewal after a successful switch, Polar attempts to charge the copied card. If a payment method is missing, the renewal fails and Polar emails the customer to add their card again. ### Communications during the switch Polar stops each subscription on Stripe by canceling it immediately, without proration or a final invoice. Stripe and your own systems treat that as a regular cancellation, so prepare them before you switch: * **Stripe cancellation emails.** If Stripe emails customers when a subscription is canceled, every switched customer receives one. Turn off the canceled subscription email in **Settings → Billing → Subscriptions and emails**, under **Email notifications and customer management**, and pause any Billing automation triggered by **Subscription is canceled**. Polar cannot turn these off for you. * **Your `customer.subscription.deleted` handling.** Make sure it does not revoke access or send a cancellation email for switched subscriptions. Their `cancellation_details.comment` starts with `Migrated to Polar`. Stripe sends this event right away, even for a subscription set to cancel at the end of its period, so do not end access early. * **Tools connected to Stripe.** Churn, analytics, and retention tools report the cancellation as churn and can start win-back emails. Polar does not send a dedicated email about the switch. It only adds a short notice to the first billing emails a customer receives from Polar, such as their first renewal, saying that billing has moved from Stripe to Polar. If you want them to hear about the move from you first, send your own notice before switching. Turn Stripe's cancellation emails back on and resume any paused cancellation automations after the switch if subscriptions remain on Stripe. **Continue when:** Every selected subscription shows as moved, skipped, or failed, and every subscription left on Stripe has a clear next action. > [!WARNING] > > Switching is not reversible. Review your selection before confirming it. ## 6. Reconcile and clean up **Goal:** Remove the old billing paths without losing access to historical records. Compare the migration result with your own customer and access records. Confirm that each subscription bills in only one place. Retire Stripe checkout and subscription processing only when no subscriptions remain there. If exceptions still live on Stripe, keep the webhooks, scheduled jobs, and secrets they need. **Done when:** * New sales and moved subscriptions are managed in Polar * Any exceptions are intentionally managed in Stripe, with their required processing still running * Your team knows where to handle support, refunds, and reporting Keep your Stripe account available for past transactions. Historical Stripe payments do not become Polar orders. ## What customers experience Most customers do not need to take action. Their current paid period remains unchanged, and their next renewal happens in Polar after the switch. For a subscription in a trial, Polar keeps the trial end date and takes over billing when the trial ends. Polar sends nothing when a subscription switches. Polar's billing emails, such as a renewal reminder or the first renewal receipt, explain that billing has moved from Stripe to Polar and that Stripe will no longer bill them. Stripe may send its own cancellation email unless you turn it off first. See [Communications during the switch](#communications-during-the-switch). If Polar cannot charge a card at renewal, the payment fails and the customer receives an email asking them to add their card again. A copied card can still fail for the same reasons as any other card. Customers continue to find receipts, refunds, and disputes for past Stripe payments through the experience you already provide. Polar only creates orders for payments it processes. ## Migration details > [accordion] Subscriptions that need attention > > Polar shows why a record cannot move automatically. Common examples include: > > * Multiple subscription items or a quantity greater than one > * Products without a supported recurring price in your organization's > default currency, or with ambiguous prices > * Past-due, unpaid, or paused subscriptions > * Subscriptions sold through Stripe Managed Payments. These are not moved > yet and keep renewing on Stripe. > > A subscription that is not ready stays on Stripe. Resolve the issue and retry > it later, or keep it renewing on Stripe. > > Unsupported pricing should not block your migration. Polar can adapt to new > pricing models, so if some of your prices cannot be migrated, > [contact Polar support](/docs/support). > > Polar also rechecks subscriptions during the switch. Subscriptions due to > renew within 24 hours, or set to end on a date other than their period end, > remain on Stripe at that point. A subscription set to cancel at the end of > its period does not renew, so it moves even if that end is within 24 hours. > > Only cards are used. A subscription paying with another method, such as > Link, SEPA Direct Debit, or a US bank account (ACH), still moves, but Polar > does not charge that method. It renews with another copied card for the same customer if there is > one. Otherwise its first Polar renewal fails and the customer is asked to add > a card. > [accordion] Saved card transfer > > Only the owner of your Stripe account can start the account-to-account copy. > In Polar, download the customer mapping file and copy the provided destination > account ID into Stripe. After starting the copy, paste the Stripe migration > ID (`migreq_…`) into Polar. > > Polar usually accepts the request within one business day. Stripe then moves > the card data, usually within a few hours and sometimes up to 72 hours. > [accordion] Finished and inactive migrations > > Polar deletes the Stripe API key it stored when a migration ends: > > * **Completed:** the switch finished, with every subscription moved, > skipped, or failed. > * **Closed:** the migration had no activity for 90 days. Polar also removes > the records still waiting to be imported. Skipped and failed records are > kept. > > The key stays active in Stripe, so revoke it there if you no longer need > it. You can no longer switch subscriptions from a completed or closed > migration. To move subscriptions still on Stripe, start a new migration. > [accordion] Checklist for your application > > Every integration is different. Before removing your Stripe code, confirm: > > * Which internal user or account maps to each Polar customer > * Which webhook grants, changes, and revokes access > * Where support looks up purchases made before and after the migration > * Which system handles refunds and disputes for each transaction > * Whether any job still creates Stripe Checkout Sessions, invoices, or > subscriptions > * How you monitor subscriptions intentionally left on Stripe > > Your application remains responsible for mapping customers and translating > billing events into access to your product. ## Coding assistant prompt Optional. If you use a coding assistant that can inspect your repository, expand the prompt below. It asks for a migration plan and reconciliation contract before any code changes. Review that plan before asking it to implement anything. Never paste Stripe or Polar secrets into a conversation. ```markdown title="Migration assistant prompt" icon="wand-magic-sparkles" expandable theme={null} # Plan a safe Stripe-to-Polar migration You are a senior payments integration engineer helping migrate this application from Stripe to Polar. Work from the codebase in the current directory and current Polar documentation. Do not rely on memory for Polar API details. First produce a migration plan and reconciliation contract. Do not change code, create resources, cancel subscriptions, or start a cutover until the user reviews and approves that plan. ## Objective Design a progressive migration in which: 1. New sales use Polar first. 2. Existing Stripe subscriptions keep renewing in Stripe while products and customers are imported into Polar. 3. Saved cards move through Stripe's secure account-to-account process. 4. Selected subscriptions switch through Polar's migration flow. 5. Each subscription has exactly one system responsible for its next renewal. 6. The application can reconcile customers, subscriptions, orders, access, and historical transactions across both systems. ## Sources of truth Before recommending an endpoint, SDK method, webhook, field, or scope: 1. Read https://polar.sh/docs/migrate. 2. For JavaScript or TypeScript, read: https://raw.githubusercontent.com/polarsource/agent-toolkit/main/skills/polar-integration/SKILL.md For other languages, use the current language SDK and OpenAPI docs. 3. Use https://polar.sh/docs/llms.txt to find the current API reference page for every Polar operation you recommend. 4. Inspect installed Polar SDK types when available. Current documentation and generated SDK types override this prompt and your training data. If you cannot verify an API detail, label it as unverified and ask for the missing context. Never invent IDs, URLs, fields, event names, or capabilities. Merchant migration REST endpoints exist under `/v1/merchant-migrations`, but are excluded from Polar's public OpenAPI schema, SDKs, and API reference. They are dashboard-internal, not a merchant integration API. Use **Settings → Migrations** for assessment, card transfer, and cutover. ## Safety rules - Never expose, print, log, or commit Stripe or Polar secrets. - Never ask the user to paste secrets into chat. - Never handle raw card data. - Never stop, cancel, or pause Stripe billing, or activate a migrated Polar subscription, outside Polar's switch. Refuse DIY cutover scripts. - Never treat webhooks as exactly-once delivery. Verify signatures, persist the Standard Webhooks `webhook-id`, and make handlers idempotent. - Never use email as the durable cross-system identity. - Never overwrite a Polar Customer `external_id`. It is unique within an organization and cannot be changed once set. - Never store card details, secrets, or sensitive personal data in metadata. - Historical Stripe payments remain in Stripe. Never manufacture Polar orders for transactions Polar did not process. - Stripe Connect platform accounts and Stripe accounts in India cannot use the automated flow. Direct those merchants to Polar support. - Subscriptions sold through Stripe Managed Payments are not moved yet and stay on Stripe. - Unsupported pricing is not a dead end. Polar can adapt to new pricing models; direct merchants with prices that cannot be migrated to Polar support. - Switching is irreversible. Subscriptions renewing within about 24 hours stay on Stripe to avoid a billing conflict. Subscriptions set to cancel at the end of their period do not renew, so they move. - Real card copies require live Stripe accounts. Sandbox verifies application behavior but cannot copy real cards. - The Stripe key mode must match Polar: live for production, test for sandbox. Use only the restricted permissions in the current migration guide. ## Phase 1: discover the current integration Inspect and report: - Framework, language, package manager, apps, and deployment boundaries - Authentication and the canonical user, account, workspace, or tenant ID - Whether billing belongs to a person, a team, or both - Stripe checkout, portal, customer, subscription, product, price, webhook, scheduled-job, and entitlement code - Database tables that store Stripe IDs or billing state - Webhook verification, deduplication, retries, and dead-letter behavior - How the application grants and revokes access - Which system owns refunds, disputes, cancellations, invoices, and support - Trials, discounts, quantities, multiple items, manual invoices, metered prices, pauses, non-card methods, or Connect accounts Search for Stripe SDK calls, environment variables, webhook event strings, provider IDs, and access checks. Ask only what the repository cannot answer. Resolve these questions before proposing changes: 1. What immutable internal ID represents the billable customer? 2. Can one customer have multiple Stripe customers or subscriptions? 3. Must access continue when either Stripe or Polar owns the subscription? 4. Which subscriptions should remain on Stripe? 5. Is this Polar sandbox or production? ## Phase 2: define the identity contract Use the application's immutable billable-customer ID as the Polar Customer `external_id`. For new Checkout Sessions, pass that value as `external_customer_id`; the resulting Customer exposes it as `external_id`. Do not use a Stripe customer ID unless it is already the application's canonical identity. For new Polar checkouts: - Send `external_customer_id`. - Use checkout `metadata` only for values belonging on the resulting order or subscription. - Use `customer_metadata` only for values belonging on the customer. - Prefer stable keys such as `app_account_id`, `migration_batch_id`, and `source_system`. - Keep canonical relationships in the application database. Metadata is context, not the primary relational store. During preparation, Polar creates or reuses a Polar Customer for each selected Stripe customer and associates the Stripe customer ID internally for the card copy. Polar cannot infer the application's own customer ID. If the application needs that mapping, match the imported customer once using an exact, unique email and then set the application's canonical ID as the Polar Customer `external_id`. Require review for missing, duplicate, or changed emails. For a Polar Customer whose `external_id` is null, verify the current API and set it to the application's canonical ID through `PATCH /v1/customers/{id}`. Then use the external-ID lookup and state endpoints. Never overwrite an existing external ID. Treat skipped customers and Stripe-ID conflicts as unresolved. Never assume a completed import mapped every selected customer. Adapt the following mapping model to the existing database instead of creating duplicate tables. ### Billing customer map - Canonical application customer ID - Stripe customer ID - Polar customer ID and external ID - Verification timestamp ### Billing catalog map - Canonical internal plan or SKU - Stripe product and price IDs, paired with the Polar product and price IDs created during preparation - Interval, currency, and amount used for verification - Verification timestamp Preparation creates new Polar products and prices for the subscriptions you select. Before changing application configuration, verify that every internal plan or SKU points to the correct new Polar product and price IDs. Imported products do not publicly expose their source Stripe IDs, so ask for the mapping when it is not available in the codebase. Never join catalogs by name alone. ### Billing subscription map - Canonical internal subscription or entitlement ID - Stripe and Polar subscription IDs - Polar subscription metadata: `provider = stripe` and `provider_subscription_id = ` - System that will charge the subscription next: Stripe or Polar - Current period boundaries, migration result, last verification, and last error ### Webhook receipt - Provider and environment - Standard Webhooks `webhook-id` with a unique constraint - Event type and object ID - Received, processed, and failed timestamps - Attempt count and last error Never deduplicate on `data.id`; it identifies the resource, so legitimate updates can share it. ## Phase 3: recommend Polar integration points Verify exact paths, SDK methods, and scopes in current docs before generating code. Recommend only what the application needs. ### New checkout path - Create Polar Checkout Sessions through the current Checkout API or SDK. - Pass `external_customer_id`, checkout `metadata`, and `customer_metadata` according to the identity contract. - Redirect to Polar's hosted checkout URL. ### Customer lookup and access - Get Customer and Customer State by external ID after mapping. - Update by Polar ID only when assigning an external ID for the first time. - Expect `customers:read` for lookup and `customers:write` for mapping, but verify current scopes. ### Webhooks Select the smallest event set that fits the access model: - `customer.state_changed` for consolidated subscriptions and benefits - `order.paid` for successful fulfillment - `order.refunded` for refund-driven behavior - `subscription.updated` as a catch-all, or narrower lifecycle events when distinct transitions matter - `benefit_grant.created`, `benefit_grant.updated`, and `benefit_grant.revoked` only when Polar benefits directly drive access Never treat `checkout.created` or `order.created` as proof of payment. Avoid granting the same entitlement from several events unless one idempotent domain operation owns the decision. Every handler needs signature verification, `webhook-id` deduplication, object-level idempotency, out-of-order handling, retries, dead-letter behavior, safe logging, and an API reconciliation fallback. Migration never looks like a new sale. Importing the catalog creates products, discounts, and customers without `product.created`, discount, `customer.created`, or `member.created` webhooks. During import and card mapping, you can receive `customer.updated`, each followed by `customer.state_changed`: - when the import fills in billing details or the Stripe customer ID on a customer you already had in Polar - when you edit a customer's billing address during review - when Polar sets a copied card as a customer's default payment method. Link, SEPA Direct Debit, ACH, and other non-card methods are never used, so they never set a default or trigger this event. These events reflect customer data, not a switch. Do not grant access or record Polar as the billing system from them; `subscription.migrated` is the only cutover signal. At migration cutover, for each subscription, expect: - `subscription.updated` when the imported subscription activates - `subscription.migrated` with `provider` and `provider_subscription_id` to match the Polar subscription to its source - `customer.state_changed` asynchronously after activation - Relevant `benefit_grant.*` events, if you attached benefits to the imported products. Seat-based products grant benefits only when seats are claimed. - `customer.updated` if the cutover sets the copied card as the default - Stripe `customer.subscription.deleted` when Polar cancels the source subscription. Its `cancellation_details.comment` starts with `Migrated to Polar`. The Stripe cancellation is immediate, without proration or a final invoice, so `customer.subscription.deleted` is the expected Stripe subscription lifecycle event. Other Stripe events can still arrive depending on the account's configuration. Do not expect `subscription.created`, `subscription.active`, or `subscription.resumed` from migration, and do not invent a `merchant_migration.*` webhook. A subscription set to cancel at the end of its period arrives with `cancel_at_period_end` and `ends_at` set, but without a `subscription.canceled` event: it was already canceled on Stripe. At its end, Polar sends `subscription.canceled` and `subscription.revoked` as usual. After cutover, a moved subscription renews like any other Polar subscription and sends the usual [renewal events](/integrate/webhooks/events#renewal-sequences). None of these lists is in delivery order. At cutover, Polar enqueues `subscription.updated` before `subscription.migrated`, but retries can reorder them, and Stripe and Polar events can arrive in either order. Do not treat the Stripe cancellation as ordinary churn or revoke access while its matching migration is still being reconciled. ## Phase 4: design coexistence and reconciliation Record which system will charge each subscription next. Never infer this only from non-null IDs. Before cutover: - New customers use Polar. - Existing subscriptions keep billing on Stripe. - Access can accept a valid entitlement from either provider. - Route cancel, pause, resume, and plan changes to the system currently billing the subscription. During cutover: - Do not make plan, cancellation, pause, or resume changes while the selected subscription is switching. - Use Polar's migration UI. - Do not record Polar as the system that will charge next from intent alone. - Verify that the application references the Polar product and price created during preparation before accepting the cutover result. - Treat `subscription.migrated` as the cutover signal. Match its `provider_subscription_id` to the source Stripe subscription, then reconcile with the public Subscriptions API. - Handle `subscription.migrated` as an idempotent upsert that stores the Polar subscription ID. Do not grant or revoke access, and do not send a welcome or cancellation email. - Compare status and current period boundaries before recording Polar as the system that will charge next. - Keep skipped or failed subscriptions billing on Stripe. After cutover: - Reconcile counts and IDs across the application, Stripe, and Polar. - Verify no moved subscription can renew in Stripe. - Verify every Polar subscription maps to one customer and entitlement. - Verify paid periods, trial ends, and payment-method coverage. The migration dashboard is the operational view for the whole batch. `subscription.migrated` is the definitive application signal for each successfully cut-over subscription. See [Migration Sequences](/integrate/webhooks/events#migration-sequences). ## Phase 5: define cleanup gates Do not delete Stripe code because the first batch moved. Require: - No new Stripe Checkout Sessions - Exactly one billing system recorded per subscription - No moved Stripe subscription still renewable - Both providers' webhooks understood during coexistence - Scheduled jobs routed to the correct billing system or safely retired - Support able to find transactions from either era - Historical Stripe refunds and disputes still routed to Stripe - Stripe history retained for accounting - Credentials revoked only after final reconciliation ## Required output Return: 1. Current architecture with file paths 2. Unknowns and blockers 3. Identity and catalog maps 4. Metadata contract 5. Endpoint plan with verified reference, scope, call site, and purpose 6. Webhook plan with local transition, idempotency key, and recovery 7. Phased implementation and cutover gates 8. Schema changes, backfills, uniqueness constraints, and rollback 9. Automated, sandbox, reconciliation, and failure testing 10. Risks: double billing, duplicate access, conflicts, missing cards, stale events, and premature cleanup Label every recommendation as: - **Observed** in this repository - **Documented** in current Polar docs or SDK types - **Proposed** End with the smallest safe implementation slice. Wait for approval before editing code or changing billing state. ``` Need help planning the migration? [Contact Polar support](/docs/support). # polar discounts Source: https://polar.sh/docs/integrate/cli/reference/discounts ```bash theme={null} polar discounts [flags] ``` **Subcommands** * [`polar discounts create`](#polar-discounts-create) Create a discount. * [`polar discounts delete`](#polar-discounts-delete) Delete a discount. * [`polar discounts get`](#polar-discounts-get) Get a discount by ID. * [`polar discounts list`](#polar-discounts-list) List discounts. * [`polar discounts update`](#polar-discounts-update) Update a discount. ## polar discounts create Create a discount. ```bash theme={null} polar discounts create [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--metadata` | `string` | Key-value object allowing you to store additional information. JSON: \{"\": string \| integer \| number \| boolean} | | `--name` | `string` | Required. Name of the discount. Will be displayed to the customer when the discount is applied. | | `--code` | `string` | Code customers can use to apply the discount during checkout. Must be between 3 and 256 characters long and contain only alphanumeric characters.If not provided, the discount can only be applied via the API. | | `--starts-at` | `string` | Optional timestamp after which the discount is redeemable. | | `--ends-at` | `string` | Optional timestamp after which the discount is no longer redeemable. | | `--max-redemptions` | `integer` | Optional maximum number of times the discount can be redeemed. | | `--max-redemptions-per-customer` | `integer` | Optional maximum number of times the discount can be redeemed by a single customer. | | `--products` | `string` | products | | `--organization-id`, `--org` | `string` | The ID of the organization owning the discount. Defaults to the active organization. | | `--type` | `choice` | type (choices: fixed, percentage) | | `--duration` | `choice` | Required. For subscriptions, determines if the discount should be applied once on the first invoice, forever, or for a certain number of months determined by `duration_in_months`. (choices: once, forever, repeating) | | `--duration-in-months` | `integer` | Number of months the discount should be applied. | | `--amount` | `integer` | amount | | `--currency` | `choice` | currency (choices: aed, all, amd, aoa, ars, aud, awg, azn, bam, bbd, bdt, bif, bmd, bnd, bob, brl, bsd, bwp, bzd, cad, cdf, chf, clp, cny, cop, crc, cve, czk, djf, dkk, dop, dzd, egp, etb, eur, fjd, fkp, gbp, gel, gip, gmd, gnf, gtq, gyd, hkd, hnl, htg, huf, idr, ils, inr, isk, jmd, jpy, kes, kgs, khr, kmf, krw, kyd, kzt, lak, lkr, lrd, lsl, mad, mdl, mga, mkd, mnt, mop, mur, mvr, mwk, mxn, myr, mzn, nad, ngn, nio, nok, npr, nzd, pab, pen, pgk, php, pkr, pln, pyg, qar, ron, rsd, rwf, sar, sbd, scr, sek, sgd, shp, sos, srd, szl, thb, tjs, top, try, ttd, twd, tzs, uah, ugx, usd, uyu, uzs, vnd, vuv, wst, xaf, xcd, xcg, xof, xpf, yer, zar, zmw) | | `--amounts` | `string` | amounts JSON: \{"\": integer} | | `--basis-points` | `integer` | Discount percentage in basis points. | ## polar discounts delete Delete a discount. ```bash theme={null} polar discounts delete [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--confirm`, `-c` | `boolean` | Skip the confirmation prompt for destructive requests | ## polar discounts get Get a discount by ID. ```bash theme={null} polar discounts get [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar discounts list List discounts. ```bash theme={null} polar discounts list [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--organization-id`, `--org` | `string` | Filter by organization ID. Defaults to the active organization. | | `--query` | `string` | Filter by name. | | `--page` | `integer` | Page number, defaults to 1. | | `--limit` | `integer` | Size of a page, defaults to 10. Maximum is 100. | | `--sorting` | `choice` | Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. (choices: created_at, -created_at, name, -name, code, -code, redemptions_count, -redemptions_count, ends_at, -ends_at) | ## polar discounts update Update a discount. ```bash theme={null} polar discounts update [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--metadata` | `string` | Key-value object allowing you to store additional information. JSON: \{"\": string \| integer \| number \| boolean} | | `--name` | `string` | name | | `--code` | `string` | Code customers can use to apply the discount during checkout. Must be between 3 and 256 characters long and contain only alphanumeric characters.If not provided, the discount can only be applied via the API. | | `--starts-at` | `string` | Optional timestamp after which the discount is redeemable. | | `--ends-at` | `string` | Optional timestamp after which the discount is no longer redeemable. | | `--max-redemptions` | `integer` | Optional maximum number of times the discount can be redeemed. | | `--max-redemptions-per-customer` | `integer` | Optional maximum number of times the discount can be redeemed by a single customer. | | `--duration` | `choice` | duration (choices: once, forever, repeating) | | `--duration-in-months` | `integer` | duration_in_months | | `--type` | `choice` | type (choices: fixed, percentage) | | `--amount` | `integer` | amount | | `--currency` | `choice` | currency (choices: aed, all, amd, aoa, ars, aud, awg, azn, bam, bbd, bdt, bif, bmd, bnd, bob, brl, bsd, bwp, bzd, cad, cdf, chf, clp, cny, cop, crc, cve, czk, djf, dkk, dop, dzd, egp, etb, eur, fjd, fkp, gbp, gel, gip, gmd, gnf, gtq, gyd, hkd, hnl, htg, huf, idr, ils, inr, isk, jmd, jpy, kes, kgs, khr, kmf, krw, kyd, kzt, lak, lkr, lrd, lsl, mad, mdl, mga, mkd, mnt, mop, mur, mvr, mwk, mxn, myr, mzn, nad, ngn, nio, nok, npr, nzd, pab, pen, pgk, php, pkr, pln, pyg, qar, ron, rsd, rwf, sar, sbd, scr, sek, sgd, shp, sos, srd, szl, thb, tjs, top, try, ttd, twd, tzs, uah, ugx, usd, uyu, uzs, vnd, vuv, wst, xaf, xcd, xcg, xof, xpf, yer, zar, zmw) | | `--amounts` | `string` | amounts JSON: \{"\": integer} | | `--basis-points` | `integer` | basis_points | | `--products` | `string` | products | # polar event_types Source: https://polar.sh/docs/integrate/cli/reference/event_types ```bash theme={null} polar event_types [flags] ``` **Subcommands** * [`polar event_types list`](#polar-event_types-list) List event types with aggregated statistics. * [`polar event_types update`](#polar-event_types-update) Update an event type's label. ## polar event_types list List event types with aggregated statistics. ```bash theme={null} polar event_types list [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--organization-id`, `--org` | `string` | Filter by organization ID. Defaults to the active organization. | | `--customer-id` | `string` | Filter by customer ID. | | `--external-customer-id` | `string` | Filter by external customer ID. | | `--query` | `string` | Query to filter event types by name or label. | | `--root-events` | `boolean` | When true, only return event types with root events (parent_id IS NULL). | | `--parent-id` | `string` | Filter by specific parent event ID. | | `--source` | `choice` | Filter by event source (system or user). (choices: system, user) | | `--page` | `integer` | Page number, defaults to 1. | | `--limit` | `integer` | Size of a page, defaults to 10. Maximum is 100. | | `--sorting` | `choice` | Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. (choices: name, -name, label, -label, occurrences, -occurrences, first_seen, -first_seen, last_seen, -last_seen) | ## polar event_types update Update an event type's label. ```bash theme={null} polar event_types update [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--label` | `string` | Required. The label for the event type. | | `--label-property-selector` | `string` | Property path to extract dynamic label from event metadata (e.g., 'subject' or 'metadata.subject'). | # polar events Source: https://polar.sh/docs/integrate/cli/reference/events ```bash theme={null} polar events [flags] ``` **Subcommands** * [`polar events get`](#polar-events-get) Get an event by ID. * [`polar events list_names`](#polar-events-list_names) List event names. ## polar events get Get an event by ID. ```bash theme={null} polar events get [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar events list_names List event names. ```bash theme={null} polar events list_names [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--organization-id`, `--org` | `string` | Filter by organization ID. Defaults to the active organization. | | `--customer-id` | `string` | Filter by customer ID. | | `--external-customer-id` | `string` | Filter by external customer ID. | | `--source` | `choice` | Filter by event source. (choices: system, user) | | `--query` | `string` | Query to filter event names. | | `--page` | `integer` | Page number, defaults to 1. | | `--limit` | `integer` | Size of a page, defaults to 10. Maximum is 100. | | `--sorting` | `choice` | Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. (choices: name, -name, occurrences, -occurrences, first_seen, -first_seen, last_seen, -last_seen) | # polar files Source: https://polar.sh/docs/integrate/cli/reference/files ```bash theme={null} polar files [flags] ``` **Subcommands** * [`polar files delete`](#polar-files-delete) Delete a file. * [`polar files list`](#polar-files-list) List files. ## polar files delete Delete a file. ```bash theme={null} polar files delete [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--confirm`, `-c` | `boolean` | Skip the confirmation prompt for destructive requests | ## polar files list List files. ```bash theme={null} polar files list [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--organization-id`, `--org` | `string` | Filter by organization ID. Defaults to the active organization. | | `--ids` | `string` | Filter by file ID. | | `--page` | `integer` | Page number, defaults to 1. | | `--limit` | `integer` | Size of a page, defaults to 10. Maximum is 100. | # polar license_keys Source: https://polar.sh/docs/integrate/cli/reference/license_keys ```bash theme={null} polar license_keys [flags] ``` **Subcommands** * [`polar license_keys get`](#polar-license_keys-get) Get a license key. * [`polar license_keys get_activation`](#polar-license_keys-get_activation) Get a license key activation. * [`polar license_keys list`](#polar-license_keys-list) Get license keys connected to the given organization & filters. * [`polar license_keys rotate`](#polar-license_keys-rotate) Rotate a license key. * [`polar license_keys update`](#polar-license_keys-update) Update a license key. ## polar license_keys get Get a license key. ```bash theme={null} polar license_keys get [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar license_keys get_activation Get a license key activation. ```bash theme={null} polar license_keys get_activation [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | | `activation_id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar license_keys list Get license keys connected to the given organization & filters. ```bash theme={null} polar license_keys list [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--organization-id`, `--org` | `string` | Filter by organization ID. Defaults to the active organization. | | `--benefit-id` | `string` | Filter by benefit ID. | | `--status` | `choice` | Filter by license key status. (choices: granted, revoked, disabled) | | `--page` | `integer` | Page number, defaults to 1. | | `--limit` | `integer` | Size of a page, defaults to 10. Maximum is 100. | ## polar license_keys rotate Rotate a license key. ```bash theme={null} polar license_keys rotate [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--confirm`, `-c` | `boolean` | Skip the confirmation prompt for destructive requests | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar license_keys update Update a license key. ```bash theme={null} polar license_keys update [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--confirm`, `-c` | `boolean` | Skip the confirmation prompt for destructive requests | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--status` | `choice` | status (choices: granted, revoked, disabled) | | `--usage` | `integer` | usage | | `--limit-activations` | `integer` | limit_activations | | `--limit-usage` | `integer` | limit_usage | | `--expires-at` | `string` | expires_at | # polar meters Source: https://polar.sh/docs/integrate/cli/reference/meters ```bash theme={null} polar meters [flags] ``` **Subcommands** * [`polar meters create`](#polar-meters-create) Create a meter. * [`polar meters get`](#polar-meters-get) Get a meter by ID. * [`polar meters get_external`](#polar-meters-get_external) Get a meter by external ID. (preview, API 2027-01) * [`polar meters list`](#polar-meters-list) List meters. * [`polar meters quantities`](#polar-meters-quantities) Get quantities of a meter over a time period. * [`polar meters update`](#polar-meters-update) Update a meter. ## polar meters create Create a meter. ```bash theme={null} polar meters create [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--metadata` | `string` | Key-value object allowing you to store additional information. JSON: \{"\": string \| integer \| number \| boolean} | | `--name` | `string` | Required. The name of the meter. Will be shown on customer's invoices and usage. | | `--unit` | `choice` | The unit of the meter. (choices: scalar, token, custom) | | `--custom-label` | `string` | The label for the custom unit, e.g. 'request'. Required when unit is 'custom'. | | `--custom-multiplier` | `integer` | The multiplier to convert from the base unit to display scale, e.g. 1000 to display per 1000 units. Defaults to 1 when not provided. | | `--filter` | `string` | Required. The filter to apply on events that'll be used to calculate the meter. JSON: \{"conjunction": "and" \| "or", "clauses": array of (\{"property": string, "operator": "eq" \| "ne" \| "gt" \| "gte" \| "lt" \| ..., "value": string \| integer \| boolean} \| \{"conjunction": "and" \| "or", "clauses": array of \{...}})} | | `--aggregation` | `string` | Required. The aggregation to apply on the filtered events to calculate the meter. JSON: \{"func": "count"} \| \{"func": "sum" \| "max" \| "min" \| "avg", "property": string} \| \{"func": "unique", "property": string} | | `--organization-id`, `--org` | `string` | The ID of the organization owning the meter. Defaults to the active organization. | ## polar meters get Get a meter by ID. ```bash theme={null} polar meters get [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar meters get_external Get a meter by external ID. (preview, API 2027-01) ```bash theme={null} polar meters get_external [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `external_id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar meters list List meters. ```bash theme={null} polar meters list [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--organization-id`, `--org` | `string` | Filter by organization ID. Defaults to the active organization. | | `--query` | `string` | Filter by name. | | `--is-archived` | `boolean` | Filter on archived meters. | | `--page` | `integer` | Page number, defaults to 1. | | `--limit` | `integer` | Size of a page, defaults to 10. Maximum is 100. | | `--sorting` | `choice` | Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. (choices: created_at, -created_at, name, -name) | | `--metadata` | `string` | Filter by metadata key-value pairs. JSON: \{"\": string \| integer \| boolean \| array of string \| array of integer \| array of boolean} | ## polar meters quantities Get quantities of a meter over a time period. ```bash theme={null} polar meters quantities [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--start-timestamp` | `string` | Required. Start timestamp. | | `--end-timestamp` | `string` | Required. End timestamp. | | `--interval` | `choice` | Required. Interval between two timestamps. (choices: year, month, week, day, hour) | | `--timezone` | `choice` | Timezone to use for the timestamps. Default is UTC. (choices: Africa/Abidjan, Africa/Accra, Africa/Addis_Ababa, Africa/Algiers, Africa/Asmara, Africa/Asmera, Africa/Bamako, Africa/Bangui, Africa/Banjul, Africa/Bissau, Africa/Blantyre, Africa/Brazzaville, Africa/Bujumbura, Africa/Cairo, Africa/Casablanca, Africa/Ceuta, Africa/Conakry, Africa/Dakar, Africa/Dar_es_Salaam, Africa/Djibouti, Africa/Douala, Africa/El_Aaiun, Africa/Freetown, Africa/Gaborone, Africa/Harare, Africa/Johannesburg, Africa/Juba, Africa/Kampala, Africa/Khartoum, Africa/Kigali, Africa/Kinshasa, Africa/Lagos, Africa/Libreville, Africa/Lome, Africa/Luanda, Africa/Lubumbashi, Africa/Lusaka, Africa/Malabo, Africa/Maputo, Africa/Maseru, Africa/Mbabane, Africa/Mogadishu, Africa/Monrovia, Africa/Nairobi, Africa/Ndjamena, Africa/Niamey, Africa/Nouakchott, Africa/Ouagadougou, Africa/Porto-Novo, Africa/Sao_Tome, Africa/Timbuktu, Africa/Tripoli, Africa/Tunis, Africa/Windhoek, America/Adak, America/Anchorage, America/Anguilla, America/Antigua, America/Araguaina, America/Argentina/Buenos_Aires, America/Argentina/Catamarca, America/Argentina/ComodRivadavia, America/Argentina/Cordoba, America/Argentina/Jujuy, America/Argentina/La_Rioja, America/Argentina/Mendoza, America/Argentina/Rio_Gallegos, America/Argentina/Salta, America/Argentina/San_Juan, America/Argentina/San_Luis, America/Argentina/Tucuman, America/Argentina/Ushuaia, America/Aruba, America/Asuncion, America/Atikokan, America/Atka, America/Bahia, America/Bahia_Banderas, America/Barbados, America/Belem, America/Belize, America/Blanc-Sablon, America/Boa_Vista, America/Bogota, America/Boise, America/Buenos_Aires, America/Cambridge_Bay, America/Campo_Grande, America/Cancun, America/Caracas, America/Catamarca, America/Cayenne, America/Cayman, America/Chicago, America/Chihuahua, America/Ciudad_Juarez, America/Coral_Harbour, America/Cordoba, America/Costa_Rica, America/Coyhaique, America/Creston, America/Cuiaba, America/Curacao, America/Danmarkshavn, America/Dawson, America/Dawson_Creek, America/Denver, America/Detroit, America/Dominica, America/Edmonton, America/Eirunepe, America/El_Salvador, America/Ensenada, America/Fort_Nelson, America/Fort_Wayne, America/Fortaleza, America/Glace_Bay, America/Godthab, America/Goose_Bay, America/Grand_Turk, America/Grenada, America/Guadeloupe, America/Guatemala, America/Guayaquil, America/Guyana, America/Halifax, America/Havana, America/Hermosillo, America/Indiana/Indianapolis, America/Indiana/Knox, America/Indiana/Marengo, America/Indiana/Petersburg, America/Indiana/Tell_City, America/Indiana/Vevay, America/Indiana/Vincennes, America/Indiana/Winamac, America/Indianapolis, America/Inuvik, America/Iqaluit, America/Jamaica, America/Jujuy, America/Juneau, America/Kentucky/Louisville, America/Kentucky/Monticello, America/Knox_IN, America/Kralendijk, America/La_Paz, America/Lima, America/Los_Angeles, America/Louisville, America/Lower_Princes, America/Maceio, America/Managua, America/Manaus, America/Marigot, America/Martinique, America/Matamoros, America/Mazatlan, America/Mendoza, America/Menominee, America/Merida, America/Metlakatla, America/Mexico_City, America/Miquelon, America/Moncton, America/Monterrey, America/Montevideo, America/Montreal, America/Montserrat, America/Nassau, America/New_York, America/Nipigon, America/Nome, America/Noronha, America/North_Dakota/Beulah, America/North_Dakota/Center, America/North_Dakota/New_Salem, America/Nuuk, America/Ojinaga, America/Panama, America/Pangnirtung, America/Paramaribo, America/Phoenix, America/Port-au-Prince, America/Port_of_Spain, America/Porto_Acre, America/Porto_Velho, America/Puerto_Rico, America/Punta_Arenas, America/Rainy_River, America/Rankin_Inlet, America/Recife, America/Regina, America/Resolute, America/Rio_Branco, America/Rosario, America/Santa_Isabel, America/Santarem, America/Santiago, America/Santo_Domingo, America/Sao_Paulo, America/Scoresbysund, America/Shiprock, America/Sitka, America/St_Barthelemy, America/St_Johns, America/St_Kitts, America/St_Lucia, America/St_Thomas, America/St_Vincent, America/Swift_Current, America/Tegucigalpa, America/Thule, America/Thunder_Bay, America/Tijuana, America/Toronto, America/Tortola, America/Vancouver, America/Virgin, America/Whitehorse, America/Winnipeg, America/Yakutat, America/Yellowknife, Antarctica/Casey, Antarctica/Davis, Antarctica/DumontDUrville, Antarctica/Macquarie, Antarctica/Mawson, Antarctica/McMurdo, Antarctica/Palmer, Antarctica/Rothera, Antarctica/South_Pole, Antarctica/Syowa, Antarctica/Troll, Antarctica/Vostok, Arctic/Longyearbyen, Asia/Aden, Asia/Almaty, Asia/Amman, Asia/Anadyr, Asia/Aqtau, Asia/Aqtobe, Asia/Ashgabat, Asia/Ashkhabad, Asia/Atyrau, Asia/Baghdad, Asia/Bahrain, Asia/Baku, Asia/Bangkok, Asia/Barnaul, Asia/Beirut, Asia/Bishkek, Asia/Brunei, Asia/Calcutta, Asia/Chita, Asia/Choibalsan, Asia/Chongqing, Asia/Chungking, Asia/Colombo, Asia/Dacca, Asia/Damascus, Asia/Dhaka, Asia/Dili, Asia/Dubai, Asia/Dushanbe, Asia/Famagusta, Asia/Gaza, Asia/Harbin, Asia/Hebron, Asia/Ho_Chi_Minh, Asia/Hong_Kong, Asia/Hovd, Asia/Irkutsk, Asia/Istanbul, Asia/Jakarta, Asia/Jayapura, Asia/Jerusalem, Asia/Kabul, Asia/Kamchatka, Asia/Karachi, Asia/Kashgar, Asia/Kathmandu, Asia/Katmandu, Asia/Khandyga, Asia/Kolkata, Asia/Krasnoyarsk, Asia/Kuala_Lumpur, Asia/Kuching, Asia/Kuwait, Asia/Macao, Asia/Macau, Asia/Magadan, Asia/Makassar, Asia/Manila, Asia/Muscat, Asia/Nicosia, Asia/Novokuznetsk, Asia/Novosibirsk, Asia/Omsk, Asia/Oral, Asia/Phnom_Penh, Asia/Pontianak, Asia/Pyongyang, Asia/Qatar, Asia/Qostanay, Asia/Qyzylorda, Asia/Rangoon, Asia/Riyadh, Asia/Saigon, Asia/Sakhalin, Asia/Samarkand, Asia/Seoul, Asia/Shanghai, Asia/Singapore, Asia/Srednekolymsk, Asia/Taipei, Asia/Tashkent, Asia/Tbilisi, Asia/Tehran, Asia/Tel_Aviv, Asia/Thimbu, Asia/Thimphu, Asia/Tokyo, Asia/Tomsk, Asia/Ujung_Pandang, Asia/Ulaanbaatar, Asia/Ulan_Bator, Asia/Urumqi, Asia/Ust-Nera, Asia/Vientiane, Asia/Vladivostok, Asia/Yakutsk, Asia/Yangon, Asia/Yekaterinburg, Asia/Yerevan, Atlantic/Azores, Atlantic/Bermuda, Atlantic/Canary, Atlantic/Cape_Verde, Atlantic/Faeroe, Atlantic/Faroe, Atlantic/Jan_Mayen, Atlantic/Madeira, Atlantic/Reykjavik, Atlantic/South_Georgia, Atlantic/St_Helena, Atlantic/Stanley, Australia/ACT, Australia/Adelaide, Australia/Brisbane, Australia/Broken_Hill, Australia/Canberra, Australia/Currie, Australia/Darwin, Australia/Eucla, Australia/Hobart, Australia/LHI, Australia/Lindeman, Australia/Lord_Howe, Australia/Melbourne, Australia/NSW, Australia/North, Australia/Perth, Australia/Queensland, Australia/South, Australia/Sydney, Australia/Tasmania, Australia/Victoria, Australia/West, Australia/Yancowinna, Brazil/Acre, Brazil/DeNoronha, Brazil/East, Brazil/West, CET, CST6CDT, Canada/Atlantic, Canada/Central, Canada/Eastern, Canada/Mountain, Canada/Newfoundland, Canada/Pacific, Canada/Saskatchewan, Canada/Yukon, Chile/Continental, Chile/EasterIsland, Cuba, EET, EST, EST5EDT, Egypt, Eire, Etc/GMT, Etc/GMT+0, Etc/GMT+1, Etc/GMT+10, Etc/GMT+11, Etc/GMT+12, Etc/GMT+2, Etc/GMT+3, Etc/GMT+4, Etc/GMT+5, Etc/GMT+6, Etc/GMT+7, Etc/GMT+8, Etc/GMT+9, Etc/GMT-0, Etc/GMT-1, Etc/GMT-10, Etc/GMT-11, Etc/GMT-12, Etc/GMT-13, Etc/GMT-14, Etc/GMT-2, Etc/GMT-3, Etc/GMT-4, Etc/GMT-5, Etc/GMT-6, Etc/GMT-7, Etc/GMT-8, Etc/GMT-9, Etc/GMT0, Etc/Greenwich, Etc/UCT, Etc/UTC, Etc/Universal, Etc/Zulu, Europe/Amsterdam, Europe/Andorra, Europe/Astrakhan, Europe/Athens, Europe/Belfast, Europe/Belgrade, Europe/Berlin, Europe/Bratislava, Europe/Brussels, Europe/Bucharest, Europe/Budapest, Europe/Busingen, Europe/Chisinau, Europe/Copenhagen, Europe/Dublin, Europe/Gibraltar, Europe/Guernsey, Europe/Helsinki, Europe/Isle_of_Man, Europe/Istanbul, Europe/Jersey, Europe/Kaliningrad, Europe/Kiev, Europe/Kirov, Europe/Kyiv, Europe/Lisbon, Europe/Ljubljana, Europe/London, Europe/Luxembourg, Europe/Madrid, Europe/Malta, Europe/Mariehamn, Europe/Minsk, Europe/Monaco, Europe/Moscow, Europe/Nicosia, Europe/Oslo, Europe/Paris, Europe/Podgorica, Europe/Prague, Europe/Riga, Europe/Rome, Europe/Samara, Europe/San_Marino, Europe/Sarajevo, Europe/Saratov, Europe/Simferopol, Europe/Skopje, Europe/Sofia, Europe/Stockholm, Europe/Tallinn, Europe/Tirane, Europe/Tiraspol, Europe/Ulyanovsk, Europe/Uzhgorod, Europe/Vaduz, Europe/Vatican, Europe/Vienna, Europe/Vilnius, Europe/Volgograd, Europe/Warsaw, Europe/Zagreb, Europe/Zaporozhye, Europe/Zurich, Factory, GB, GB-Eire, GMT, GMT+0, GMT-0, GMT0, Greenwich, HST, Hongkong, Iceland, Indian/Antananarivo, Indian/Chagos, Indian/Christmas, Indian/Cocos, Indian/Comoro, Indian/Kerguelen, Indian/Mahe, Indian/Maldives, Indian/Mauritius, Indian/Mayotte, Indian/Reunion, Iran, Israel, Jamaica, Japan, Kwajalein, Libya, MET, MST, MST7MDT, Mexico/BajaNorte, Mexico/BajaSur, Mexico/General, NZ, NZ-CHAT, Navajo, PRC, PST8PDT, Pacific/Apia, Pacific/Auckland, Pacific/Bougainville, Pacific/Chatham, Pacific/Chuuk, Pacific/Easter, Pacific/Efate, Pacific/Enderbury, Pacific/Fakaofo, Pacific/Fiji, Pacific/Funafuti, Pacific/Galapagos, Pacific/Gambier, Pacific/Guadalcanal, Pacific/Guam, Pacific/Honolulu, Pacific/Johnston, Pacific/Kanton, Pacific/Kiritimati, Pacific/Kosrae, Pacific/Kwajalein, Pacific/Majuro, Pacific/Marquesas, Pacific/Midway, Pacific/Nauru, Pacific/Niue, Pacific/Norfolk, Pacific/Noumea, Pacific/Pago_Pago, Pacific/Palau, Pacific/Pitcairn, Pacific/Pohnpei, Pacific/Ponape, Pacific/Port_Moresby, Pacific/Rarotonga, Pacific/Saipan, Pacific/Samoa, Pacific/Tahiti, Pacific/Tarawa, Pacific/Tongatapu, Pacific/Truk, Pacific/Wake, Pacific/Wallis, Pacific/Yap, Poland, Portugal, ROC, ROK, Singapore, Turkey, UCT, US/Alaska, US/Aleutian, US/Arizona, US/Central, US/East-Indiana, US/Eastern, US/Hawaii, US/Indiana-Starke, US/Michigan, US/Mountain, US/Pacific, US/Samoa, UTC, Universal, W-SU, WET, Zulu) | | `--customer-id` | `string` | Filter by customer ID. | | `--external-customer-id` | `string` | Filter by external customer ID. | | `--customer-aggregation-function` | `choice` | If set, will first compute the quantities per customer before aggregating them using the given function. If not set, the quantities will be aggregated across all events. (choices: count, sum, max, min, avg, unique) | | `--metadata` | `string` | Filter by metadata key-value pairs. JSON: \{"\": string \| integer \| boolean \| array of string \| array of integer \| array of boolean} | ## polar meters update Update a meter. ```bash theme={null} polar meters update [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--confirm`, `-c` | `boolean` | Skip the confirmation prompt for destructive requests | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--metadata` | `string` | Key-value object allowing you to store additional information. JSON: \{"\": string \| integer \| number \| boolean} | | `--name` | `string` | The name of the meter. Will be shown on customer's invoices and usage. | | `--unit` | `choice` | The unit of the meter. (choices: scalar, token, custom) | | `--custom-label` | `string` | The label for the custom unit. Required when unit is 'custom'. | | `--custom-multiplier` | `integer` | The multiplier to convert from base unit to display scale. Required when unit is 'custom'. | | `--filter` | `string` | The filter to apply on events that'll be used to calculate the meter. JSON: \{"conjunction": "and" \| "or", "clauses": array of (\{"property": string, "operator": "eq" \| "ne" \| "gt" \| "gte" \| "lt" \| ..., "value": string \| integer \| boolean} \| \{"conjunction": "and" \| "or", "clauses": array of \{...}})} | | `--aggregation` | `string` | The aggregation to apply on the filtered events to calculate the meter. JSON: \{"func": "count"} \| \{"func": "sum" \| "max" \| "min" \| "avg", "property": string} \| \{"func": "unique", "property": string} | | `--is-archived` | `boolean` | Whether the meter is archived. Archived meters are no longer used for billing. | # polar metrics Source: https://polar.sh/docs/integrate/cli/reference/metrics ```bash theme={null} polar metrics [flags] ``` **Subcommands** * [`polar metrics get`](#polar-metrics-get) Get metrics about your orders and subscriptions. * [`polar metrics limits`](#polar-metrics-limits) Get the interval limits for the metrics endpoint. ## polar metrics get Get metrics about your orders and subscriptions. ```bash theme={null} polar metrics get [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--start-date` | `string` | Required. Start date. | | `--end-date` | `string` | Required. End date. | | `--timezone` | `choice` | Timezone to use for the timestamps. Default is UTC. (choices: Africa/Abidjan, Africa/Accra, Africa/Addis_Ababa, Africa/Algiers, Africa/Asmara, Africa/Asmera, Africa/Bamako, Africa/Bangui, Africa/Banjul, Africa/Bissau, Africa/Blantyre, Africa/Brazzaville, Africa/Bujumbura, Africa/Cairo, Africa/Casablanca, Africa/Ceuta, Africa/Conakry, Africa/Dakar, Africa/Dar_es_Salaam, Africa/Djibouti, Africa/Douala, Africa/El_Aaiun, Africa/Freetown, Africa/Gaborone, Africa/Harare, Africa/Johannesburg, Africa/Juba, Africa/Kampala, Africa/Khartoum, Africa/Kigali, Africa/Kinshasa, Africa/Lagos, Africa/Libreville, Africa/Lome, Africa/Luanda, Africa/Lubumbashi, Africa/Lusaka, Africa/Malabo, Africa/Maputo, Africa/Maseru, Africa/Mbabane, Africa/Mogadishu, Africa/Monrovia, Africa/Nairobi, Africa/Ndjamena, Africa/Niamey, Africa/Nouakchott, Africa/Ouagadougou, Africa/Porto-Novo, Africa/Sao_Tome, Africa/Timbuktu, Africa/Tripoli, Africa/Tunis, Africa/Windhoek, America/Adak, America/Anchorage, America/Anguilla, America/Antigua, America/Araguaina, America/Argentina/Buenos_Aires, America/Argentina/Catamarca, America/Argentina/ComodRivadavia, America/Argentina/Cordoba, America/Argentina/Jujuy, America/Argentina/La_Rioja, America/Argentina/Mendoza, America/Argentina/Rio_Gallegos, America/Argentina/Salta, America/Argentina/San_Juan, America/Argentina/San_Luis, America/Argentina/Tucuman, America/Argentina/Ushuaia, America/Aruba, America/Asuncion, America/Atikokan, America/Atka, America/Bahia, America/Bahia_Banderas, America/Barbados, America/Belem, America/Belize, America/Blanc-Sablon, America/Boa_Vista, America/Bogota, America/Boise, America/Buenos_Aires, America/Cambridge_Bay, America/Campo_Grande, America/Cancun, America/Caracas, America/Catamarca, America/Cayenne, America/Cayman, America/Chicago, America/Chihuahua, America/Ciudad_Juarez, America/Coral_Harbour, America/Cordoba, America/Costa_Rica, America/Coyhaique, America/Creston, America/Cuiaba, America/Curacao, America/Danmarkshavn, America/Dawson, America/Dawson_Creek, America/Denver, America/Detroit, America/Dominica, America/Edmonton, America/Eirunepe, America/El_Salvador, America/Ensenada, America/Fort_Nelson, America/Fort_Wayne, America/Fortaleza, America/Glace_Bay, America/Godthab, America/Goose_Bay, America/Grand_Turk, America/Grenada, America/Guadeloupe, America/Guatemala, America/Guayaquil, America/Guyana, America/Halifax, America/Havana, America/Hermosillo, America/Indiana/Indianapolis, America/Indiana/Knox, America/Indiana/Marengo, America/Indiana/Petersburg, America/Indiana/Tell_City, America/Indiana/Vevay, America/Indiana/Vincennes, America/Indiana/Winamac, America/Indianapolis, America/Inuvik, America/Iqaluit, America/Jamaica, America/Jujuy, America/Juneau, America/Kentucky/Louisville, America/Kentucky/Monticello, America/Knox_IN, America/Kralendijk, America/La_Paz, America/Lima, America/Los_Angeles, America/Louisville, America/Lower_Princes, America/Maceio, America/Managua, America/Manaus, America/Marigot, America/Martinique, America/Matamoros, America/Mazatlan, America/Mendoza, America/Menominee, America/Merida, America/Metlakatla, America/Mexico_City, America/Miquelon, America/Moncton, America/Monterrey, America/Montevideo, America/Montreal, America/Montserrat, America/Nassau, America/New_York, America/Nipigon, America/Nome, America/Noronha, America/North_Dakota/Beulah, America/North_Dakota/Center, America/North_Dakota/New_Salem, America/Nuuk, America/Ojinaga, America/Panama, America/Pangnirtung, America/Paramaribo, America/Phoenix, America/Port-au-Prince, America/Port_of_Spain, America/Porto_Acre, America/Porto_Velho, America/Puerto_Rico, America/Punta_Arenas, America/Rainy_River, America/Rankin_Inlet, America/Recife, America/Regina, America/Resolute, America/Rio_Branco, America/Rosario, America/Santa_Isabel, America/Santarem, America/Santiago, America/Santo_Domingo, America/Sao_Paulo, America/Scoresbysund, America/Shiprock, America/Sitka, America/St_Barthelemy, America/St_Johns, America/St_Kitts, America/St_Lucia, America/St_Thomas, America/St_Vincent, America/Swift_Current, America/Tegucigalpa, America/Thule, America/Thunder_Bay, America/Tijuana, America/Toronto, America/Tortola, America/Vancouver, America/Virgin, America/Whitehorse, America/Winnipeg, America/Yakutat, America/Yellowknife, Antarctica/Casey, Antarctica/Davis, Antarctica/DumontDUrville, Antarctica/Macquarie, Antarctica/Mawson, Antarctica/McMurdo, Antarctica/Palmer, Antarctica/Rothera, Antarctica/South_Pole, Antarctica/Syowa, Antarctica/Troll, Antarctica/Vostok, Arctic/Longyearbyen, Asia/Aden, Asia/Almaty, Asia/Amman, Asia/Anadyr, Asia/Aqtau, Asia/Aqtobe, Asia/Ashgabat, Asia/Ashkhabad, Asia/Atyrau, Asia/Baghdad, Asia/Bahrain, Asia/Baku, Asia/Bangkok, Asia/Barnaul, Asia/Beirut, Asia/Bishkek, Asia/Brunei, Asia/Calcutta, Asia/Chita, Asia/Choibalsan, Asia/Chongqing, Asia/Chungking, Asia/Colombo, Asia/Dacca, Asia/Damascus, Asia/Dhaka, Asia/Dili, Asia/Dubai, Asia/Dushanbe, Asia/Famagusta, Asia/Gaza, Asia/Harbin, Asia/Hebron, Asia/Ho_Chi_Minh, Asia/Hong_Kong, Asia/Hovd, Asia/Irkutsk, Asia/Istanbul, Asia/Jakarta, Asia/Jayapura, Asia/Jerusalem, Asia/Kabul, Asia/Kamchatka, Asia/Karachi, Asia/Kashgar, Asia/Kathmandu, Asia/Katmandu, Asia/Khandyga, Asia/Kolkata, Asia/Krasnoyarsk, Asia/Kuala_Lumpur, Asia/Kuching, Asia/Kuwait, Asia/Macao, Asia/Macau, Asia/Magadan, Asia/Makassar, Asia/Manila, Asia/Muscat, Asia/Nicosia, Asia/Novokuznetsk, Asia/Novosibirsk, Asia/Omsk, Asia/Oral, Asia/Phnom_Penh, Asia/Pontianak, Asia/Pyongyang, Asia/Qatar, Asia/Qostanay, Asia/Qyzylorda, Asia/Rangoon, Asia/Riyadh, Asia/Saigon, Asia/Sakhalin, Asia/Samarkand, Asia/Seoul, Asia/Shanghai, Asia/Singapore, Asia/Srednekolymsk, Asia/Taipei, Asia/Tashkent, Asia/Tbilisi, Asia/Tehran, Asia/Tel_Aviv, Asia/Thimbu, Asia/Thimphu, Asia/Tokyo, Asia/Tomsk, Asia/Ujung_Pandang, Asia/Ulaanbaatar, Asia/Ulan_Bator, Asia/Urumqi, Asia/Ust-Nera, Asia/Vientiane, Asia/Vladivostok, Asia/Yakutsk, Asia/Yangon, Asia/Yekaterinburg, Asia/Yerevan, Atlantic/Azores, Atlantic/Bermuda, Atlantic/Canary, Atlantic/Cape_Verde, Atlantic/Faeroe, Atlantic/Faroe, Atlantic/Jan_Mayen, Atlantic/Madeira, Atlantic/Reykjavik, Atlantic/South_Georgia, Atlantic/St_Helena, Atlantic/Stanley, Australia/ACT, Australia/Adelaide, Australia/Brisbane, Australia/Broken_Hill, Australia/Canberra, Australia/Currie, Australia/Darwin, Australia/Eucla, Australia/Hobart, Australia/LHI, Australia/Lindeman, Australia/Lord_Howe, Australia/Melbourne, Australia/NSW, Australia/North, Australia/Perth, Australia/Queensland, Australia/South, Australia/Sydney, Australia/Tasmania, Australia/Victoria, Australia/West, Australia/Yancowinna, Brazil/Acre, Brazil/DeNoronha, Brazil/East, Brazil/West, CET, CST6CDT, Canada/Atlantic, Canada/Central, Canada/Eastern, Canada/Mountain, Canada/Newfoundland, Canada/Pacific, Canada/Saskatchewan, Canada/Yukon, Chile/Continental, Chile/EasterIsland, Cuba, EET, EST, EST5EDT, Egypt, Eire, Etc/GMT, Etc/GMT+0, Etc/GMT+1, Etc/GMT+10, Etc/GMT+11, Etc/GMT+12, Etc/GMT+2, Etc/GMT+3, Etc/GMT+4, Etc/GMT+5, Etc/GMT+6, Etc/GMT+7, Etc/GMT+8, Etc/GMT+9, Etc/GMT-0, Etc/GMT-1, Etc/GMT-10, Etc/GMT-11, Etc/GMT-12, Etc/GMT-13, Etc/GMT-14, Etc/GMT-2, Etc/GMT-3, Etc/GMT-4, Etc/GMT-5, Etc/GMT-6, Etc/GMT-7, Etc/GMT-8, Etc/GMT-9, Etc/GMT0, Etc/Greenwich, Etc/UCT, Etc/UTC, Etc/Universal, Etc/Zulu, Europe/Amsterdam, Europe/Andorra, Europe/Astrakhan, Europe/Athens, Europe/Belfast, Europe/Belgrade, Europe/Berlin, Europe/Bratislava, Europe/Brussels, Europe/Bucharest, Europe/Budapest, Europe/Busingen, Europe/Chisinau, Europe/Copenhagen, Europe/Dublin, Europe/Gibraltar, Europe/Guernsey, Europe/Helsinki, Europe/Isle_of_Man, Europe/Istanbul, Europe/Jersey, Europe/Kaliningrad, Europe/Kiev, Europe/Kirov, Europe/Kyiv, Europe/Lisbon, Europe/Ljubljana, Europe/London, Europe/Luxembourg, Europe/Madrid, Europe/Malta, Europe/Mariehamn, Europe/Minsk, Europe/Monaco, Europe/Moscow, Europe/Nicosia, Europe/Oslo, Europe/Paris, Europe/Podgorica, Europe/Prague, Europe/Riga, Europe/Rome, Europe/Samara, Europe/San_Marino, Europe/Sarajevo, Europe/Saratov, Europe/Simferopol, Europe/Skopje, Europe/Sofia, Europe/Stockholm, Europe/Tallinn, Europe/Tirane, Europe/Tiraspol, Europe/Ulyanovsk, Europe/Uzhgorod, Europe/Vaduz, Europe/Vatican, Europe/Vienna, Europe/Vilnius, Europe/Volgograd, Europe/Warsaw, Europe/Zagreb, Europe/Zaporozhye, Europe/Zurich, Factory, GB, GB-Eire, GMT, GMT+0, GMT-0, GMT0, Greenwich, HST, Hongkong, Iceland, Indian/Antananarivo, Indian/Chagos, Indian/Christmas, Indian/Cocos, Indian/Comoro, Indian/Kerguelen, Indian/Mahe, Indian/Maldives, Indian/Mauritius, Indian/Mayotte, Indian/Reunion, Iran, Israel, Jamaica, Japan, Kwajalein, Libya, MET, MST, MST7MDT, Mexico/BajaNorte, Mexico/BajaSur, Mexico/General, NZ, NZ-CHAT, Navajo, PRC, PST8PDT, Pacific/Apia, Pacific/Auckland, Pacific/Bougainville, Pacific/Chatham, Pacific/Chuuk, Pacific/Easter, Pacific/Efate, Pacific/Enderbury, Pacific/Fakaofo, Pacific/Fiji, Pacific/Funafuti, Pacific/Galapagos, Pacific/Gambier, Pacific/Guadalcanal, Pacific/Guam, Pacific/Honolulu, Pacific/Johnston, Pacific/Kanton, Pacific/Kiritimati, Pacific/Kosrae, Pacific/Kwajalein, Pacific/Majuro, Pacific/Marquesas, Pacific/Midway, Pacific/Nauru, Pacific/Niue, Pacific/Norfolk, Pacific/Noumea, Pacific/Pago_Pago, Pacific/Palau, Pacific/Pitcairn, Pacific/Pohnpei, Pacific/Ponape, Pacific/Port_Moresby, Pacific/Rarotonga, Pacific/Saipan, Pacific/Samoa, Pacific/Tahiti, Pacific/Tarawa, Pacific/Tongatapu, Pacific/Truk, Pacific/Wake, Pacific/Wallis, Pacific/Yap, Poland, Portugal, ROC, ROK, Singapore, Turkey, UCT, US/Alaska, US/Aleutian, US/Arizona, US/Central, US/East-Indiana, US/Eastern, US/Hawaii, US/Indiana-Starke, US/Michigan, US/Mountain, US/Pacific, US/Samoa, UTC, Universal, W-SU, WET, Zulu) | | `--interval` | `choice` | Required. Interval between two timestamps. (choices: year, month, week, day, hour) | | `--organization-id`, `--org` | `string` | Filter by organization ID. Defaults to the active organization. | | `--product-id` | `string` | Filter by product ID. | | `--billing-type` | `choice` | Filter by billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases. (choices: one_time, recurring) | | `--customer-id` | `string` | Filter by customer ID. | | `--metrics` | `string` | List of metric slugs to focus on. When provided, only the queries needed for these metrics will be executed, improving performance. If not provided, all metrics are returned. | ## polar metrics limits Get the interval limits for the metrics endpoint. ```bash theme={null} polar metrics limits [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | # polar orders Source: https://polar.sh/docs/integrate/cli/reference/orders ```bash theme={null} polar orders [flags] ``` **Subcommands** * [`polar orders generate_invoice`](#polar-orders-generate_invoice) Trigger generation of an order's invoice. * [`polar orders get`](#polar-orders-get) Get an order by ID. * [`polar orders invoice`](#polar-orders-invoice) Get an order's invoice data. * [`polar orders list`](#polar-orders-list) List orders. * [`polar orders receipt`](#polar-orders-receipt) Get a presigned URL to download an order's receipt PDF. * [`polar orders update`](#polar-orders-update) Update an order. ## polar orders generate_invoice Trigger generation of an order's invoice. ```bash theme={null} polar orders generate_invoice [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar orders get Get an order by ID. ```bash theme={null} polar orders get [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar orders invoice Get an order's invoice data. ```bash theme={null} polar orders invoice [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar orders list List orders. ```bash theme={null} polar orders list [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--organization-id`, `--org` | `string` | Filter by organization ID. Defaults to the active organization. | | `--product-id` | `string` | Filter by product ID. | | `--product-billing-type` | `choice` | Filter by product billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases. (choices: one_time, recurring) | | `--discount-id` | `string` | Filter by discount ID. | | `--customer-id` | `string` | Filter by customer ID. | | `--external-customer-id` | `string` | Filter by customer external ID. | | `--checkout-id` | `string` | Filter by checkout ID. | | `--subscription-id` | `string` | Filter by subscription ID. | | `--status` | `choice` | Filter by order status. (choices: draft, pending, paid, refunded, partially_refunded, void) | | `--created-after` | `string` | Only include orders created after this date | | `--created-before` | `string` | Only include orders created before this date | | `--page` | `integer` | Page number, defaults to 1. | | `--limit` | `integer` | Size of a page, defaults to 10. Maximum is 100. | | `--sorting` | `choice` | Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. (choices: created_at, -created_at, status, -status, invoice_number, -invoice_number, amount, -amount, net_amount, -net_amount, customer, -customer, product, -product, discount, -discount, subscription, -subscription) | | `--metadata` | `string` | Filter by metadata key-value pairs. JSON: \{"\": string \| integer \| boolean \| array of string \| array of integer \| array of boolean} | ## polar orders receipt Get a presigned URL to download an order's receipt PDF. ```bash theme={null} polar orders receipt [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | ## polar orders update Update an order. ```bash theme={null} polar orders update [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--billing-name` | `string` | The name of the customer that should appear on the invoice. | | `--billing-address` | `string` | The address of the customer that should appear on the invoice. Country and state fields cannot be updated. JSON: \{"country": "AD" \| "AE" \| "AF" \| "AG" \| "AI" \| ..., ...} | # polar organizations Source: https://polar.sh/docs/integrate/cli/reference/organizations ```bash theme={null} polar organizations [flags] ``` **Subcommands** * [`polar organizations get`](#polar-organizations-get) Get an organization by ID. * [`polar organizations list`](#polar-organizations-list) List organizations. ## polar organizations get Get an organization by ID. ```bash theme={null} polar organizations get [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar organizations list List organizations. ```bash theme={null} polar organizations list [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--slug` | `string` | Filter by slug. | | `--page` | `integer` | Page number, defaults to 1. | | `--limit` | `integer` | Size of a page, defaults to 10. Maximum is 100. | | `--sorting` | `choice` | Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. (choices: created_at, -created_at, slug, -slug, name, -name, next_review_threshold, -next_review_threshold, days_in_status, -days_in_status) | # polar payments Source: https://polar.sh/docs/integrate/cli/reference/payments ```bash theme={null} polar payments [flags] ``` **Subcommands** * [`polar payments get`](#polar-payments-get) Get a payment by ID. * [`polar payments list`](#polar-payments-list) List payments. ## polar payments get Get a payment by ID. ```bash theme={null} polar payments get [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar payments list List payments. ```bash theme={null} polar payments list [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--organization-id`, `--org` | `string` | Filter by organization ID. Defaults to the active organization. | | `--checkout-id` | `string` | Filter by checkout ID. | | `--order-id` | `string` | Filter by order ID. | | `--customer-id` | `string` | Filter by customer ID. | | `--status` | `choice` | Filter by payment status. (choices: pending, succeeded, failed) | | `--method` | `string` | Filter by payment method. | | `--customer-email` | `string` | Filter by customer email. | | `--page` | `integer` | Page number, defaults to 1. | | `--limit` | `integer` | Size of a page, defaults to 10. Maximum is 100. | | `--sorting` | `choice` | Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. (choices: created_at, -created_at, status, -status, amount, -amount, method, -method) | # polar products Source: https://polar.sh/docs/integrate/cli/reference/products ```bash theme={null} polar products [flags] ``` **Subcommands** * [`polar products create`](#polar-products-create) Create a product. * [`polar products delete`](#polar-products-delete) Delete a product. * [`polar products get`](#polar-products-get) Get a product by ID. * [`polar products list`](#polar-products-list) List products. * [`polar products update`](#polar-products-update) Update a product. * [`polar products update_benefits`](#polar-products-update_benefits) Update benefits granted by a product. ## polar products create Create a product. ```bash theme={null} polar products create [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--metadata` | `string` | Key-value object allowing you to store additional information. JSON: \{"\": string \| integer \| number \| boolean} | | `--name` | `string` | Required. The name of the product. | | `--description` | `string` | The description of the product. | | `--visibility` | `choice` | The visibility of the product. (choices: draft, private, public) | | `--prices` | `string` | Required. List of available prices for this product. It may combine at most one fixed price with one seat-based price (billed as `fixed + seat_charge`), or contain a single custom or free price, plus any number of metered prices. A free price cannot be combined with other prices, and a custom price cannot be combined with a fixed or seat-based price. Metered prices are not supported on one-time purchase products. JSON: array of (\{"amount_type": "fixed", "price_amount": integer, ...} \| \{"amount_type": "custom", ...} \| \{"amount_type": "seat_based", "seat_tiers": \{"tiers": array of \{...}, ...}, ...} \| \{"amount_type": "unit_based", "tiers": \{"type": "volume" \| "graduated", "tiers": array of \{...}}, ...} \| \{"amount_type": "metered_unit", "meter_id": string, "unit_amount": number \| string, ...} \| \{"amount_type": "metered_tiers", "meter_id": string, "tiers": \{"type": "volume" \| "graduated", "tiers": array of \{...}}, ...}) | | `--medias` | `string` | List of file IDs. Each one must be on the same organization as the product, of type `product_media` and correctly uploaded. | | `--attached-custom-fields` | `string` | List of custom fields to attach. JSON: array of \{"custom_field_id": string, "required": boolean} | | `--organization-id`, `--org` | `string` | The ID of the organization owning the product. Defaults to the active organization. | | `--trial-interval` | `choice` | The interval unit for the trial period. (choices: day, week, month, year) | | `--trial-interval-count` | `integer` | The number of interval units for the trial period. | | `--recurring-interval` | `choice` | The recurring interval of the product. (choices: day, week, month, year) | | `--recurring-interval-count` | `integer` | Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on. | | `--meter-interval` | `choice` | Optional meter cycle, independent of the billing interval. When set, overage settlement, meter resets and meter-credit grants run on this cadence rather than the billing interval — e.g. yearly billing with monthly credits. It must evenly divide the billing interval. If `None`, metered concerns follow the billing interval. Once set, it can't be changed. (choices: day, week, month, year) | | `--meter-interval-count` | `integer` | Number of meter interval units. Defaults to 1 when `meter_interval` is set. Ignored when `meter_interval` is `None`. | ## polar products delete Delete a product. ```bash theme={null} polar products delete [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--confirm`, `-c` | `boolean` | Skip the confirmation prompt for destructive requests | ## polar products get Get a product by ID. ```bash theme={null} polar products get [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar products list List products. ```bash theme={null} polar products list [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--id` | `string` | Filter by product ID. | | `--organization-id`, `--org` | `string` | Filter by organization ID. Defaults to the active organization. | | `--query` | `string` | Filter by product name. | | `--is-archived` | `boolean` | Filter on archived products. | | `--is-recurring` | `boolean` | Filter on recurring products. If `true`, only subscriptions tiers are returned. If `false`, only one-time purchase products are returned. | | `--benefit-id` | `string` | Filter products granting specific benefit. | | `--visibility` | `choice` | Filter by visibility. (choices: draft, private, public) | | `--page` | `integer` | Page number, defaults to 1. | | `--limit` | `integer` | Size of a page, defaults to 10. Maximum is 100. | | `--sorting` | `choice` | Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. (choices: created_at, -created_at, name, -name, price_amount_type, -price_amount_type, price_amount, -price_amount) | | `--metadata` | `string` | Filter by metadata key-value pairs. JSON: \{"\": string \| integer \| boolean \| array of string \| array of integer \| array of boolean} | ## polar products update Update a product. ```bash theme={null} polar products update [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--confirm`, `-c` | `boolean` | Skip the confirmation prompt for destructive requests | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--metadata` | `string` | Key-value object allowing you to store additional information. JSON: \{"\": string \| integer \| number \| boolean} | | `--trial-interval` | `choice` | The interval unit for the trial period. (choices: day, week, month, year) | | `--trial-interval-count` | `integer` | The number of interval units for the trial period. | | `--name` | `string` | name | | `--description` | `string` | The description of the product. | | `--recurring-interval` | `choice` | The recurring interval of the product. If `None`, the product is a one-time purchase. Can only be set on legacy recurring products. Once set, it can't be changed. (choices: day, week, month, year) | | `--recurring-interval-count` | `integer` | Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on. Once set, it can't be changed. | | `--is-archived` | `boolean` | Whether the product is archived. If `true`, the product won't be available for purchase anymore. Existing customers will still have access to their benefits, and subscriptions will continue normally. | | `--visibility` | `choice` | The visibility of the product. (choices: draft, private, public) | | `--prices` | `string` | List of available prices for this product. If you want to keep existing prices, include them in the list as an `ExistingProductPrice` object. JSON: array of (\{"id": string} \| \{"amount_type": "fixed", "price_amount": integer, ...} \| \{"amount_type": "custom", ...} \| \{"amount_type": "seat_based", "seat_tiers": \{"tiers": array of \{...}, ...}, ...} \| \{"amount_type": "unit_based", "tiers": \{"type": "volume" \| "graduated", "tiers": array of \{...}}, ...} \| \{"amount_type": "metered_unit", "meter_id": string, "unit_amount": number \| string, ...} \| \{"amount_type": "metered_tiers", "meter_id": string, "tiers": \{"type": "volume" \| "graduated", "tiers": array of \{...}}, ...}) | | `--medias` | `string` | List of file IDs. Each one must be on the same organization as the product, of type `product_media` and correctly uploaded. | | `--attached-custom-fields` | `string` | attached_custom_fields JSON: array of \{"custom_field_id": string, "required": boolean} | ## polar products update_benefits Update benefits granted by a product. ```bash theme={null} polar products update_benefits [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--confirm`, `-c` | `boolean` | Skip the confirmation prompt for destructive requests | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--benefits` | `string` | Required. List of benefit IDs. Each one must be on the same organization as the product. | # polar refunds Source: https://polar.sh/docs/integrate/cli/reference/refunds ```bash theme={null} polar refunds [flags] ``` **Subcommands** * [`polar refunds create`](#polar-refunds-create) Create a refund. * [`polar refunds list`](#polar-refunds-list) List refunds. ## polar refunds create Create a refund. ```bash theme={null} polar refunds create [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--confirm`, `-c` | `boolean` | Skip the confirmation prompt for destructive requests | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--metadata` | `string` | Key-value object allowing you to store additional information. JSON: \{"\": string \| integer \| number \| boolean} | | `--order-id` | `string` | Required. order_id | | `--reason` | `choice` | Required. Reason for the refund. (choices: duplicate, fraudulent, customer_request, service_disruption, satisfaction_guarantee, other) | | `--amount` | `integer` | Required. Amount to refund in cents. Minimum is 1. | | `--comment` | `string` | An internal comment about the refund. | | `--revoke-benefits` | `boolean` | Should this refund trigger the associated customer benefits to be revoked? | ## polar refunds list List refunds. ```bash theme={null} polar refunds list [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--id` | `string` | Filter by refund ID. | | `--organization-id`, `--org` | `string` | Filter by organization ID. Defaults to the active organization. | | `--order-id` | `string` | Filter by order ID. | | `--subscription-id` | `string` | Filter by subscription ID. | | `--customer-id` | `string` | Filter by customer ID. | | `--external-customer-id` | `string` | Filter by customer external ID. | | `--succeeded` | `boolean` | Filter by `succeeded`. | | `--page` | `integer` | Page number, defaults to 1. | | `--limit` | `integer` | Size of a page, defaults to 10. Maximum is 100. | | `--sorting` | `choice` | Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. (choices: created_at, -created_at, amount, -amount) | # polar subscriptions Source: https://polar.sh/docs/integrate/cli/reference/subscriptions ```bash theme={null} polar subscriptions [flags] ``` **Subcommands** * [`polar subscriptions get`](#polar-subscriptions-get) Get a subscription by ID. * [`polar subscriptions list`](#polar-subscriptions-list) List subscriptions. * [`polar subscriptions revoke`](#polar-subscriptions-revoke) Revoke a subscription, i.e cancel immediately. * [`polar subscriptions update`](#polar-subscriptions-update) Update a subscription. ## polar subscriptions get Get a subscription by ID. ```bash theme={null} polar subscriptions get [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar subscriptions list List subscriptions. ```bash theme={null} polar subscriptions list [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--organization-id`, `--org` | `string` | Filter by organization ID. Defaults to the active organization. | | `--product-id` | `string` | Filter by product ID. | | `--customer-id` | `string` | Filter by customer ID. | | `--external-customer-id` | `string` | Filter by customer external ID. | | `--discount-id` | `string` | Filter by discount ID. | | `--active` | `boolean` | Filter by active or inactive subscription. | | `--status` | `choice` | Filter by subscription status. (choices: incomplete, incomplete_expired, trialing, active, past_due, canceled, unpaid, paused) | | `--cancel-at-period-end` | `boolean` | Filter by subscriptions that are set to cancel at period end. | | `--customer-cancellation-reason` | `choice` | Filter by customer cancellation reason. (choices: customer_service, low_quality, missing_features, switched_service, too_complex, too_expensive, unused, other) | | `--canceled-at-after` | `string` | Filter by cancellation date (after or equal to). | | `--canceled-at-before` | `string` | Filter by cancellation date (before or equal to). | | `--started-after` | `string` | Only include subscriptions started after this date. | | `--started-before` | `string` | Only include subscriptions started before this date. | | `--page` | `integer` | Page number, defaults to 1. | | `--limit` | `integer` | Size of a page, defaults to 10. Maximum is 100. | | `--sorting` | `choice` | Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. (choices: customer, -customer, status, -status, started_at, -started_at, current_period_end, -current_period_end, ended_at, -ended_at, ends_at, -ends_at, amount, -amount, product, -product, discount, -discount) | | `--metadata` | `string` | Filter by metadata key-value pairs. JSON: \{"\": string \| integer \| boolean \| array of string \| array of integer \| array of boolean} | ## polar subscriptions revoke Revoke a subscription, i.e cancel immediately. ```bash theme={null} polar subscriptions revoke [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--confirm`, `-c` | `boolean` | Skip the confirmation prompt for destructive requests | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar subscriptions update Update a subscription. ```bash theme={null} polar subscriptions update [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--confirm`, `-c` | `boolean` | Skip the confirmation prompt for destructive requests | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--metadata` | `string` | Key-value object allowing you to store additional information. JSON: \{"\": string \| integer \| number \| boolean} | | `--product-id` | `string` | Update subscription to another product. | | `--proration-behavior` | `choice` | Determine how to handle the proration billing. If not provided, will use the default organization setting. (choices: invoice, prorate, next_period, reset) | | `--discount-id` | `string` | Update the subscription to apply a new discount. If set to `null`, the discount will be removed. The change will be applied on the next billing cycle. | | `--trial-end` | `string` | Set or extend the trial period of the subscription. If set to `now`, the trial will end immediately and the first billing cycle will be charged synchronously. The subscription remains trialing if the payment fails. | | `--seats` | `integer` | Update the number of seats for this subscription. | | `--units` | `integer` | Update the number of units for this subscription. | | `--current-billing-period-end` | `string` | Set a new date for the end of the current billing period. The subscription will renew on this date. The new date can be earlier or later than the current period end, as long as it's in the future. | | `--customer-cancellation-reason` | `choice` | Customer reason for cancellation. (choices: customer_service, low_quality, missing_features, switched_service, too_complex, too_expensive, unused, other) | | `--customer-cancellation-comment` | `string` | Customer feedback and why they decided to cancel. | | `--cancel-at-period-end` | `boolean` | Cancel an active subscription once the current period ends. | | `--revoke` | `string` | Cancel and revoke an active subscription immediately JSON: true | | `--pause-at-period-end` | `boolean` | Pause an active subscription at the end of the current period. | | `--resumes-at` | `string` | Date at which the paused subscription should automatically resume. | | `--resume` | `string` | Resume a paused subscription immediately, starting a new billing period and charging the customer. JSON: true | | `--pending-update` | `string` | Clear the pending subscription update. Set to null to remove scheduled changes. JSON: null | # polar webhooks Source: https://polar.sh/docs/integrate/cli/reference/webhooks ```bash theme={null} polar webhooks [flags] ``` **Subcommands** * [`polar webhooks create_webhook_endpoint`](#polar-webhooks-create_webhook_endpoint) Create a webhook endpoint. * [`polar webhooks delete_webhook_endpoint`](#polar-webhooks-delete_webhook_endpoint) Delete a webhook endpoint. * [`polar webhooks get_webhook_endpoint`](#polar-webhooks-get_webhook_endpoint) Get a webhook endpoint by ID. * [`polar webhooks list_webhook_deliveries`](#polar-webhooks-list_webhook_deliveries) List webhook deliveries. * [`polar webhooks list_webhook_endpoints`](#polar-webhooks-list_webhook_endpoints) List webhook endpoints. * [`polar webhooks redeliver_webhook_event`](#polar-webhooks-redeliver_webhook_event) Schedule the re-delivery of a webhook event. * [`polar webhooks reset_webhook_endpoint_secret`](#polar-webhooks-reset_webhook_endpoint_secret) Regenerate a webhook endpoint secret. * [`polar webhooks update_webhook_endpoint`](#polar-webhooks-update_webhook_endpoint) Update a webhook endpoint. ## polar webhooks create_webhook_endpoint Create a webhook endpoint. ```bash theme={null} polar webhooks create_webhook_endpoint [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--url` | `string` | Required. The URL where the webhook events will be sent. | | `--name` | `string` | An optional name for the webhook endpoint to help organize and identify it. | | `--api-version` | `choice` | The API version that'll be used in event payloads. (choices: 2026-04, 2026-10) | | `--format` | `choice` | Required. The format of the webhook payload. (choices: raw, discord, slack) | | `--events` | `choice` | Required. The events that will trigger the webhook. (choices: checkout.created, checkout.updated, checkout.expired, customer.created, customer.updated, customer.deleted, customer.state_changed, customer_seat.assigned, customer_seat.claimed, customer_seat.revoked, member.created, member.updated, member.deleted, order.created, order.updated, order.paid, order.refunded, subscription.created, subscription.updated, subscription.active, subscription.canceled, subscription.uncanceled, subscription.cycled, subscription.revoked, subscription.past_due, subscription.paused, subscription.resumed, subscription.migrated, refund.created, refund.updated, product.created, product.updated, discount.created, discount.updated, discount.deleted, benefit.created, benefit.updated, benefit_grant.created, benefit_grant.cycled, benefit_grant.updated, benefit_grant.revoked, organization.updated) | | `--organization-id`, `--org` | `string` | The organization ID associated with the webhook endpoint. Defaults to the active organization. | ## polar webhooks delete_webhook_endpoint Delete a webhook endpoint. ```bash theme={null} polar webhooks delete_webhook_endpoint [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--confirm`, `-c` | `boolean` | Skip the confirmation prompt for destructive requests | ## polar webhooks get_webhook_endpoint Get a webhook endpoint by ID. ```bash theme={null} polar webhooks get_webhook_endpoint [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar webhooks list_webhook_deliveries List webhook deliveries. ```bash theme={null} polar webhooks list_webhook_deliveries [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--endpoint-id` | `string` | Filter by webhook endpoint ID. | | `--start-timestamp` | `string` | Filter deliveries after this timestamp. | | `--end-timestamp` | `string` | Filter deliveries before this timestamp. | | `--succeeded` | `boolean` | Filter by delivery success status. | | `--query` | `string` | Query to filter webhook deliveries. | | `--http-code-class` | `choice` | Filter by HTTP response code class (2xx, 3xx, 4xx, 5xx). (choices: 2xx, 3xx, 4xx, 5xx) | | `--event-type` | `choice` | Filter by webhook event type. (choices: checkout.created, checkout.updated, checkout.expired, customer.created, customer.updated, customer.deleted, customer.state_changed, customer_seat.assigned, customer_seat.claimed, customer_seat.revoked, member.created, member.updated, member.deleted, order.created, order.updated, order.paid, order.refunded, subscription.created, subscription.updated, subscription.active, subscription.canceled, subscription.uncanceled, subscription.cycled, subscription.revoked, subscription.past_due, subscription.paused, subscription.resumed, subscription.migrated, refund.created, refund.updated, product.created, product.updated, discount.created, discount.updated, discount.deleted, benefit.created, benefit.updated, benefit_grant.created, benefit_grant.cycled, benefit_grant.updated, benefit_grant.revoked, organization.updated) | | `--page` | `integer` | Page number, defaults to 1. | | `--limit` | `integer` | Size of a page, defaults to 10. Maximum is 100. | ## polar webhooks list_webhook_endpoints List webhook endpoints. ```bash theme={null} polar webhooks list_webhook_endpoints [flags] ``` **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--organization-id`, `--org` | `string` | Filter by organization ID. Defaults to the active organization. | | `--page` | `integer` | Page number, defaults to 1. | | `--limit` | `integer` | Size of a page, defaults to 10. Maximum is 100. | ## polar webhooks redeliver_webhook_event Schedule the re-delivery of a webhook event. ```bash theme={null} polar webhooks redeliver_webhook_event [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar webhooks reset_webhook_endpoint_secret Regenerate a webhook endpoint secret. ```bash theme={null} polar webhooks reset_webhook_endpoint_secret [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--confirm`, `-c` | `boolean` | Skip the confirmation prompt for destructive requests | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | ## polar webhooks update_webhook_endpoint Update a webhook endpoint. ```bash theme={null} polar webhooks update_webhook_endpoint [flags] ``` **Arguments** | Argument | Type | Description | | - | - | - | | `id` | `string` | | **Flags** | Flag | Type | Description | | - | - | - | | `--confirm`, `-c` | `boolean` | Skip the confirmation prompt for destructive requests | | `--fields` | `string` | Only print these fields, comma-separated; use dots for nested ones, e.g. id,name,prices.price_amount | | `--data`, `-d` | `string` | JSON object; explicitly supplied flags override its top-level keys | | `--url` | `string` | url | | `--name` | `string` | An optional name for the webhook endpoint to help organize and identify it. | | `--api-version` | `choice` | The API version that'll be used in event payloads. (choices: 2026-04, 2026-10) | | `--format` | `choice` | format (choices: raw, discord, slack) | | `--events` | `choice` | events (choices: checkout.created, checkout.updated, checkout.expired, customer.created, customer.updated, customer.deleted, customer.state_changed, customer_seat.assigned, customer_seat.claimed, customer_seat.revoked, member.created, member.updated, member.deleted, order.created, order.updated, order.paid, order.refunded, subscription.created, subscription.updated, subscription.active, subscription.canceled, subscription.uncanceled, subscription.cycled, subscription.revoked, subscription.past_due, subscription.paused, subscription.resumed, subscription.migrated, refund.created, refund.updated, product.created, product.updated, discount.created, discount.updated, discount.deleted, benefit.created, benefit.updated, benefit_grant.created, benefit_grant.cycled, benefit_grant.updated, benefit_grant.revoked, organization.updated) | | `--enabled` | `boolean` | Whether the webhook endpoint is enabled. | # OAuth 2.0 Connect Source: https://polar.sh/docs/integrate/oauth2/connect ## Authorize To start the authorization flow you need to redirect the user to the authorization URL. It looks like this: ``` https://polar.sh/oauth2/authorize? response_type=code &client_id=CLIENT_ID &redirect_uri=https%3A%2F%2Fexample.com%2Fcallback &scope=openid%20email ``` The parameters are the one described in the [OpenID Connect specification](https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest). The most important ones are: **response_type=code** `string` *required* Indicates that you want to use the authorization code flow. Most common and the only one supported by Polar. **client_id** `string` *required* The Client ID you got when creating the OAuth 2.0 client. **redirect_uri** `string` *required* The URL where the user will be redirected after granting access to their data. Make sure you declared it when creating the OAuth2 client. **scope** `string` *required* A space-separated list of scopes you want to ask for. Make sure they are part of the scopes you declared when creating the OAuth2 client. If you redirect the user to this URL, they'll see a page asking them to grant access to their data, corresponding to the scopes you asked for. ![](https://mintcdn.com/polar/z84HinKP_G_UZoW1/assets/integrate/oauth2/connect.png?fit=max\&auto=format\&n=z84HinKP_G_UZoW1\&q=85\&s=5223122ad404d726bc7cec001561efff) Polar issues **user-scoped** access tokens, tied to the user granting access. On the consent screen, the user can optionally **limit the token to specific organizations**: by default it can access all of their organizations (including ones they join later), but if they select specific ones, it's restricted to those. Access always intersects with the user's current membership, so it adjusts automatically if they leave an organization. You can check which organizations a token is limited to by [introspecting it](/docs/api-reference/current/oauth2/introspect-token) — the response includes an `organizations` array (an empty array means all of them). If the user grants access, they'll be redirected to your `redirect_uri` with a `code` parameter in the query string. This code is a one-time code that you can exchange for an access token. #### Exchange code token Once you have the authorization code, you can exchange it for an access token. To do so, you'll need to make a `POST` request to the token endpoint. This call needs to be authenticated with the Client ID and Client Secret you got when creating the OAuth2 client. Here is an example with cURL: ```bash Terminal theme={null} curl -X POST https://api.polar.sh/v1/oauth2/token \ -H 'Content-Type: application/x-www-form-urlencoded' \ -d 'grant_type=authorization_code&code=AUTHORIZATION_CODE&client_id=CLIENT_ID&client_secret=CLIENT_SECRET&redirect_uri=https://example.com/callback' ``` You should get the following response: ```json theme={null} { "token_type": "Bearer", "access_token": "polar_at_XXX", "expires_in": 864000, "refresh_token": "polar_rt_XXX", "scope": "openid email", "id_token": "ID_TOKEN" } ``` The `access_token` will allow you to make authenticated API requests on behalf of the user. The `refresh_token` is a long-lived token that you can use to get new access tokens when the current one expires. The `id_token` is a signed JWT token containing information about the user, as per the [OpenID Connect specification](https://openid.net/specs/openid-connect-core-1_0.html#IDToken). #### Public Clients Public clients are clients where the Client Secret can't be kept safe, as it would be accessible by the final user. This is the case for SPA, mobile applications, or any client running on the user's device. In this case, **and only if the client is configured as a Public Client**, the request to the token endpoint won't require the `client_secret` parameter. However, the [PKCE](https://oauth.net/2/pkce/) method will be required to maximize security. ### Make authenticated requests Once you have an access token, either from a Personal Access Token or from the OpenID Connect flow, you can make authenticated requests to the API. Here is a simple example with cURL: ```bash Terminal theme={null} curl -X GET https://api.polar.sh/v1/oauth2/userinfo \ -H 'Authorization: Bearer polar_at_XXX' ``` # Introduction Source: https://polar.sh/docs/integrate/oauth2/introduction For partners building services and extensions for Polar customers ### OpenID Connect (OAuth2) Only use our **OpenID Connect** in case you want to act on the behalf of other users via our API, e.g building an app/service for Polar customers. Otherwise, always use an **Organization Access Token (OAT)** to integrate Polar for your own service. Polar implements the [OpenID Connect specification](https://openid.net/developers/how-connect-works/) to enable third-party authentication. It's a layer on top of the OAuth2 framework aiming at making integration more standard and predictable. In particular, it comes with a **discovery endpoint** allowing compatible clients to automatically work with the OpenID Connect server. Here is Polar's one: [OpenID Configuration](https://api.polar.sh/.well-known/openid-configuration) # Create an OAuth 2.0 Client Source: https://polar.sh/docs/integrate/oauth2/setup Before being able to make authentication requests, you'll need an **OAuth2 Client**. It's the entity that'll identify you, as a third-party developer, between Polar and the final user. You can manage them from your [**Account Settings → Developer**](https://polar.sh/dashboard/account/developer) Here are the required fields: * *Application Name*: the name of the application that'll be shown to the final users. * *Client Type*: the type of client you are creating. [Read more](#public-clients) * *Redirect URIs*: for security reasons, you need to declare your application URL where the users will be redirected after granting access to their data. > [!NOTE] > > When configuring your OAuth client, you must use an `https://` URL for security reasons. We block `http://` URLs, except when the hostname is `localhost`. This exception allows you to use `http://localhost` for convenient testing in development mode. * *Scopes*: the list of scopes your app will be able to ask for. To improve privacy and security, select only the scopes you really need for your application. * *Homepage URL*: the URL of your application. It'll be shown to the final users on the authorization page. Optionally, you can also add a **terms of service** and **privacy policy** URL. They'll be shown to the final users on the authorization page. Once your client is created, you'll get a **Client ID** and a **Client Secret**. You'll need those values to make authentication requests. Those values are super sensitive and should be kept secret. They allow making authentication requests on Polar! # Create Checkout Link Source: https://polar.sh/docs/api-reference/2026-10/checkout-links/create-checkout-link /openapi/2026-10.openapi.json post /v1/checkout-links/ Create a checkout link. **Scopes**: `checkout_links:write` > [!WARNING] > > Looking to create a single use checkout session? Checkout Links are probably **not** what you're looking for. > > Checkout Links are shareable links that generate checkout sessions when opened. They are very handy to start a purchase from your website or social media. > > However, if you want to start a checkout for one of your user **inside** your product, you should use the [Checkout Sessions API](/docs/api-reference/checkouts/create-checkout-session). # Delete Checkout Link Source: https://polar.sh/docs/api-reference/2026-10/checkout-links/delete-checkout-link /openapi/2026-10.openapi.json delete /v1/checkout-links/{id} Delete a checkout link. **Scopes**: `checkout_links:write` # Get Checkout Link Source: https://polar.sh/docs/api-reference/2026-10/checkout-links/get-checkout-link /openapi/2026-10.openapi.json get /v1/checkout-links/{id} Get a checkout link by ID. **Scopes**: `checkout_links:read` `checkout_links:write` # List Checkout Links Source: https://polar.sh/docs/api-reference/2026-10/checkout-links/list-checkout-links /openapi/2026-10.openapi.json get /v1/checkout-links/ List checkout links. **Scopes**: `checkout_links:read` `checkout_links:write` # Update Checkout Link Source: https://polar.sh/docs/api-reference/2026-10/checkout-links/update-checkout-link /openapi/2026-10.openapi.json patch /v1/checkout-links/{id} Update a checkout link. **Scopes**: `checkout_links:write` # Confirm Checkout Session from Client Source: https://polar.sh/docs/api-reference/2026-10/checkouts/confirm-checkout-session-from-client /openapi/2026-10.openapi.json post /v1/checkouts/client/{client_secret}/confirm Confirm a checkout session by client secret. Orders and subscriptions will be processed. # Create Checkout Session Source: https://polar.sh/docs/api-reference/2026-10/checkouts/create-checkout-session /openapi/2026-10.openapi.json post /v1/checkouts/ Create a checkout session. **Scopes**: `checkouts:write` # Get Checkout Session Source: https://polar.sh/docs/api-reference/2026-10/checkouts/get-checkout-session /openapi/2026-10.openapi.json get /v1/checkouts/{id} Get a checkout session by ID. **Scopes**: `checkouts:read` `checkouts:write` # Get Checkout Session from Client Source: https://polar.sh/docs/api-reference/2026-10/checkouts/get-checkout-session-from-client /openapi/2026-10.openapi.json get /v1/checkouts/client/{client_secret} Get a checkout session by client secret. # List Checkout Sessions Source: https://polar.sh/docs/api-reference/2026-10/checkouts/list-checkout-sessions /openapi/2026-10.openapi.json get /v1/checkouts/ List checkout sessions. **Scopes**: `checkouts:read` `checkouts:write` # Update Checkout Session Source: https://polar.sh/docs/api-reference/2026-10/checkouts/update-checkout-session /openapi/2026-10.openapi.json patch /v1/checkouts/{id} Update a checkout session. **Scopes**: `checkouts:write` # Update Checkout Session from Client Source: https://polar.sh/docs/api-reference/2026-10/checkouts/update-checkout-session-from-client /openapi/2026-10.openapi.json patch /v1/checkouts/client/{client_secret} Update a checkout session by client secret. # Create Custom Field Source: https://polar.sh/docs/api-reference/2026-10/custom-fields/create-custom-field /openapi/2026-10.openapi.json post /v1/custom-fields/ Create a custom field. **Scopes**: `custom_fields:write` # Delete Custom Field Source: https://polar.sh/docs/api-reference/2026-10/custom-fields/delete-custom-field /openapi/2026-10.openapi.json delete /v1/custom-fields/{id} Delete a custom field. **Scopes**: `custom_fields:write` # Get Custom Field Source: https://polar.sh/docs/api-reference/2026-10/custom-fields/get-custom-field /openapi/2026-10.openapi.json get /v1/custom-fields/{id} Get a custom field by ID. **Scopes**: `custom_fields:read` `custom_fields:write` # List Custom Fields Source: https://polar.sh/docs/api-reference/2026-10/custom-fields/list-custom-fields /openapi/2026-10.openapi.json get /v1/custom-fields/ List custom fields. **Scopes**: `custom_fields:read` `custom_fields:write` # Update Custom Field Source: https://polar.sh/docs/api-reference/2026-10/custom-fields/update-custom-field /openapi/2026-10.openapi.json patch /v1/custom-fields/{id} Update a custom field. **Scopes**: `custom_fields:write` # Create Customer Source: https://polar.sh/docs/api-reference/2026-10/customers/create-customer /openapi/2026-10.openapi.json post /v1/customers/ Create a customer. Set `external_id` to the customer's ID in your system to look it up by that ID. **Scopes**: `customers:write` # Delete Customer Source: https://polar.sh/docs/api-reference/2026-10/customers/delete-customer /openapi/2026-10.openapi.json delete /v1/customers/{id} Delete a customer. This action cannot be undone and will immediately: - Cancel any active subscriptions for the customer - Revoke all their benefits - Clear any `external_id` Use it only in the context of deleting a user within your own service. Otherwise, use more granular API endpoints to cancel a specific subscription or revoke certain benefits. Note: The customers information will nonetheless be retained for historic orders and subscriptions. Set `anonymize=true` to also anonymize PII for GDPR compliance. **Scopes**: `customers:write` # Delete Customer by External ID Source: https://polar.sh/docs/api-reference/2026-10/customers/delete-customer-by-external-id /openapi/2026-10.openapi.json delete /v1/customers/external/{external_id} Delete a customer by external ID. Immediately cancels any active subscriptions and revokes any active benefits. Set `anonymize=true` to also anonymize PII for GDPR compliance. **Scopes**: `customers:write` # Get Customer Source: https://polar.sh/docs/api-reference/2026-10/customers/get-customer /openapi/2026-10.openapi.json get /v1/customers/{id} Get a customer by ID. **Scopes**: `customers:read` `customers:write` # Get Customer by External ID Source: https://polar.sh/docs/api-reference/2026-10/customers/get-customer-by-external-id /openapi/2026-10.openapi.json get /v1/customers/external/{external_id} Get a customer by external ID. **Scopes**: `customers:read` `customers:write` # Get Customer State Source: https://polar.sh/docs/api-reference/2026-10/customers/get-customer-state /openapi/2026-10.openapi.json get /v1/customers/{id}/state Get a customer state by ID. The customer state includes information about the customer's active subscriptions and benefits. It's the ideal endpoint to use when you need to get a full overview of a customer's status. **Scopes**: `customers:read` `customers:write` # Get Customer State by External ID Source: https://polar.sh/docs/api-reference/2026-10/customers/get-customer-state-by-external-id /openapi/2026-10.openapi.json get /v1/customers/external/{external_id}/state Get a customer state by external ID. The customer state includes information about the customer's active subscriptions and benefits. It's the ideal endpoint to use when you need to get a full overview of a customer's status. **Scopes**: `customers:read` `customers:write` # List Customer Payment Methods Source: https://polar.sh/docs/api-reference/2026-10/customers/list-customer-payment-methods /openapi/2026-10.openapi.json get /v1/customers/{id}/payment-methods Get saved payment methods of a customer. **Scopes**: `customers:read` `customers:write` # List Customer Payment Methods by External ID Source: https://polar.sh/docs/api-reference/2026-10/customers/list-customer-payment-methods-by-external-id /openapi/2026-10.openapi.json get /v1/customers/external/{external_id}/payment-methods Get saved payment methods of a customer by external ID. **Scopes**: `customers:read` `customers:write` # List Customers Source: https://polar.sh/docs/api-reference/2026-10/customers/list-customers /openapi/2026-10.openapi.json get /v1/customers/ List customers. **Scopes**: `customers:read` `customers:write` # Update Customer Source: https://polar.sh/docs/api-reference/2026-10/customers/update-customer /openapi/2026-10.openapi.json patch /v1/customers/{id} Update a customer. **Scopes**: `customers:write` # Update Customer by External ID Source: https://polar.sh/docs/api-reference/2026-10/customers/update-customer-by-external-id /openapi/2026-10.openapi.json patch /v1/customers/external/{external_id} Update a customer by external ID. **Scopes**: `customers:write` # Create Discount Source: https://polar.sh/docs/api-reference/2026-10/discounts/create-discount /openapi/2026-10.openapi.json post /v1/discounts/ Create a discount. **Scopes**: `discounts:write` # Delete Discount Source: https://polar.sh/docs/api-reference/2026-10/discounts/delete-discount /openapi/2026-10.openapi.json delete /v1/discounts/{id} Delete a discount. **Scopes**: `discounts:write` # Get Discount Source: https://polar.sh/docs/api-reference/2026-10/discounts/get-discount /openapi/2026-10.openapi.json get /v1/discounts/{id} Get a discount by ID. **Scopes**: `discounts:read` `discounts:write` # List Discounts Source: https://polar.sh/docs/api-reference/2026-10/discounts/list-discounts /openapi/2026-10.openapi.json get /v1/discounts/ List discounts. **Scopes**: `discounts:read` `discounts:write` # Update Discount Source: https://polar.sh/docs/api-reference/2026-10/discounts/update-discount /openapi/2026-10.openapi.json patch /v1/discounts/{id} Update a discount. **Scopes**: `discounts:write` # Accept Dispute Source: https://polar.sh/docs/api-reference/2026-10/disputes/accept-dispute /openapi/2026-10.openapi.json post /v1/disputes/{id}/accept Accept a dispute, conceding the chargeback. Closes the dispute with the processor (settling it as `lost`) and records the merchant's decision on the dispute's support case. **Scopes**: `disputes:write` # Get Dispute Source: https://polar.sh/docs/api-reference/2026-10/disputes/get-dispute /openapi/2026-10.openapi.json get /v1/disputes/{id} Get a dispute by ID. **Scopes**: `disputes:read` `disputes:write` # List Disputes Source: https://polar.sh/docs/api-reference/2026-10/disputes/list-disputes /openapi/2026-10.openapi.json get /v1/disputes/ List disputes. **Scopes**: `disputes:read` `disputes:write` # Get Event Source: https://polar.sh/docs/api-reference/2026-10/events/get-event /openapi/2026-10.openapi.json get /v1/events/{id} Get an event by ID. **Scopes**: `events:read` `events:write` # Ingest Events Source: https://polar.sh/docs/api-reference/2026-10/events/ingest-events /openapi/2026-10.openapi.json post /v1/events/ingest Ingest batch of events. **Scopes**: `events:write` # List Events Source: https://polar.sh/docs/api-reference/2026-10/events/list-events /openapi/2026-10.openapi.json get /v1/events/ List events. **Scopes**: `events:read` `events:write` # API Overview Source: https://polar.sh/docs/api-reference/2026-10/introduction Official SDK quickstarts, base URLs, authentication, pagination, rate limits, and API concepts > [card] Production Base URL > > `https://api.polar.sh/v1` > [card] Sandbox Base URL > > `https://sandbox-api.polar.sh/v1` > [card] [Auth (Organization)](/docs/integrate/oat) > > Use an **Organization Access Token (OAT)** in the `Authorization: Bearer` > header > [card] [Auth (Customer Portal)](/docs/api-reference/2026-10/customer-sessions/create-customer-session) > > Use a **Customer Access Token** created via `/v1/customer-sessions/` ## Official SDKs Use our new, fully typed SDKs to integrate with the Polar API from TypeScript or Python. Create an [organization access token](/docs/integrate/oat), then install the SDK and make your first request: > [tab] TypeScript > > ```bash npm theme={null} > npm install @polar-sh/sdk > ``` > > ```typescript app.ts theme={null} > import { createPolar } from "@polar-sh/sdk/2026-10"; > > const polar = createPolar({ > accessToken: process.env.POLAR_ACCESS_TOKEN!, > }); > > const customerState = await polar.customers.getStateExternal("customer_external_id"); > console.log(customerState); > ``` > [tab] Python > > ```bash uv theme={null} > uv add polar-sdk > ``` > > ```bash pip theme={null} > pip install polar-sdk > ``` > > ```python main.py theme={null} > import os > > from polar.v2026_10 import Polar > > polar = Polar(os.environ["POLAR_ACCESS_TOKEN"]) > > customer_state = polar.customers.get_state_external("customer_external_id") > print(customer_state) > ``` Both clients use production by default. Pass `environment="sandbox"` in Python or `environment: "sandbox"` in TypeScript to use the [sandbox environment](/docs/integrate/sandbox). ## Base URLs | Environment | Base URL | Purpose | | - | - | - | | Production | `https://api.polar.sh/v1` | Real customers & live payments | | Sandbox | `https://sandbox-api.polar.sh/v1` | Safe testing & integration work | > [!NOTE] > > The sandbox environment is fully isolated—data, users, tokens, and > organizations created there do not affect production. Create separate tokens > in each environment. Read more: [Sandbox Environment](/docs/integrate/sandbox) ## Authentication ### Organization Access Tokens (OAT) Use an **OAT** to act on behalf of your organization (manage products, prices, checkouts, orders, subscriptions, benefits, etc.). ```http theme={null} Authorization: Bearer polar_oat_xxxxxxxxxxxxxxxxx ``` > [!TIP] > > Create OATs in your organization settings. See: [Organization Access > Tokens](/docs/integrate/oat) > [!WARNING] > > Never expose an OAT in client-side code, public repos, or logs. If leaked, it > will be revoked automatically by our secret scanning integrations. ### Customer Access Tokens Do **not** use OATs in the browser. For customer-facing flows, [generate a **Customer Session**](/docs/api-reference/2026-10/customer-sessions/create-customer-session) server-side, then use the returned **customer access token** with the **Customer Portal API** to let a signed-in customer view their own orders, subscriptions, and benefits. ## Core API vs Customer Portal API | Aspect | Core API | Customer Portal API | | - | - | - | | Audience | Your server / backend | One of your customer | | Auth Type | Organization Access Token (OAT) | Customer Access Token | | Scope | Full org resources (products, orders, subscriptions, benefits, checkout) | Only the authenticated customer’s data | | Typical Use | Admin dashboards, internal tools, automation, provisioning | Building a custom customer portal or gated app | | Token Creation | Via dashboard (manual) | Via `/v1/customer-sessions/` (server-side) | | Sensitive Operations | Yes (create/update products, issue refunds, etc.) | No (read/update only what the customer owns) | > [!NOTE] > > The Customer Portal API is a *restricted* surface designed for safe exposure > in user-facing contexts (after exchanging a session). It cannot perform > privileged org-level mutations like creating products or issuing refunds. ## Quick Examples ```bash curl (Production - Core API) theme={null} curl https://api.polar.sh/v1/products/ \ -H "Authorization: Bearer $POLAR_OAT" \ -H "Accept: application/json" ``` ```bash curl (Sandbox - Core API) theme={null} curl https://sandbox-api.polar.sh/v1/products/ \ -H "Authorization: Bearer $POLAR_OAT_SANDBOX" \ -H "Accept: application/json" ``` ```bash curl (Customer Portal API) theme={null} curl https://api.polar.sh/v1/customer-portal/orders/ \ -H "Authorization: Bearer $POLAR_CUSTOMER_TOKEN" \ -H "Accept: application/json" ``` ## Pagination List endpoints in the Polar API support pagination to help you efficiently retrieve large datasets. Use the `page` and `limit` query parameters to control pagination. ### Query Parameters | Parameter | Type | Default | Max | Description | | - | - | - | - | - | | `page` | integer | `1` | - | Page number, starting from 1 | | `limit` | integer | `10` | `100` | Number of items to return per page (window size) | > [!NOTE] > > The `page` parameter works as a window offset. For example, `page=2&limit=10` > means the API will skip the first 10 elements and return the next 10. ### Response Format All paginated responses include a `pagination` object with metadata about the current page and total results: | Field | Type | Description | | - | - | - | | `total_count` | integer | Total number of items matching your query across all pages | | `max_page` | integer | Total number of pages available, given the current `limit` value | ### Example Let's say you want to fetch products with a limit of 100 items per page: ```bash Request theme={null} curl https://api.polar.sh/v1/products/?page=1&limit=100 \ -H "Authorization: Bearer $POLAR_OAT" \ -H "Accept: application/json" ``` ```json Response theme={null} { "items": [ { "id": "...", "name": "Product 1", ... }, ... ], "pagination": { "total_count": 250, "max_page": 3 } } ``` In this example: * `total_count=250` indicates there are 250 total products * `limit=100` means each page contains up to 100 products * `max_page=3` means you need to make 3 requests to retrieve all products (pages 1, 2, and 3) > [!TIP] > > To retrieve all pages, increment the `page` parameter from `1` to `max_page`. > Our SDKs provide built-in pagination helpers to automatically iterate through > all pages. ## Rate Limits Polar API has rate limits to ensure fair usage and maintain performance. Limits differ between the **Sandbox** and **Production** environments. ### Production * **500 requests per minute** per organization/customer or OAuth2 Client. ### Sandbox * **100 requests per minute** per organization/customer or OAuth2 Client. Unauthenticated [validation](/docs/api-reference/2026-10/customer_portal/validate-license-key), [activation](/docs/api-reference/2026-10/customer_portal/activate-license-key), and [deactivation](/docs/api-reference/2026-10/customer_portal/deactivate-license-key) endpoints are limited to **3 requests per second** in both environments. If you exceed the rate limit, you will receive a `429 Too Many Requests` response. The response will include a `Retry-After` header indicating how long you should wait before making another request. > [!NOTE] > > Organizations requiring higher rate limits for production workloads may > contact our support team to discuss elevated limits. # Create Meter Source: https://polar.sh/docs/api-reference/2026-10/meters/create-meter /openapi/2026-10.openapi.json post /v1/meters/ Create a meter. **Scopes**: `meters:write` # Get Meter Source: https://polar.sh/docs/api-reference/2026-10/meters/get-meter /openapi/2026-10.openapi.json get /v1/meters/{id} Get a meter by ID. **Scopes**: `meters:read` `meters:write` # Create Order Source: https://polar.sh/docs/api-reference/2026-10/orders/create-order /openapi/2026-10.openapi.json post /v1/orders/ Create a draft order for an off-session charge against a saved payment method. The order is created with `status=draft` and no invoice number; call `POST /v1/orders/{id}/finalize` to attempt the charge. The organization must have the `off_session_charges_enabled` feature flag. **Scopes**: `orders:write` # Export Orders Source: https://polar.sh/docs/api-reference/2026-10/orders/export-orders /openapi/2026-10.openapi.json get /v1/orders/export Export orders as a CSV file. **Scopes**: `orders:read` # Finalize Order Source: https://polar.sh/docs/api-reference/2026-10/orders/finalize-order /openapi/2026-10.openapi.json post /v1/orders/{id}/finalize Finalize a draft order and synchronously attempt an off-session charge. On success, the order transitions to `paid` and benefit grants fire before the response returns. On failure (decline, missing payment method, SCA challenge), the order stays in `draft` and a 4xx error is returned. The request fails with 412 if the order is not in `draft` status. **Scopes**: `orders:write` # Generate Order Invoice Source: https://polar.sh/docs/api-reference/2026-10/orders/generate-order-invoice /openapi/2026-10.openapi.json post /v1/orders/{id}/invoice Trigger generation of an order's invoice. **Scopes**: `orders:read` > [!WARNING] > > Once the invoice is generated, it's permanent and cannot be modified. > > Make sure the billing details (name and address) are correct before generating the invoice. You can update them before generating the invoice by calling the [`PATCH /v1/orders/{id}`](/docs/api-reference/orders/update-order) endpoint. > [!NOTE] > > After successfully calling this endpoint, you get a `202` response, meaning the generation of the invoice has been scheduled. It usually only takes a few seconds before you can retrieve the invoice using the [`GET /v1/orders/{id}/invoice`](/docs/api-reference/orders/get-order-invoice) endpoint. > > If you want a reliable notification when the invoice is ready, you can listen to the [`order.updated`](/docs/api-reference/orderupdated) webhook and check the [`is_invoice_generated` field](/docs/api-reference/orderupdated#schema-data-is-invoice-generated). # Get Order Source: https://polar.sh/docs/api-reference/2026-10/orders/get-order /openapi/2026-10.openapi.json get /v1/orders/{id} Get an order by ID. **Scopes**: `orders:read` # Get Order Invoice Source: https://polar.sh/docs/api-reference/2026-10/orders/get-order-invoice /openapi/2026-10.openapi.json get /v1/orders/{id}/invoice Get an order's invoice data. **Scopes**: `orders:read` > [!NOTE] > > The invoice must be generated first before it can be retrieved. You should call the [`POST /v1/orders/{id}/invoice`](/docs/api-reference/orders/generate-order-invoice) endpoint to generate the invoice. > > If the invoice is not generated, you will receive a `404` error. # Get Order Receipt Source: https://polar.sh/docs/api-reference/2026-10/orders/get-order-receipt /openapi/2026-10.openapi.json get /v1/orders/{id}/receipt Get a presigned URL to download an order's receipt PDF. **Scopes**: `orders:read` # List Orders Source: https://polar.sh/docs/api-reference/2026-10/orders/list-orders /openapi/2026-10.openapi.json get /v1/orders/ List orders. **Scopes**: `orders:read` # Update Order Source: https://polar.sh/docs/api-reference/2026-10/orders/update-order /openapi/2026-10.openapi.json patch /v1/orders/{id} Update an order. **Scopes**: `orders:write` # Get Payment Source: https://polar.sh/docs/api-reference/2026-10/payments/get-payment /openapi/2026-10.openapi.json get /v1/payments/{id} Get a payment by ID. **Scopes**: `payments:read` # List Payments Source: https://polar.sh/docs/api-reference/2026-10/payments/list-payments /openapi/2026-10.openapi.json get /v1/payments/ List payments. **Scopes**: `payments:read` # Create Product Source: https://polar.sh/docs/api-reference/2026-10/products/create-product /openapi/2026-10.openapi.json post /v1/products/ Create a product. **Scopes**: `products:write` # Delete Product Source: https://polar.sh/docs/api-reference/2026-10/products/delete-product /openapi/2026-10.openapi.json delete /v1/products/{id} Delete a product. Only products without orders, subscriptions, trials or discounts can be deleted. Products that are in use can only be archived. **Scopes**: `products:write` # Get Product Source: https://polar.sh/docs/api-reference/2026-10/products/get-product /openapi/2026-10.openapi.json get /v1/products/{id} Get a product by ID. **Scopes**: `products:read` `products:write` # List Products Source: https://polar.sh/docs/api-reference/2026-10/products/list-products /openapi/2026-10.openapi.json get /v1/products/ List products. **Scopes**: `products:read` `products:write` # Update Product Source: https://polar.sh/docs/api-reference/2026-10/products/update-product /openapi/2026-10.openapi.json patch /v1/products/{id} Update a product. **Scopes**: `products:write` # Update Product Benefits Source: https://polar.sh/docs/api-reference/2026-10/products/update-product-benefits /openapi/2026-10.openapi.json post /v1/products/{id}/benefits Update benefits granted by a product. **Scopes**: `products:write` # Create Refund Source: https://polar.sh/docs/api-reference/2026-10/refunds/create-refund /openapi/2026-10.openapi.json post /v1/refunds/ Create a refund. **Scopes**: `refunds:write` # List Refunds Source: https://polar.sh/docs/api-reference/2026-10/refunds/list-refunds /openapi/2026-10.openapi.json get /v1/refunds/ List refunds. **Scopes**: `refunds:read` `refunds:write` # Create Subscription Source: https://polar.sh/docs/api-reference/2026-10/subscriptions/create-subscription /openapi/2026-10.openapi.json post /v1/subscriptions/ Create a subscription programmatically. This endpoint only allows to create subscription on free products. For paid products, use the checkout flow. No initial order will be created and no confirmation email will be sent. **Scopes**: `subscriptions:write` # Get Subscription Source: https://polar.sh/docs/api-reference/2026-10/subscriptions/get-subscription /openapi/2026-10.openapi.json get /v1/subscriptions/{id} Get a subscription by ID. **Scopes**: `subscriptions:read` `subscriptions:write` # List Subscriptions Source: https://polar.sh/docs/api-reference/2026-10/subscriptions/list-subscriptions /openapi/2026-10.openapi.json get /v1/subscriptions/ List subscriptions. **Scopes**: `subscriptions:read` `subscriptions:write` # Revoke Subscription Source: https://polar.sh/docs/api-reference/2026-10/subscriptions/revoke-subscription /openapi/2026-10.openapi.json delete /v1/subscriptions/{id} Revoke a subscription, i.e cancel immediately. **Scopes**: `subscriptions:write` # Update Subscription Source: https://polar.sh/docs/api-reference/2026-10/subscriptions/update-subscription /openapi/2026-10.openapi.json patch /v1/subscriptions/{id} Update a subscription. **Scopes**: `subscriptions:write` # API Versioning Source: https://polar.sh/docs/api-reference/2026-10/versioning Learn how Polar API versions are selected, released, deprecated, and upgraded. Polar uses date-based API versions to evolve the API without unexpectedly changing the contract your integration depends on. Versions use the `YYYY-MM` format, such as 2026-10, and apply to API requests, responses, webhook payloads, and SDK types. > [!WARNING] > > Pin a version in every production integration. If you don't, your requests use > the Current version, which changes at each quarterly release. ## Choosing a version Polar maintains three API versions at a time: | Version | Stability | When to use it | | - | - | - | | **Current** | Stable and the default | New production integrations | | **Deprecated** | Stable until the next quarterly release, when it is removed | Existing integrations while you migrate to Current | | **Next** | In development and may introduce breaking changes at any time | Testing upcoming features before they become Current | Don't start a new integration on Deprecated. Use Next only if you need an upcoming feature and can adapt to changes during the development cycle. ## Version lifecycle Polar releases a new API version during the first week of January, April, July, and October. At each release: 1. Deprecated is removed and no longer accepts requests. 2. Current becomes Deprecated. 3. Next becomes Current and its API contract is frozen. 4. A new Next version is created for ongoing development. Each version is supported for approximately nine months: three months as Next, three months as Current, and three months as Deprecated. ```mermaid theme={null} flowchart LR next["Next
Development"] --> current["Current
Stable and default"] current --> deprecated["Deprecated
Stable until next release"] deprecated -.-> removed(["Removed"]) classDef void fill:transparent,stroke:#9ca3af,stroke-dasharray:5 5,color:#6b7280 class removed void ``` Current and Deprecated are frozen. New endpoints and any changes to request or response schemas (including additive changes such as a new optional field) are introduced in Next. Bug fixes, performance improvements, and internal changes can be released to stable versions when they don't change the public API contract. The versioned contract includes endpoints, fields and types, validation rules, status and error responses, and authentication requirements. ## Pinning API requests Set the version with the `Polar-Version` request header. The base URL and endpoint paths remain the same: ```bash theme={null} curl -i https://api.polar.sh/v1/products/ \ -H "Authorization: Bearer $POLAR_ACCESS_TOKEN" \ -H "Polar-Version: 2026-10" \ -H "Accept: application/json" ``` Responses include the version used to process the request: ```http theme={null} Polar-Version: 2026-10 ``` If the header is omitted, Polar uses Current. A malformed, unknown, or removed version returns `404 Not Found`. ## Pinning webhooks Webhook endpoints are versioned independently from API requests so their payloads remain stable across release cycles. Set `api_version` when you create an endpoint: ```json theme={null} { "url": "https://example.com/webhooks", "format": "raw", "events": ["order.created"], "api_version": "2026-10" } ``` If you omit `api_version`, the endpoint uses Current. Only supported API versions are accepted. The selected version determines which fields are included in future raw event payloads. You can update an endpoint's `api_version`, but the change applies only to events created afterward. Existing events retain their original version, so a redelivery has the same payload contract as the first delivery. Every delivery includes the selected version in the `webhook-api-version` header. Raw JSON payloads also include it in the `api_version` field. Use the same version for API requests and webhooks unless you intentionally support different contracts. Updating the version used by your API client does not migrate existing webhook endpoints; upgrade them separately. ## Pinning SDKs The [Python SDK](/docs/integrate/sdk/python) and [TypeScript SDK](/docs/integrate/sdk/typescript) include typed clients and models for each supported API version. Importing a versioned client automatically sets the matching `Polar-Version` header: > [tab] Python > > ```py theme={null} > from polar.v2026_10 import Polar > ``` > [tab] JavaScript > > ```ts theme={null} > import { createPolar } from "@polar-sh/sdk/2026-10"; > ``` The SDK package version and API version are separate. Updating the package can deliver fixes without changing your API contract; changing the version in the import path upgrades the API contract. ## Upgrading versions Upgrade before your pinned version is removed: 1. Review the new version's API reference and release notes. 2. Change the `Polar-Version` header or versioned SDK import in your sandbox environment. 3. Run your integration tests and update code for changed endpoints, fields, or webhook payloads. 4. Upgrade webhook endpoints that should use the new contract. 5. Deploy the API client change and confirm the `Polar-Version` response header. # List Benefit Grants Source: https://polar.sh/docs/api-reference/2026-10/benefit-grants/list-benefit-grants /openapi/2026-10.openapi.json get /v1/benefit-grants/ List benefit grants across all benefits accessible to the authenticated subject. **Scopes**: `benefits:read` `benefits:write` # Create Benefit Source: https://polar.sh/docs/api-reference/2026-10/benefits/create-benefit /openapi/2026-10.openapi.json post /v1/benefits/ Create a benefit, for example license keys, file downloads or Discord access. **Scopes**: `benefits:write` # Delete Benefit Source: https://polar.sh/docs/api-reference/2026-10/benefits/delete-benefit /openapi/2026-10.openapi.json delete /v1/benefits/{id} Delete a benefit. > [!WARNING] > Every grants associated with the benefit will be revoked. > Users will lose access to the benefit. **Scopes**: `benefits:write` # Get Benefit Source: https://polar.sh/docs/api-reference/2026-10/benefits/get-benefit /openapi/2026-10.openapi.json get /v1/benefits/{id} Get a benefit by ID. **Scopes**: `benefits:read` `benefits:write` # List Benefit Grants Source: https://polar.sh/docs/api-reference/2026-10/benefits/list-benefit-grants /openapi/2026-10.openapi.json get /v1/benefits/{id}/grants List the individual grants for a benefit. It's especially useful to check if a user has been granted a benefit. **Scopes**: `benefits:read` `benefits:write` # List Benefits Source: https://polar.sh/docs/api-reference/2026-10/benefits/list-benefits /openapi/2026-10.openapi.json get /v1/benefits/ List benefits. **Scopes**: `benefits:read` `benefits:write` # Update Benefit Source: https://polar.sh/docs/api-reference/2026-10/benefits/update-benefit /openapi/2026-10.openapi.json patch /v1/benefits/{id} Update a benefit. **Scopes**: `benefits:write` # checkout.created Source: https://polar.sh/docs/api-reference/2026-10/checkout_created /openapi/2026-10.openapi.json webhook checkout.created Sent when a new checkout is created. **Discord & Slack support:** Basic # checkout.expired Source: https://polar.sh/docs/api-reference/2026-10/checkout_expired /openapi/2026-10.openapi.json webhook checkout.expired Sent when a checkout expires. This event fires when a checkout reaches its expiration time without being completed. Developers can use this to send reminder emails or track checkout abandonment. **Discord & Slack support:** Basic # checkout.updated Source: https://polar.sh/docs/api-reference/2026-10/checkout_updated /openapi/2026-10.openapi.json webhook checkout.updated Sent when a checkout is updated. **Discord & Slack support:** Basic # Assign Seat Source: https://polar.sh/docs/api-reference/2026-10/customer-seats/assign-seat /openapi/2026-10.openapi.json post /v1/customer-seats Assign a seat for a subscription or order. **Scopes**: `customer_seats:write` # Claim Seat Source: https://polar.sh/docs/api-reference/2026-10/customer-seats/claim-seat /openapi/2026-10.openapi.json post /v1/customer-seats/claim Claim a customer seat with an invitation token. # Get Claim Info Source: https://polar.sh/docs/api-reference/2026-10/customer-seats/get-claim-info /openapi/2026-10.openapi.json get /v1/customer-seats/claim/{invitation_token} Get claim information for a customer seat invitation. # List Seats Source: https://polar.sh/docs/api-reference/2026-10/customer-seats/list-seats /openapi/2026-10.openapi.json get /v1/customer-seats List seats for a subscription or order. **Scopes**: `customer_seats:read` # Resend Invitation Source: https://polar.sh/docs/api-reference/2026-10/customer-seats/resend-invitation /openapi/2026-10.openapi.json post /v1/customer-seats/{seat_id}/resend Resend an invitation for a pending customer seat. **Scopes**: `customer_seats:write` # Revoke Seat Source: https://polar.sh/docs/api-reference/2026-10/customer-seats/revoke-seat /openapi/2026-10.openapi.json delete /v1/customer-seats/{seat_id} Revoke a customer seat. **Scopes**: `customer_seats:write` # Create Customer Session Source: https://polar.sh/docs/api-reference/2026-10/customer-sessions/create-customer-session /openapi/2026-10.openapi.json post /v1/customer-sessions/ Create a customer session. For organizations with `member_model_enabled`, this will automatically create a member session for the owner member of the customer. **Scopes**: `customer_sessions:write` # customer.created Source: https://polar.sh/docs/api-reference/2026-10/customer_created /openapi/2026-10.openapi.json webhook customer.created Sent when a new customer is created. A customer can be created: * After a successful checkout. * Programmatically via the API. **Discord & Slack support:** Basic # customer.deleted Source: https://polar.sh/docs/api-reference/2026-10/customer_deleted /openapi/2026-10.openapi.json webhook customer.deleted Sent when a customer is deleted. **Discord & Slack support:** Basic # Get Customer Meter Source: https://polar.sh/docs/api-reference/2026-10/customer_meters/get-customer-meter /openapi/2026-10.openapi.json get /v1/customer-meters/{id} Get a customer meter by ID. **Scopes**: `customer_meters:read` # List Customer Meters Source: https://polar.sh/docs/api-reference/2026-10/customer_meters/list-customer-meters /openapi/2026-10.openapi.json get /v1/customer-meters/ List customer meters. **Scopes**: `customer_meters:read` # Activate License Key Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/activate-license-key /openapi/2026-10.openapi.json post /v1/customer-portal/license-keys/activate Activate a license key instance. > This endpoint doesn't require authentication and can be safely used on a public > client, like a desktop application or a mobile app. > If you plan to validate a license key on a server, use the `/v1/license-keys/activate` > endpoint instead. > [!TIP] > > You only need to use this endpoint if you have device **activations** enabled on the license key benefit. You then use this endpoint to reserve an allocation for a specific device. Store the unique activation ID from the response on the device and use it as extra validation in the [/validate](/docs/api-reference/customer_portal/validate-license-key) endpoint. > > Not using **activations**? Just use the [/validate](/docs/api-reference/customer_portal/validate-license-key) endpoint directly instead. # Add Customer Payment Method Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/add-customer-payment-method /openapi/2026-10.openapi.json post /v1/customer-portal/customers/me/payment-methods Add a payment method to the authenticated customer. # Add Member Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/add-member /openapi/2026-10.openapi.json post /v1/customer-portal/members Add a new member to the customer's team. Only available to owners and billing managers of team customers. Rules: - Cannot add a member with the owner role (there must be exactly one owner) - If a member with this email already exists, the existing member is returned # Assign Seat Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/assign-seat /openapi/2026-10.openapi.json post /v1/customer-portal/seats # Cancel Subscription Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/cancel-subscription /openapi/2026-10.openapi.json delete /v1/customer-portal/subscriptions/{id} Cancel a subscription of the authenticated customer. # Check Email Change Token Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/check-email-change-token /openapi/2026-10.openapi.json get /v1/customer-portal/customers/me/email-update/check Check if an email change verification token is still valid. # Confirm Customer Payment Method Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/confirm-customer-payment-method /openapi/2026-10.openapi.json post /v1/customer-portal/customers/me/payment-methods/confirm Confirm a payment method for the authenticated customer. # Deactivate License Key Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/deactivate-license-key /openapi/2026-10.openapi.json post /v1/customer-portal/license-keys/deactivate Deactivate a license key instance. > This endpoint doesn't require authentication and can be safely used on a public > client, like a desktop application or a mobile app. > If you plan to validate a license key on a server, use the `/v1/license-keys/deactivate` > endpoint instead. # Delete Customer Payment Method Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/delete-customer-payment-method /openapi/2026-10.openapi.json delete /v1/customer-portal/customers/me/payment-methods/{id} Delete a payment method from the authenticated customer. # Generate Order Invoice Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/generate-order-invoice /openapi/2026-10.openapi.json post /v1/customer-portal/orders/{id}/invoice Trigger generation of an order's invoice. > [!WARNING] > > Once the invoice is generated, it's permanent and cannot be modified. > > Make sure the billing details (name and address) are correct before generating the invoice. You can update them before generating the invoice by calling the [`PATCH /v1/customer-portal/orders/{id}`](/docs/api-reference/customer_portal/update-order) endpoint. > [!NOTE] > > After successfully calling this endpoint, you get a `202` response, meaning the generation of the invoice has been scheduled. It usually only takes a few seconds before you can retrieve the invoice using the [`GET /v1/customer-portal/orders/{id}/invoice`](/docs/api-reference/customer_portal/get-order-invoice) endpoint. > > If you want a reliable notification when the invoice is ready, you can listen to the [`order.updated`](/docs/api-reference/orderupdated) webhook and check the [`is_invoice_generated` field](/docs/api-reference/orderupdated#schema-data-is-invoice-generated). # Get Authenticated Portal User Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/get-authenticated-portal-user /openapi/2026-10.openapi.json get /v1/customer-portal/customer-session/user Get information about the currently authenticated portal user. **Scopes**: `customer_portal:read` `customer_portal:write` # Get Benefit Grant Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/get-benefit-grant /openapi/2026-10.openapi.json get /v1/customer-portal/benefit-grants/{id} Get a benefit grant by ID for the authenticated customer. **Scopes**: `customer_portal:read` `customer_portal:write` # Get Customer Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/get-customer /openapi/2026-10.openapi.json get /v1/customer-portal/customers/me Get authenticated customer. **Scopes**: `customer_portal:read` `customer_portal:write` # Get Customer Meter Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/get-customer-meter /openapi/2026-10.openapi.json get /v1/customer-portal/meters/{id} Get a meter by ID for the authenticated customer. **Scopes**: `customer_portal:read` `customer_portal:write` # Get License Key Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/get-license-key /openapi/2026-10.openapi.json get /v1/customer-portal/license-keys/{id} Get a license key. **Scopes**: `customer_portal:read` `customer_portal:write` # Get Order Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/get-order /openapi/2026-10.openapi.json get /v1/customer-portal/orders/{id} Get an order by ID for the authenticated customer. # Get Order Invoice Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/get-order-invoice /openapi/2026-10.openapi.json get /v1/customer-portal/orders/{id}/invoice Get an order's invoice data. > [!NOTE] > > The invoice must be generated first before it can be retrieved. You should call the [`POST /v1/customer-portal/orders/{id}/invoice`](/docs/api-reference/customer_portal/generate-order-invoice) endpoint to generate the invoice. > > If the invoice is not generated, you will receive a `404` error. # Get Order Receipt Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/get-order-receipt /openapi/2026-10.openapi.json get /v1/customer-portal/orders/{id}/receipt Get a presigned URL to download an order's receipt PDF. # Get Organization Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/get-organization /openapi/2026-10.openapi.json get /v1/customer-portal/organizations/{slug} Get a customer portal's organization by slug. # Get Subscription Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/get-subscription /openapi/2026-10.openapi.json get /v1/customer-portal/subscriptions/{id} Get a subscription for the authenticated customer. **Scopes**: `customer_portal:read` `customer_portal:write` # Introspect Customer Session Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/introspect-customer-session /openapi/2026-10.openapi.json get /v1/customer-portal/customer-session/introspect Introspect the current session and return its information. **Scopes**: `customer_portal:read` `customer_portal:write` # List Benefit Grants Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/list-benefit-grants /openapi/2026-10.openapi.json get /v1/customer-portal/benefit-grants/ List benefits grants of the authenticated customer. **Scopes**: `customer_portal:read` `customer_portal:write` # List Claimed Subscriptions Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/list-claimed-subscriptions /openapi/2026-10.openapi.json get /v1/customer-portal/seats/subscriptions List all subscriptions where the authenticated customer has claimed a seat. **Scopes**: `customer_portal:read` `customer_portal:write` # List Customer Payment Methods Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/list-customer-payment-methods /openapi/2026-10.openapi.json get /v1/customer-portal/customers/me/payment-methods Get saved payment methods of the authenticated customer. > [!NOTE] > > To change the default payment method, call the [`PATCH /v1/customer-portal/customers/me`](/docs/api-reference/customer_portal/update-customer) endpoint with the desired `default_payment_method_id`. # List Downloadables Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/list-downloadables /openapi/2026-10.openapi.json get /v1/customer-portal/downloadables/ **Scopes**: `customer_portal:read` `customer_portal:write` # List License Keys Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/list-license-keys /openapi/2026-10.openapi.json get /v1/customer-portal/license-keys/ **Scopes**: `customer_portal:read` `customer_portal:write` # List Members Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/list-members /openapi/2026-10.openapi.json get /v1/customer-portal/members List all members of the customer's team. Only available to owners and billing managers of team customers. # List Meters Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/list-meters /openapi/2026-10.openapi.json get /v1/customer-portal/meters/ List meters of the authenticated customer. **Scopes**: `customer_portal:read` `customer_portal:write` # List Orders Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/list-orders /openapi/2026-10.openapi.json get /v1/customer-portal/orders/ List orders of the authenticated customer. # List Seats Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/list-seats /openapi/2026-10.openapi.json get /v1/customer-portal/seats **Scopes**: `customer_portal:read` `customer_portal:write` # List Subscriptions Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/list-subscriptions /openapi/2026-10.openapi.json get /v1/customer-portal/subscriptions/ List subscriptions of the authenticated customer. **Scopes**: `customer_portal:read` `customer_portal:write` # Remove Member Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/remove-member /openapi/2026-10.openapi.json delete /v1/customer-portal/members/{id} Remove a member from the team. Only available to owners and billing managers of team customers. Rules: - Cannot remove yourself - Cannot remove the only owner # Request Email Change Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/request-email-change /openapi/2026-10.openapi.json post /v1/customer-portal/customers/me/email-update/request Request an email change for the authenticated customer. # Resend Invitation Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/resend-invitation /openapi/2026-10.openapi.json post /v1/customer-portal/seats/{seat_id}/resend # Revoke Seat Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/revoke-seat /openapi/2026-10.openapi.json delete /v1/customer-portal/seats/{seat_id} # Rotate License Key Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/rotate-license-key /openapi/2026-10.openapi.json post /v1/customer-portal/license-keys/{id}/rotate Rotate a license key. Generates a new key string for the same license key record. The previous key string immediately stops validating. Status, usage, limits, expiry, and activations are preserved. **Scopes**: `customer_portal:write` # Update Benefit Grant Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/update-benefit-grant /openapi/2026-10.openapi.json patch /v1/customer-portal/benefit-grants/{id} Update a benefit grant for the authenticated customer. **Scopes**: `customer_portal:write` # Update Customer Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/update-customer /openapi/2026-10.openapi.json patch /v1/customer-portal/customers/me Update authenticated customer. # Update Member Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/update-member /openapi/2026-10.openapi.json patch /v1/customer-portal/members/{id} Update a member's name or role. Only available to owners and billing managers of team customers. Rules: - Cannot modify your own role (to prevent self-demotion) - Customer must have exactly one owner at all times # Update Order Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/update-order /openapi/2026-10.openapi.json patch /v1/customer-portal/orders/{id} Update an order for the authenticated customer. # Update Subscription Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/update-subscription /openapi/2026-10.openapi.json patch /v1/customer-portal/subscriptions/{id} Update a subscription of the authenticated customer. # Validate License Key Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/validate-license-key /openapi/2026-10.openapi.json post /v1/customer-portal/license-keys/validate Validate a license key. > This endpoint doesn't require authentication and can be safely used on a public > client, like a desktop application or a mobile app. > If you plan to validate a license key on a server, use the `/v1/license-keys/validate` > endpoint instead. # Verify Email Change Source: https://polar.sh/docs/api-reference/2026-10/customer_portal/verify-email-change /openapi/2026-10.openapi.json post /v1/customer-portal/customers/me/email-update/verify Verify an email change using the token from the verification email. # customer.state_changed Source: https://polar.sh/docs/api-reference/2026-10/customer_state_changed /openapi/2026-10.openapi.json webhook customer.state_changed Sent when a customer state has changed. It's triggered when: * Customer is created, updated or deleted. * A subscription is created or updated. * A benefit is granted or revoked. **Discord & Slack support:** Basic # customer.updated Source: https://polar.sh/docs/api-reference/2026-10/customer_updated /openapi/2026-10.openapi.json webhook customer.updated Sent when a customer is updated. This event is fired when the customer details are updated. If you want to be notified when a customer subscription or benefit state changes, you should listen to the `customer_state_changed` event. **Discord & Slack support:** Basic # Create Member Source: https://polar.sh/docs/api-reference/2026-10/customers/create-member /openapi/2026-10.openapi.json post /v1/customers/{id}/members Create a new member for a customer. Only B2B customers with the member management feature enabled can add members. The authenticated user or organization must have access to the customer's organization. **Scopes**: `members:write` # Create Member by Customer External ID Source: https://polar.sh/docs/api-reference/2026-10/customers/create-member-by-customer-external-id /openapi/2026-10.openapi.json post /v1/customers/external/{external_id}/members Create a new member for a customer identified by its external ID. **Scopes**: `members:write` # Delete Member Source: https://polar.sh/docs/api-reference/2026-10/customers/delete-member /openapi/2026-10.openapi.json delete /v1/customers/{id}/members/{member_id} Delete a member of a customer. **Scopes**: `members:write` # Delete Member by External ID Source: https://polar.sh/docs/api-reference/2026-10/customers/delete-member-by-external-id /openapi/2026-10.openapi.json delete /v1/customers/external/{external_id}/members/{member_external_id} Delete a member by external ID for a customer identified by its external ID. **Scopes**: `members:write` # Get Member Source: https://polar.sh/docs/api-reference/2026-10/customers/get-member /openapi/2026-10.openapi.json get /v1/customers/{id}/members/{member_id} Get a member of a customer by its ID. **Scopes**: `members:read` `members:write` # Get Member by External ID Source: https://polar.sh/docs/api-reference/2026-10/customers/get-member-by-external-id /openapi/2026-10.openapi.json get /v1/customers/external/{external_id}/members/{member_external_id} Get a member by external ID for a customer identified by its external ID. **Scopes**: `members:read` `members:write` # List Members Source: https://polar.sh/docs/api-reference/2026-10/customers/list-members /openapi/2026-10.openapi.json get /v1/customers/{id}/members List the members of a customer. **Scopes**: `members:read` `members:write` # List Members by Customer External ID Source: https://polar.sh/docs/api-reference/2026-10/customers/list-members-by-customer-external-id /openapi/2026-10.openapi.json get /v1/customers/external/{external_id}/members List the members of a customer identified by its external ID. **Scopes**: `members:read` `members:write` # Update Member Source: https://polar.sh/docs/api-reference/2026-10/customers/update-member /openapi/2026-10.openapi.json patch /v1/customers/{id}/members/{member_id} Update a member of a customer. Only name, email and role can be updated. **Scopes**: `members:write` # Update Member by External ID Source: https://polar.sh/docs/api-reference/2026-10/customers/update-member-by-external-id /openapi/2026-10.openapi.json patch /v1/customers/external/{external_id}/members/{member_external_id} Update a member by external ID for a customer identified by its external ID. **Scopes**: `members:write` # Complete File Upload Source: https://polar.sh/docs/api-reference/2026-10/files/complete-file-upload /openapi/2026-10.openapi.json post /v1/files/{id}/uploaded Complete a file upload. **Scopes**: `files:write` # Create File Source: https://polar.sh/docs/api-reference/2026-10/files/create-file /openapi/2026-10.openapi.json post /v1/files/ Create a file. **Scopes**: `files:write` # Delete File Source: https://polar.sh/docs/api-reference/2026-10/files/delete-file /openapi/2026-10.openapi.json delete /v1/files/{id} Delete a file. **Scopes**: `files:write` # List Files Source: https://polar.sh/docs/api-reference/2026-10/files/list-files /openapi/2026-10.openapi.json get /v1/files/ List files. **Scopes**: `files:read` `files:write` # Update File Source: https://polar.sh/docs/api-reference/2026-10/files/update-file /openapi/2026-10.openapi.json patch /v1/files/{id} Update a file. **Scopes**: `files:write` # Activate License Key Source: https://polar.sh/docs/api-reference/2026-10/license_keys/activate-license-key /openapi/2026-10.openapi.json post /v1/license-keys/activate Activate a license key instance. **Scopes**: `license_keys:write` # Deactivate License Key Source: https://polar.sh/docs/api-reference/2026-10/license_keys/deactivate-license-key /openapi/2026-10.openapi.json post /v1/license-keys/deactivate Deactivate a license key instance. **Scopes**: `license_keys:write` # Get Activation Source: https://polar.sh/docs/api-reference/2026-10/license_keys/get-activation /openapi/2026-10.openapi.json get /v1/license-keys/{id}/activations/{activation_id} Get a license key activation. **Scopes**: `license_keys:read` `license_keys:write` # Get License Key Source: https://polar.sh/docs/api-reference/2026-10/license_keys/get-license-key /openapi/2026-10.openapi.json get /v1/license-keys/{id} Get a license key. **Scopes**: `license_keys:read` `license_keys:write` # List License Keys Source: https://polar.sh/docs/api-reference/2026-10/license_keys/list-license-keys /openapi/2026-10.openapi.json get /v1/license-keys/ Get license keys connected to the given organization & filters. **Scopes**: `license_keys:read` `license_keys:write` # Rotate License Key Source: https://polar.sh/docs/api-reference/2026-10/license_keys/rotate-license-key /openapi/2026-10.openapi.json post /v1/license-keys/{id}/rotate Rotate a license key. Generates a new key string for the same license key record. The previous key string immediately stops validating. Status, usage, limits, expiry, and activations are preserved. **Scopes**: `license_keys:write` # Update License Key Source: https://polar.sh/docs/api-reference/2026-10/license_keys/update-license-key /openapi/2026-10.openapi.json patch /v1/license-keys/{id} Update a license key. **Scopes**: `license_keys:write` # Validate License Key Source: https://polar.sh/docs/api-reference/2026-10/license_keys/validate-license-key /openapi/2026-10.openapi.json post /v1/license-keys/validate Validate a license key. **Scopes**: `license_keys:write` # Get Meter Quantities Source: https://polar.sh/docs/api-reference/2026-10/meters/get-meter-quantities /openapi/2026-10.openapi.json get /v1/meters/{id}/quantities Get quantities of a meter over a time period. **Scopes**: `meters:read` `meters:write` # List Meters Source: https://polar.sh/docs/api-reference/2026-10/meters/list-meters /openapi/2026-10.openapi.json get /v1/meters/ List meters. **Scopes**: `meters:read` `meters:write` # Update Meter Source: https://polar.sh/docs/api-reference/2026-10/meters/update-meter /openapi/2026-10.openapi.json patch /v1/meters/{id} Update a meter. **Scopes**: `meters:write` # Get Metrics Source: https://polar.sh/docs/api-reference/2026-10/metrics/get-metrics /openapi/2026-10.openapi.json get /v1/metrics/ Get metrics about your orders and subscriptions. Currency values are output in cents. **Scopes**: `metrics:read` # Get Metrics Limits Source: https://polar.sh/docs/api-reference/2026-10/metrics/get-metrics-limits /openapi/2026-10.openapi.json get /v1/metrics/limits Get the interval limits for the metrics endpoint. **Scopes**: `metrics:read` # Create Organization Source: https://polar.sh/docs/api-reference/2026-10/organizations/create-organization /openapi/2026-10.openapi.json post /v1/organizations/ Create an organization. **Scopes**: `organizations:write` # Get Organization Source: https://polar.sh/docs/api-reference/2026-10/organizations/get-organization /openapi/2026-10.openapi.json get /v1/organizations/{id} Get an organization by ID. **Scopes**: `organizations:read` `organizations:write` # List Organizations Source: https://polar.sh/docs/api-reference/2026-10/organizations/list-organizations /openapi/2026-10.openapi.json get /v1/organizations/ List organizations. **Scopes**: `organizations:read` `organizations:write` # Update Organization Source: https://polar.sh/docs/api-reference/2026-10/organizations/update-organization /openapi/2026-10.openapi.json patch /v1/organizations/{id} Update an organization. **Scopes**: `organizations:write` # subscription.active Source: https://polar.sh/docs/api-reference/2026-10/subscription_active /openapi/2026-10.openapi.json webhook subscription.active Sent when a subscription becomes active, whether because it's a new paid subscription or because payment was recovered. **Discord & Slack support:** Full # subscription.created Source: https://polar.sh/docs/api-reference/2026-10/subscription_created /openapi/2026-10.openapi.json webhook subscription.created Sent when a new subscription is created. When this event occurs, the subscription `status` might not be `active` yet, as we can still have to wait for the first payment to be processed. **Discord & Slack support:** Full # benefit.created Source: https://polar.sh/docs/api-reference/2026-10/benefit_created /openapi/2026-10.openapi.json webhook benefit.created Sent when a new benefit is created. **Discord & Slack support:** Basic # benefit_grant.created Source: https://polar.sh/docs/api-reference/2026-10/benefit_grant_created /openapi/2026-10.openapi.json webhook benefit_grant.created Sent when a new benefit grant is created. **Discord & Slack support:** Basic # benefit_grant.cycled Source: https://polar.sh/docs/api-reference/2026-10/benefit_grant_cycled /openapi/2026-10.openapi.json webhook benefit_grant.cycled Sent when a benefit grant is cycled, meaning the related subscription has been renewed for another period. **Discord & Slack support:** Basic # benefit_grant.revoked Source: https://polar.sh/docs/api-reference/2026-10/benefit_grant_revoked /openapi/2026-10.openapi.json webhook benefit_grant.revoked Sent when a benefit grant is revoked. **Discord & Slack support:** Basic # benefit_grant.updated Source: https://polar.sh/docs/api-reference/2026-10/benefit_grant_updated /openapi/2026-10.openapi.json webhook benefit_grant.updated Sent when a benefit grant is updated. **Discord & Slack support:** Basic # benefit.updated Source: https://polar.sh/docs/api-reference/2026-10/benefit_updated /openapi/2026-10.openapi.json webhook benefit.updated Sent when a benefit is updated. **Discord & Slack support:** Basic # customer_seat.assigned Source: https://polar.sh/docs/api-reference/2026-10/customer_seat_assigned /openapi/2026-10.openapi.json webhook customer_seat.assigned Sent when a new customer seat is assigned. This event is triggered when a seat is assigned to a customer by the organization. The customer will receive an invitation email to claim the seat. # customer_seat.claimed Source: https://polar.sh/docs/api-reference/2026-10/customer_seat_claimed /openapi/2026-10.openapi.json webhook customer_seat.claimed Sent when a customer seat is claimed. This event is triggered when a customer accepts the seat invitation and claims their access. # customer_seat.revoked Source: https://polar.sh/docs/api-reference/2026-10/customer_seat_revoked /openapi/2026-10.openapi.json webhook customer_seat.revoked Sent when a customer seat is revoked. This event is triggered when access to a seat is revoked, either manually by the organization or automatically when a subscription is canceled. # discount.created Source: https://polar.sh/docs/api-reference/2026-10/discount_created /openapi/2026-10.openapi.json webhook discount.created Sent when a new discount is created. **Discord & Slack support:** Basic # discount.deleted Source: https://polar.sh/docs/api-reference/2026-10/discount_deleted /openapi/2026-10.openapi.json webhook discount.deleted Sent when a discount is deleted. **Discord & Slack support:** Basic # discount.updated Source: https://polar.sh/docs/api-reference/2026-10/discount_updated /openapi/2026-10.openapi.json webhook discount.updated Sent when a discount is updated. **Discord & Slack support:** Basic # Authorize Source: https://polar.sh/docs/api-reference/2026-10/oauth2/authorize /openapi/2026-10.openapi.json get /v1/oauth2/authorize # Create Client Source: https://polar.sh/docs/api-reference/2026-10/oauth2/create-client /openapi/2026-10.openapi.json post /v1/oauth2/register Create an OAuth2 client. # Delete Client Source: https://polar.sh/docs/api-reference/2026-10/oauth2/delete-client /openapi/2026-10.openapi.json delete /v1/oauth2/register/{client_id} Delete an OAuth2 client. # Get Client Source: https://polar.sh/docs/api-reference/2026-10/oauth2/get-client /openapi/2026-10.openapi.json get /v1/oauth2/register/{client_id} Get an OAuth2 client by Client ID. # Get User Info Source: https://polar.sh/docs/api-reference/2026-10/oauth2/get-user-info /openapi/2026-10.openapi.json get /v1/oauth2/userinfo Get information about the authenticated user. # Introspect Token Source: https://polar.sh/docs/api-reference/2026-10/oauth2/introspect-token /openapi/2026-10.openapi.json post /v1/oauth2/introspect Get information about an access token. # Request Token Source: https://polar.sh/docs/api-reference/2026-10/oauth2/request-token /openapi/2026-10.openapi.json post /v1/oauth2/token Request an access token using a valid grant. # Revoke Token Source: https://polar.sh/docs/api-reference/2026-10/oauth2/revoke-token /openapi/2026-10.openapi.json post /v1/oauth2/revoke Revoke an access token or a refresh token. # Update Client Source: https://polar.sh/docs/api-reference/2026-10/oauth2/update-client /openapi/2026-10.openapi.json put /v1/oauth2/register/{client_id} Update an OAuth2 client. # order.created Source: https://polar.sh/docs/api-reference/2026-10/order_created /openapi/2026-10.openapi.json webhook order.created Sent when a new order is created. A new order is created when: * A customer purchases a one-time product. In this case, `billing_reason` is set to `purchase`. * A customer starts a subscription. In this case, `billing_reason` is set to `subscription_create`. * A subscription is renewed. In this case, `billing_reason` is set to `subscription_cycle`. * A subscription is upgraded or downgraded with an immediate proration invoice. In this case, `billing_reason` is set to `subscription_update`. > [!WARNING] > The order might not be paid yet, so the `status` field might be `pending`. **Discord & Slack support:** Full # order.paid Source: https://polar.sh/docs/api-reference/2026-10/order_paid /openapi/2026-10.openapi.json webhook order.paid Sent when an order is paid. When you receive this event, the order is fully processed and payment has been received. **Discord & Slack support:** Full # order.refunded Source: https://polar.sh/docs/api-reference/2026-10/order_refunded /openapi/2026-10.openapi.json webhook order.refunded Sent when an order is fully or partially refunded. **Discord & Slack support:** Full # order.updated Source: https://polar.sh/docs/api-reference/2026-10/order_updated /openapi/2026-10.openapi.json webhook order.updated Sent when an order is updated. An order is updated when: * Its status changes, e.g. from `pending` to `paid`. * It's refunded, partially or fully. **Discord & Slack support:** Full # organization.updated Source: https://polar.sh/docs/api-reference/2026-10/organization_updated /openapi/2026-10.openapi.json webhook organization.updated Sent when a organization is updated. **Discord & Slack support:** Basic # product.created Source: https://polar.sh/docs/api-reference/2026-10/product_created /openapi/2026-10.openapi.json webhook product.created Sent when a new product is created. **Discord & Slack support:** Basic # product.updated Source: https://polar.sh/docs/api-reference/2026-10/product_updated /openapi/2026-10.openapi.json webhook product.updated Sent when a product is updated. **Discord & Slack support:** Basic # refund.created Source: https://polar.sh/docs/api-reference/2026-10/refund_created /openapi/2026-10.openapi.json webhook refund.created Sent when a refund is created regardless of status. **Discord & Slack support:** Full # refund.updated Source: https://polar.sh/docs/api-reference/2026-10/refund_updated /openapi/2026-10.openapi.json webhook refund.updated Sent when a refund is updated. **Discord & Slack support:** Full # subscription.canceled Source: https://polar.sh/docs/api-reference/2026-10/subscription_canceled /openapi/2026-10.openapi.json webhook subscription.canceled Sent when a subscription is canceled. Customers might still have access until the end of the current period. **Discord & Slack support:** Full # subscription.cycled Source: https://polar.sh/docs/api-reference/2026-10/subscription_cycled /openapi/2026-10.openapi.json webhook subscription.cycled Sent when a subscription enters a new billing period. The payload carries the new `current_period_start` and `current_period_end`. It fires when the period rolls over, before the renewal order exists and regardless of whether the renewal payment succeeds — listen to `order.paid` if you need the payment. A trial converting to a paid subscription starts a new period, so it fires there too. Read `status` to tell the two apart. **Discord & Slack support:** Basic # subscription.migrated Source: https://polar.sh/docs/api-reference/2026-10/subscription_migrated /openapi/2026-10.openapi.json webhook subscription.migrated Sent when Polar takes over billing of a subscription migrated from another provider. This fires at cutover, once the subscription is live on Polar. `provider` and `provider_subscription_id` identify the subscription on the billing provider so you can correlate the two. **Discord & Slack support:** Basic # subscription.past_due Source: https://polar.sh/docs/api-reference/2026-10/subscription_past_due /openapi/2026-10.openapi.json webhook subscription.past_due Sent when a subscription payment fails and the subscription enters `past_due` status. This is a recoverable state - the customer can update their payment method to restore the subscription. Benefits may be revoked depending on the organization's grace period settings. If payment retries are exhausted, a `subscription.revoked` event will be sent. **Discord & Slack support:** Full # subscription.paused Source: https://polar.sh/docs/api-reference/2026-10/subscription_paused /openapi/2026-10.openapi.json webhook subscription.paused Sent when a subscription is paused and the customer temporarily loses access. No order is created while paused. The subscription resumes either on its scheduled resume date or when resumed manually, starting a new billing period. **Discord & Slack support:** Full # subscription.resumed Source: https://polar.sh/docs/api-reference/2026-10/subscription_resumed /openapi/2026-10.openapi.json webhook subscription.resumed Sent when a paused subscription resumes, restoring the customer's access. Resuming starts a new billing period and charges the customer immediately. **Discord & Slack support:** Full # subscription.revoked Source: https://polar.sh/docs/api-reference/2026-10/subscription_revoked /openapi/2026-10.openapi.json webhook subscription.revoked Sent when a subscription is revoked and the user loses access immediately. Happens when the subscription is canceled or payment retries are exhausted (status becomes `unpaid`). For payment failures that can still be recovered, see `subscription.past_due`. **Discord & Slack support:** Full # subscription.uncanceled Source: https://polar.sh/docs/api-reference/2026-10/subscription_uncanceled /openapi/2026-10.openapi.json webhook subscription.uncanceled Sent when a customer revokes a pending cancellation. When a customer cancels with "at period end", they retain access until the subscription would renew. During this time, they can change their mind and undo the cancellation. This event is triggered when they do so. **Discord & Slack support:** Full # subscription.updated Source: https://polar.sh/docs/api-reference/2026-10/subscription_updated /openapi/2026-10.openapi.json webhook subscription.updated Sent when a subscription is updated. This event fires for all changes to the subscription, including renewals. If you want more specific events, you can listen to `subscription.active`, `subscription.canceled`, `subscription.past_due`, and `subscription.revoked`. To listen specifically for renewals, listen to `subscription.cycled`. **Discord & Slack support:** On cancellation, past due, and revocation. Renewals are skipped. # Create Webhook Endpoint Source: https://polar.sh/docs/api-reference/2026-10/webhooks/create-webhook-endpoint /openapi/2026-10.openapi.json post /v1/webhooks/endpoints Create a webhook endpoint. **Scopes**: `webhooks:write` # Delete Webhook Endpoint Source: https://polar.sh/docs/api-reference/2026-10/webhooks/delete-webhook-endpoint /openapi/2026-10.openapi.json delete /v1/webhooks/endpoints/{id} Delete a webhook endpoint. **Scopes**: `webhooks:write` # Get Webhook Endpoint Source: https://polar.sh/docs/api-reference/2026-10/webhooks/get-webhook-endpoint /openapi/2026-10.openapi.json get /v1/webhooks/endpoints/{id} Get a webhook endpoint by ID. **Scopes**: `webhooks:read` `webhooks:write` # List Webhook Deliveries Source: https://polar.sh/docs/api-reference/2026-10/webhooks/list-webhook-deliveries /openapi/2026-10.openapi.json get /v1/webhooks/deliveries List webhook deliveries. Deliveries are all the attempts to deliver a webhook event to an endpoint. **Scopes**: `webhooks:read` `webhooks:write` # List Webhook Endpoints Source: https://polar.sh/docs/api-reference/2026-10/webhooks/list-webhook-endpoints /openapi/2026-10.openapi.json get /v1/webhooks/endpoints List webhook endpoints. **Scopes**: `webhooks:read` `webhooks:write` # Redeliver Webhook Event Source: https://polar.sh/docs/api-reference/2026-10/webhooks/redeliver-webhook-event /openapi/2026-10.openapi.json post /v1/webhooks/events/{id}/redeliver Schedule the re-delivery of a webhook event. **Scopes**: `webhooks:write` # Reset Webhook Endpoint Secret Source: https://polar.sh/docs/api-reference/2026-10/webhooks/reset-webhook-endpoint-secret /openapi/2026-10.openapi.json patch /v1/webhooks/endpoints/{id}/secret Regenerate a webhook endpoint secret. **Scopes**: `webhooks:write` # Update Webhook Endpoint Source: https://polar.sh/docs/api-reference/2026-10/webhooks/update-webhook-endpoint /openapi/2026-10.openapi.json patch /v1/webhooks/endpoints/{id} Update a webhook endpoint. **Scopes**: `webhooks:write` # API Changelog Source: https://polar.sh/docs/changelog/api Stay up to date with the latest changes introduced in our API Polar uses date-based API versions to evolve the API without unexpectedly changing the contract your integration depends on. Versions use the `YYYY-MM` format, such as `2026-10`, and apply to API requests, responses, webhook payloads, and SDK types. [Read more](/docs/api-reference/current/versioning) **2027-01** **This will become the Current version on January 1, 2027.** Removed the following obsolete fields, including fields that were already hidden from the API documentation and SDKs. Response field removals also apply to webhook payloads. Earlier API versions retain these fields. * Fixed discounts: removed `amount` and `currency` from create and update requests, responses, and webhook payloads. Use `amounts` instead; it is required when creating a fixed discount. Removed input fields are ignored. * Organization onboarding details: removed `about`, `intended_use`, `customer_acquisition`, `future_annual_revenue`, and `previous_annual_revenue` from create/update requests and KYC responses. Removed input fields are ignored. Updating details replaces stored values with the remaining supported fields. * Orders: `user_id`, `user`, `product_price_id`, `product_price`, `amount` (use `net_amount`), and `from_balance_amount` (use `applied_balance_amount`). Embedded subscriptions also lose `user_id`. * Subscriptions: `user_id`, `user`, `price_id`, and `price`. Use `customer_id`, `customer`, and `prices` instead. * Customer state active subscriptions: `price_id`. Use `prices` instead. * Customer portal orders and subscriptions: `user_id`, order `product_price_id` and `product_price`, and subscription `price_id` and `price`. * License keys: `user_id` and `user`. Use `customer_id` and `customer` instead. * Benefit grants: `user_id`. Use `customer_id` instead. * Checkout links: `product_id`, `product_price_id`, `product`, and `product_price`. Use `products` instead. * Checkouts: `customer_external_id` (use `external_customer_id`), `customer_billing_address_fields` (use `billing_address_fields`), and `subtotal_amount` (use `net_amount`). * Organizations: `bio`, `company`, `blog`, `location`, `twitter_username`, `pledge_minimum_amount`, `pledge_badge_show_amount`, `default_upfront_split_to_contributors`, and `notification_settings`. * Organizations embedded in other resources: `email`, `website`, `socials`, `status`, `details_submitted_at`, `feature_settings`, `subscription_settings`, and `customer_email_settings`. * Custom and Slack shared channel benefits: `is_tax_applicable`. * Discord benefit properties: `guild_token`. Use `guild_id` instead. * GitHub repository benefit properties: `repository_id`. Use `repository_owner` and `repository_name` instead. * Legacy recurring prices: the `LegacyRecurringProductPrice` schema is dropped from the price union, and the deprecated `type` and `recurring_interval` fields are removed from price responses. Earlier API versions retain them. **2026-10** **This will become the Current version on October 1st.** * Removed the `secret` parameter when [creating](/docs/api-reference/2026-10/webhooks/create-webhook-endpoint) or [updating](/docs/api-reference/2026-10/webhooks/update-webhook-endpoint) webhook endpoints. New endpoint secrets are generated by Polar. * Added `member_id` and `member` to [license key responses](/docs/api-reference/2026-10/license_keys/get-license-key), identifying the seat member holding the key. Both are `null` for keys granted directly to a customer. **2026-04** ### Standard Webhooks signing New webhook endpoints with secrets generated by Polar on or after **September 8, 2026 at 00:00 UTC** use signing compliant with the Standard Webhooks specification. Endpoints with secrets generated before this cutoff continue to use Polar's previous signing approach, preserving compatibility with existing integrations. Endpoints with user-provided secrets also retain the previous approach. We will continue to support this approach for as long as necessary; there is no required migration deadline. To adopt Standard Webhooks signing for an existing endpoint, **regenerate its secret** and update your webhook handler to use the new secret. When using a Standard Webhooks library directly, pass the new secret as-is, without Base64-encoding it first. See [webhook signature validation](/docs/integrate/webhooks/delivery#custom-validation) for details on both signing approaches. # Product Updates Source: https://polar.sh/docs/changelog/recent Stay up to date with the latest changes and improvements to Polar. **2026-11-04** ## Polar is now in ChatGPT and Claude Polar is available as an official plugin in ChatGPT and an approved MCP server in Claude. Set up your account, configure pricing, meters and credits, or handle customer support from a chat. The MCP server works in any harness with MCP support, including Cursor and OpenCode. [Read more](/docs/integrate/mcp) ## AI agents can sign up for Polar An agent can now create a Polar account and get API access on its own, without waiting for you to sign up first. When you're ready to take over, the agent sends you a claim code. After that, the agent keeps working on your behalf. ## Checkout for AI agents Hosted checkout now exposes WebMCP tools, so AI agents in a WebMCP-capable browser can read the order, fill in customer details, apply a discount, change seats, and submit. Agents complete checkouts faster and more reliably than by clicking through the form. Agents can also pay on the buyer's behalf with Agentcard. ## Self-serve Stripe migrations for everyone Organizations that used to sell through an eligible Stripe account can now move their customers, products, subscriptions and saved cards to Polar from **Settings → Migrations**. The guided flow imports your catalog, moves saved cards, then switches subscriptions over when you're ready. [Read more](/docs/migrate) ## Verify your domains Add the domains you own under **Settings → Domains** and verify them with a DNS TXT record. Setting up SSO now requires a verified domain. **2026-10-21** ## Grant credits to customers Grant usage credits on a customer's meter from the customer page or their usage table, with a preview of the new balance and how much overage the credits cover. The customer meter page now also shows credit history per billing period, including where each credit came from, and recent manual credits can be reversed. [Read more](/docs/features/usage-based-billing/credits#granting-credits-manually) ## Bill usage on its own cycle Metered usage no longer has to follow the subscription's billing interval. Turn on **Separate meter cycle** in a product's pricing section to, for example, charge a yearly base price while invoicing usage and granting credits every month. Customers see the upcoming usage charge in the customer portal and receive a dedicated usage invoice email for each cycle. [Read more](/docs/features/usage-based-billing/billing#meter-cycle) ## Unit-based pricing is generally available Sell a quantity of anything, paid up front: devices, licenses, gigabytes, servers. Name the unit, set tiered rates, optionally cap the maximum quantity, and let the buyer pick how many they want at checkout. On subscriptions, quantity changes are prorated. [Read more](/docs/features/unit-based-pricing) ## Volume and graduated tiers on metered prices Metered prices can now use volume or graduated tiers, so the rate changes as usage grows. Define the tiers in the product form, and checkout shows customers the full rate card. [Read more](/docs/features/usage-based-billing/billing#metered-pricing) ## Cancellation and trial notifications Team members can now be notified when a customer cancels a subscription, including the reason and comment they left. New trials get their own notification, separate from new subscriptions, and you can mute subscription notifications for free products. ## Also new * **Invoices** now show your organization's name and your card statement descriptor, have a refreshed design, show reverse charge as a clear notice instead of a 0% VAT line, and render Thai text. * **Framework adapters** for Next.js, Nuxt, TanStack Start, and Better Auth now pass the customer's IP address when creating a checkout, so customers see prices in their local currency. **2026-09-01** ## New webhook IP addresses Two IP addresses have been added to the [webhook IP allowlist](https://polar.sh/docs/integrate/webhooks/delivery#ip-allowlist): `18.117.215.101` for sandbox, which is already sending webhooks, and `3.134.178.243` for production, which will start sending them soon. If you allowlist our IPs on a firewall or reverse proxy, add both now so deliveries aren't blocked. **2026-08-17** ## Embed hosts are now enforced Embed host enforcement is now live for every organization. An embedded checkout only opens on a host you've listed under Settings → Preferences → Embedding, so make sure every site you embed from is on your list. [Read more](/docs/features/checkout/embed#embed-hosts) **2026-07-29** ## Embed hosts Choose which hosts are allowed to embed your checkout, in Settings → Preferences → Embedding. As soon as you list a host, only the hosts on your list can embed. Organizations created from 4 August 2026 need a list before they can embed. Existing organizations carry on as before until they add their first host, and we will email you well ahead of the date this applies to everyone. [Read more](/docs/features/checkout/embed#embed-hosts) **2026-07-28** ## Per-customer discount limits Discount codes now take a per-customer redemption limit. Set it to one and you can share a code publicly (post it, put it in a newsletter, hand it to an affiliate) knowing each buyer only gets a single use. Polar identifies a customer by customer ID, email address (ignoring plus-aliases) or payment card, and a match on any one is enough — so a fresh address on the same card doesn't buy a second run. Set it under Products → Discounts, or send `max_redemptions_per_customer` when you create or update a discount through the API. [Read more](/docs/features/discounts#per-customer-limits) **2026-07-23** ## Pause and resume subscriptions You can now pause a subscription instead of canceling it. Pausing schedules the subscription to stop at the end of its current period: billing halts and benefits are revoked, but the subscription and its payment method stay on file. Resume whenever you're ready: a fresh billing period starts and the customer is charged immediately, with no new checkout. Set an optional resume date when you pause and the subscription comes back on its own. This fits seasonal plans and account "freezes", where a customer steps away and returns later. Drive it from the API through the [Update Subscription](/docs/api-reference/current/subscriptions/update-subscription) endpoint, or let customers pause themselves from the Customer Portal by turning on **Enable subscription pause** under Settings → Customer portal. Two new webhook events, `subscription.paused` and `subscription.resumed`, tell you when the state changes. [Read more](/docs/features/subscriptions/manage#pause-and-resume) **2026-07-22** ## Single Sign-On Connect your organization to your own identity provider over OpenID Connect, including Google Workspace, Okta, Microsoft Entra ID, and Keycloak. Your team signs in with the credentials they already use, and anyone who authenticates becomes a member of your organization, so there are no invitations to send. Enforce SSO to make your identity provider the only way in: revoke someone's access there and they lose access to Polar. Single Sign-On is included in the Scale plan. Set it up under Settings → SSO. [Read more](/docs/features/sso) **2026-07-10** ## Added support for new local payment methods We've enabled several additional local payment methods. These payment methods are automatically displayed at checkout when they're available for a customer's location and purchase. No action is required from merchants. Newly supported: * 🇧🇪 Bancontact (EUR, one-time purchases) * 🇵🇱 BLIK (EUR, one-time purchases) * 🇦🇹 EPS (EUR, one-time purchases) * 🇳🇱 iDEAL / Wero (EUR, one-time purchases) * 🇵🇱 Przelewy24 (EUR, one-time purchases) * 🇪🇸 Bizum (EUR, one-time purchases) * 🇮🇳 UPI (INR, one-time purchases and recurring subscriptions) [See all supported payment methods](/docs/features/checkout/payment-methods) **2026-04-22** ## Pending Subscription Updates Now Surface in the UI Scheduled subscription changes (product swaps, price updates, seat-count changes) now appear in both the merchant dashboard and the customer portal. A clear "Scheduled Update" section shows what will change and when it applies, so there are no surprises at the next billing cycle. ![](https://mintcdn.com/polar/tELcn60QeU54jL3T/assets/changelog/2026-04-22/pending-subscription-update.png?fit=max\&auto=format\&n=tELcn60QeU54jL3T\&q=85\&s=e304882acef9f103c73fee286f50dbc0) ## Filter License Keys and Benefit Grants by Status Merchants can now filter license keys and benefit grants by status (granted, revoked, disabled, pending) directly from the benefit detail page. The license key status filter is also exposed via the API. Finding revoked or pending entitlements across large customer bases is now a single dropdown click instead of scrolling pages of results. ![](https://mintcdn.com/polar/tELcn60QeU54jL3T/assets/changelog/2026-04-22/license-keys-filter.png?fit=max\&auto=format\&n=tELcn60QeU54jL3T\&q=85\&s=a2f7a6bc6f04f8403b78ba39797f6029) ## Invoice Support for Arabic, Hebrew, and CJK Invoice PDFs now render Arabic, Hebrew, and CJK (Chinese, Japanese, Korean) glyphs correctly, with proper right-to-left shaping for Arabic and Hebrew. Merchants invoicing customers in these languages get professional, readable documents out of the box. ## Expanded Currency Support Presentment currency coverage expanded by 80+ currencies, including EGP, KES, NGN, PKR, VND, UAH, and KZT. Merchants can now price products and display checkout in a much wider range of local currencies. ## Smarter Regional Currency Formatting Localized checkout now respects regional IETF subtags (e.g. `en-CA`, `en-AU`) while keeping the merchant's chosen language. Currency symbols render as `CA$` or `A$` instead of a generic `$`, so buyers see the right currency framing for their region. **2026-04-14** ## Meter Units Meters now support custom units with a value multiplier, so you can ingest raw counts (tokens, requests, bytes) and price in whatever unit makes sense for your customers (millions of tokens, GB, etc.). Configure the unit name and multiplier on each meter in the dashboard, and unit labels flow through to checkout, the customer portal, and invoices. ![](https://mintcdn.com/polar/tELcn60QeU54jL3T/assets/changelog/2026-04-14/meter-units.png?fit=max\&auto=format\&n=tELcn60QeU54jL3T\&q=85\&s=46fb388823350a13fa7ad4696213644f) ## Self-Service Payout Account Management Merchants can now create, switch between, and delete payout accounts directly from the Finance page. A new Manage modal lists every account on the user, lets you set the active one for the organization, and blocks deletion when an account still holds a balance or is linked to an organization. Useful for moving payouts to a new bank entity without contacting support. ## Customers Can Update Their Email Address Customers can now change the email address on their account directly from the customer portal, with a verification step on the new address. No more support tickets to fix a typo or move billing to a new mailbox. ## Cost Insights: Customer Ranking and Variance Detection Cost Insights now ranks customers by total cost so you can see which accounts are driving the bill, and a new variance API surfaces cost anomalies (sudden spikes or drops) on individual events. Cost values also render correctly on the leaf event detail page. An enhancement to the Cost Insights feature shipped last October. **2026-03-31** ## Customizable Dashboard Home Charts The dashboard home page now lets merchants choose which metrics they see on the overview chart and persist their selection. Tailor the first thing you see when you log in to whatever moves the business for you. ![](https://mintcdn.com/polar/tELcn60QeU54jL3T/assets/changelog/2026-03-31/customizable-dashboard-charts.png?fit=max\&auto=format\&n=tELcn60QeU54jL3T\&q=85\&s=62fdc2edb52fe7fa7a5892566bb7a1ec) ## Schedule Subscription Updates for Next Cycle Subscription changes (product swaps, price updates, seat changes) can now be scheduled to apply at the next billing cycle instead of taking effect immediately. The API exposes a new `next_period` proration behavior, and pending updates are returned on subscription objects and webhooks so external systems stay in sync. ## Tax-Inclusive Pricing Merchants can now set a default tax behavior on their organization and price products with tax included in the displayed amount. Useful for regions and product categories where buyers expect to see the all-in price up front. ## Renewal and Trial Conversion Reminders Customers on yearly or longer billing cycles now get an automatic reminder seven days before renewal. Trial subscribers get a heads-up three days before their trial ends (or one day for very short trials). Both reminders are toggleable per organization, helping reduce involuntary churn and surprise charges. ## GDPR Customer Data Export A new Privacy section in the customer portal lets buyers download a complete JSON export of their personal data, subscriptions, orders, and benefit grants in one click. Helps merchants satisfy data portability obligations without manual exports. ## Cancellation Reason Drill-Down Cancellation charts in the metrics dashboard are now interactive. Clicking on any reason or time bucket opens a detail modal showing the underlying subscriptions, customer comments, and dates. Merchants can finally connect a spike on the chart to the actual customers behind it. ## Korean Checkout Checkout is now translated into Korean. Merchants selling to Korean buyers get a native buying experience, with product details, payment fields, and order summary all rendering in Korean. ## Multi-Currency Fixed Discounts Fixed-amount discounts can now hold separate amounts per currency, matching the multi-currency pricing model that shipped in February. Run a \$10 / 10 EUR / 10 GBP coupon as a single discount instead of juggling three. **2026-02-28** ## Multi-Currency Product Pricing Merchants can now create products with prices in multiple currencies side by side. Set a USD price, an EUR price, a GBP price, and more on the same product, and customers see the right currency at checkout based on their region. A new default presentment currency setting at the organization level keeps things consistent across the dashboard. ## Italian and Portuguese Checkout Checkout, customer portal, and emails are now fully translated into Italian and Portuguese. Customers in Italy, Portugal, and Brazil get a native experience end to end, with currency formatting that matches their region. ## Feature Flag Benefit A new Feature Flag benefit type is available for SaaS merchants. Grant it to customers when they should unlock something in your product, then check entitlements through the Polar API or webhooks. JSON metadata stays invisible to the customer, keeping the experience clean for pure software subscriptions. ## Faster Wallet and Card Checkout When mobile wallets are available, they now appear at the top of the payment list instead of buried under the card form. The cardholder name field is hidden when paying with a wallet, since the name is pulled from the wallet token automatically. Fewer clicks, fewer fields, faster checkout. ## Team Ownership Transfer Team owners can now hand the owner role to another member directly from the customer portal, and admins can transfer ownership through the API. The previous owner is automatically demoted to billing manager so there is always exactly one owner. ## Seat Limits at Checkout Seat-based products now support `min_seats` and `max_seats` on the checkout. Lock customers to a minimum team size for plans that require it, or cap the upper bound for tiered packages, all enforced at the buying step. ## Name Your Webhook Endpoints Webhook endpoints can now have a friendly name like "Production Events" or "Analytics Pipeline". Names show up as the primary label in the dashboard, with the URL as secondary text, so managing more than a couple of endpoints stops feeling like reading a list of URLs. ## Return URL on Static Checkout Links Static checkout links created from the dashboard now support a custom return URL, matching what was already possible through the API. Send buyers back to a thank-you page, an upsell, or a specific app screen after they complete a purchase, no API call required. **2026-01-31** ## Team Member Management (B2B) Complete team member management system for B2B customers: * Owner and billing managers can add/remove team members * Role-based access control (owner, billing_manager, member) * Member-specific benefit grants and portal access * Team portal page with member list and management * Member sessions (`polar_mst_`) preserve identity and permissions * Members tab on customer detail pages Perfect for B2B customers managing team access and permissions. ### Explicit Currency Display Currency symbols now show explicitly (e.g., `USD 123.45`) instead of just `$123.45` to prevent confusion for non-US dollar users. ## Event & Metering Enhancements ### Member-Level Event Attribution Events now support member tracking: * `member_id` and `external_member_id` fields * Member validation during event ingestion * B2B usage tracking at member level ### Timezone Handling Fixed timezone issues in meter quantities endpoint: * Added `timezone` parameter * Set database session timezone properly * Correct date grouping for non-UTC users ## Customer Portal Enhancements ### Benefit Grants UI * Complex benefit grants list with search and pagination * Better display for benefit details * Improved OAuth benefit grant buttons ### Payment Retry Fixes * 3DS modal display (popup instead of redirect) * Retry persistence after 3DS cancellation * Proper dunning management on manual retries ## Discount Management ### Redemption Count Optimization * Added `redemptions_count` column to discounts table **2025-12-31** ## System Events for Subscriptions Expanded system events to provide detailed subscription lifecycle tracking: * **Subscription cycled** - when billing periods roll over * **Subscription canceled** - when subscriptions are canceled * **Subscription past due** - when payment fails (separate from permanent revocation) * All events include product IDs and relevant metadata * Perfect for analytics and building custom workflows ## iOS Widget New iOS home screen and lock screen widget: * Real-time revenue display * Support for dark and light mode * Multiple widget sizes * Quick glance at your sales without opening the app Built with `@bacons/apple-targets` for native iOS integration. ## Product Management Improvements Major UX improvements for managing products: ### Sorting & Filtering * Sort products by name, creation date, update date, and end date * Custom pagination size (20, 50, 100 items per page) * Product rows are clickable links for cmd+click support ### Editing Experience * Unsaved changes alert prevents accidental data loss * Update button at top right for easier access * Auto-save for most settings * Fixed empty state flashing when sorting/filtering ### File Management * Client-side pagination for downloadable benefit files (10 per page) * Better file upload error messages * Fixed React state issues in benefit forms ### Product Duplication * Re-uploads images when duplicating to prevent shared references * Deleting an image from a duplicate no longer affects the original ## Search Improvements Significant search infrastructure updates: * Search vectors for full-text search * Union queries for better performance * PostgreSQL text search capabilities ## Member Management Enhanced member endpoint functionality: * Added `member_id` to relevant API endpoints * Improved B2B customer management ## Mobile App Improvements ### iOS Updates * iOS widget for home and lock screen * App rating prompts at appropriate times * Login screen animations (fade in, Ken Burns effect) * Fixed multi-account crash on settings * Fixed scroll issues with many organizations * Version bumped to 1.1.0 ### Android Support * Full Android build support * App store ready for both platforms * Consistent design system across iOS and Android ## Customer Meter Enhancements Significant improvements to customer meter calculation: * Speed improvements with optimized queries (avoided cartesian joins) * Better activation logic for meters with events * Fixed organization ID tracking * Increased lock time to 30s for slow queries * Debug information in window event spans * Proper external customer ID handling ## Webhook Management Better webhook health tracking: * Discord rate limit logging * Missing event types added to schema * Improved error handling * Repository-based webhook service ## Checkout Links * Added checkout links to mobile app * Better link management * Share and track checkout performance on mobile ## OAuth2 Improvements * First-party clients auto-save grants * No authorization prompt for trusted apps * Better user experience for internal tools ## Bug Fixes * Fixed undefined organization in dashboard sidebar * Fixed customer meter updates for soft-deleted customers * Fixed seat and trial end updates for seat-based products * Fixed tax calculation error handling * Fixed product empty state flashing * Fixed notifications on iOS simulator * Fixed Switch rendering on Android * Fixed Polar logo not linking to home * Fixed image duplication on product creation * Handle null Stripe refund reasons * Fixed subscription fields in system events **2025-12-07** ## Dispute & Chargeback Management Complete dispute tracking and prevention system: * Dispute model to track chargebacks from Stripe * Chargeback Stop integration for rapid dispute resolution (RDR) * Auto-refund on RDR disputes to prevent chargebacks * Link refunds to disputes for better tracking * Improved dispute event handling from Stripe webhooks Helps reduce chargeback fees and protect your account standing. ## Metrics API New metrics filtering system: * `metrics` query parameter to filter specific metrics * Removed deprecated `focus_metrics` parameter * Better performance by only calculating requested metrics ## iOS App Updates * App rating prompts at appropriate times * iOS upsell banner on homepage * Animations on login screen (fade in, Ken Burns effect, staggered elements) * Fixed multi-account crash on settings screen * Fixed onboarding redirect after org creation * Fixed scroll issue with many orgs * Version bumped to 1.1.0 ## Mobile App (Android) Added Android support: * Android targets in build scripts * App store ready for both iOS and Android ## Email Improvements * Updated Polar logo in all emails * Better email DNS validation * Fixed invalid email domain issues ## Worker Queue Management Better task prioritization: * Low, medium, and high priority queues * Separate workers for different priorities * Schedule tasks moved to high priority worker **2025-11-28** ## Downloads Page New dedicated downloads page at polar.sh/downloads for easy access to desktop and mobile apps. ## Customer Balance Refunds * Handle refunds on orders with customer balance applied * Proper balance credit restoration * Block refunds on specific orders via API flag ## Worker Priority Queues Introduced task prioritization system: * Low priority queue for background tasks * Medium priority queue for standard tasks * High priority queue for time-sensitive operations * Separate workers consuming from each queue Ensures critical tasks get processed first. ## Rate Limiting * New restricted rate limit group for abusive patterns * Better rate limit handling across endpoints ## Email Validation Added DNS validation for email addresses across checkout, customer creation, and user management to prevent typos and invalid domains. ## Event Query Optimization Massive performance improvements: * Removed unnecessary ordering from event queries (3x faster) * Better customer latest event queries * New indexes on events table * Optimized IN queries for customer meters ## Mobile App Improvements * Account deletion functionality * Proper logout and login flow fixes * Better error handling * Login screen animations with Ken Burns effect ## Bug Fixes * Fixed settings scroll with many organizations * Fixed app onboarding redirect * Fixed organization service name in Logfire * Fixed customer meter organization ID tracking * Fixed bitwise SQL operator parentheses **2025-11-21** ## Customer Balance Customer balance system built on top of wallet infrastructure: * Track customer credit balances * Apply balances automatically to invoices * API support for balance management * Foundation for store credit and refund credits ## Members API New members management system for B2B customers: * GET `/v1/members` endpoint with pagination * Filter members by customer ID * Auto-create owner member when customer is created * Override owner member details via API * Members included in customer endpoints * Proper organization scoping and access control Perfect for managing team members across B2B customer accounts. ## Sign in with Apple Added Apple OAuth for authentication: * Apple OAuth integration ## Ad-hoc Checkout Pricing Create checkouts with dynamic pricing that override catalog prices: * Useful for custom deals, usage-based pricing, or testing * Supports all price types (fixed, free, custom) * Full API and SDK support [Read more](/docs/features/checkout/session#ad-hoc-prices) ## Churn Rate New churn rate metric on analytics dashboard: * Track subscription cancellations over time * Understand retention patterns * Available on homepage and customers page ## Event Labels Events now have customizable labels: * System events get readable labels automatically * User events can have custom labels * Labels shown throughout events UI * Edit labels via event type settings Makes events more readable and meaningful for your team. ## Spans View New spans interface for hierarchical event tracking (hidden for now): * List and detail views for event spans * Charts and sparklines for visualization * Time-series data with proper timezone handling * Cost aggregation across event hierarchies ## Metrics Performance Significant performance improvements for analytics: * Optimized metrics queries with window functions * Better date range bounds handling * Indexes on subscription date columns * Cumulative revenue includes full history * Fixed timezone and interval issues ## Invoice Numbering Changed default invoice numbering to per-customer (was organization-wide): * Each customer starts invoice numbering at 1 * Hides sales volume from individual customers * Can still switch to organization-wide in settings ## Tax & Billing * Show taxable amount after discount in checkout * Fixed tax ID formatting (was showing raw strings) * Fixed Stripe coupon name length validation * Fixed conflicting invoice numbering issues ## Checkout Improvements * Persist business name across checkouts * Hide cookie consent banner when logging in via app * Fixed expired checkout intent handling ## Bug Fixes * Fixed 404 after deleting customers, benefits, or checkout links * Fixed product price configurator validation * Fixed custom field number constraint validation * Fixed benefit capitalization in customer portal * Fixed organization cache after profile picture update * Fixed social link parsing ## Mobile App * Continue with Apple support * Disabled tablet support (phone-only for now) * Fixed EAS build configuration * Removed demo mode * Better workspace integration **2025-11-14** ## Trial Abuse Prevention Prevent customers from redeeming multiple trials with email aliases or different payment methods: * Email normalization strips `+aliases` to detect duplicates * Payment method fingerprinting tracks card usage * Enable via Settings → Subscription → "Prevent trial abuse" * Blocked customers see error and can still subscribe without trial * Checkout parameter `allow_trial` to force disable trials Perfect for controlling trial costs while still allowing new customers to subscribe. ## Event Types & Aggregation New event types system for better organization and analytics: * Event types automatically created for events with the same name * Custom display names for better readability * Statistics endpoint for event aggregation * Event closure tables for efficient hierarchy queries ## Mobile App (Beta) Polar mobile app added to the monorepo: * React Native implementation with Expo * Expo workflow for development and builds * Shared workspace with web dashboard * Foundation for mobile-first experiences ## Webhook Events Skipped events now properly tracked: * Events skipped when endpoint disabled no longer count as failures * Prevents false positives in health checks * Better webhook reliability metrics ## File Uploads Large file upload support: * Handles files larger than memory limits * Multipart upload handling * SHA256 validation per part * Better progress tracking ## Subscription Management ### Billing Period Control New API to change current billing period end date: * Useful for custom billing arrangements * Prorations calculated automatically * Prevented on already-cancelled subscriptions ### Payout Improvements * Increased minimum payout amounts for certain currencies * Better error logging for Stripe payout failures ## UI & UX ### Analytics Improvements * Fixed timezone issues with date range selection * Better interval formatting in legends * Improved preset intervals ("this year", "last year") * Consistent date handling across dashboard ### Customer Portal * Fixed overflowing invoice action buttons * Improved mobile experience ### Settings * Auto-prefix social media URLs * Removed seat-based billing toggle (now standard) ## Bug Fixes * Fixed `allow_trial` parameter handling * Fixed dark mode colors across dashboard * Fixed tax rate limiting in sandbox environment * Fixed Stripe trial redemption error handling * Fixed member invitation dialog Enter key submission * Fixed large file upload memory issues * Fixed metrics organization filtering **2025-11-07** ## Hierarchical Events & Spans Events can now be organized hierarchically with parent-child relationships, perfect for tracking complex workflows: * Create event spans with `parent_id` reference * Use `external_id` as idempotency key to prevent duplicate events * View nested events in the dashboard * Navigate event hierarchies with dedicated event detail pages * Query transitive closure for efficient sub-hierarchy analysis This enables use cases like tracking LLM requests with multiple steps, or multi-phase order fulfillment workflows. ## Master-Detail Layout New master-detail layout pattern across the dashboard: * List view on the left, detail view on the right * Proper nested routing for direct linking * Better navigation and state management * Improved querystring handling Applied to customers, subscriptions, events, and more. ## Improved Date Range Picker Better date range selection throughout analytics: * Fixed "this year" and "last year" presets * Smart interval selection based on date range * Consistent behavior across all views * Better timezone handling ## Settings Auto-Save Settings now auto-save as you type instead of requiring manual save button clicks. Includes proper debouncing and error handling for a smoother experience. ## Customer Management Enhancements ### Product Subscription View Product overview now shows active subscriptions table, making it easier to see who's using each product. ### Customer Filtering Filter subscriptions by cancellation status - find subscriptions that will cancel at period end. ### Benefit Grants Added direct links to customers and subscriptions from benefit grants overview for easier navigation. ## Account Management * Email notifications when unlinking accounts from organizations * Fixed OAuth account disconnection for users with multiple accounts on the same platform ## Bug Fixes * Fixed customer update trying to set email to None when explicitly provided * Fixed payment method handling when soft-deleted methods are updated from Stripe * Added maximum length validation to customer names * Fixed customer portal theming * Fixed subscription double cycling with proper locking mechanisms * Fixed Mintlify docs CSP configuration **2025-10-31** ## Cost Insights We've launched Cost Insights - a powerful way to track and analyze costs associated with usage. Now you can: * Track costs per event with sub-cent precision * View cost analytics across your dashboard * See cost breakdowns by customer and product * Monitor cost trends with dedicated charts Perfect for understanding unit economics and profitability of your usage-based offerings. [Read more](/docs/features/cost-insights/introduction) ## Webhook Management ### Auto-Disable Failing Webhooks Webhooks that continuously fail (10+ consecutive failures by default) are now automatically disabled to save resources. You can manually re-enable them from the dashboard once the issue is fixed. ### Email Notifications for Webhook Failures When webhooks are automatically disabled due to continuous failures, all organization members receive an email notification with details and steps to re-enable. ## Benefit Revocation Grace Period Configure a grace period for benefit revocation when subscription payments fail. Instead of immediately revoking benefits, you can now give customers time to resolve payment issues: * Immediate revocation (default) * Grace period matching payment retry window This applies to both regular benefits and customer seat benefits. ## Customer Portal Enhancements ### Upcoming Charge Display Subscription detail pages now show the upcoming charge amount and date, including: * Trial end dates with first charge amount * Next billing cycle charges for active subscriptions * Automatic updates when subscriptions change ### Usage & Metering View Improved the customer usage view: * Respect archived meters - they no longer appear in usage tracking * Better empty states for customers with granted credits * Create customer meters automatically when meter credits are granted ### Navigation & UX Improvements * Fixed navigation highlighting on mobile * Better handling of expired login codes * Removed unnecessary scrolling * Can't switch plans during trial period (not supported yet) ## Seat Management Updates * API support for assigning seats programmatically * \$0/seat pricing now allowed for seat-based tiers * Fixed eager loading issues with customer seats * Better webhooks for customer seat events ## Invoice Numbering Two invoice numbering modes: * **Organization-wide** (default) - Sequential across all customers * **Per-customer** - Each customer has independent invoice numbering starting at 1 Useful when you want to hide sales volume from customers. ## System Events New system events automatically created for: * Orders paid * Orders refunded * Customer creation * Customer updates These events are available in the events explorer with cost tracking where applicable. ## Discount Management Improved discount code selection with a searchable combobox instead of a dropdown, making it easier to find specific codes. ## Bug Fixes * Fixed customer meter matching to include external customer IDs * Fixed Indian GST tax validation * Fixed subscription dunning process when payment is deleted * Fixed order confirmation emails for orders without products **2025-10-24** ## Seat-Based Pricing for One-Time Products You can now offer seat-based pricing for one-time purchases, not just subscriptions. Customers can select the number of seats during checkout, and you can manage seats for one-time orders through both the dashboard and API. This extends our seat management capabilities to all product types, giving you more flexibility in how you price and package your offerings. ## Ability to Change Subscription Seats Customers can now change the number of seats on their active subscriptions directly from the Customer Portal. The changes are prorated automatically, making it easy for teams to scale up or down as needed. ## Flexible Subscription Intervals We've added support for flexible subscription intervals beyond monthly and yearly. You can now create subscriptions with custom billing periods: * Daily subscriptions * Weekly subscriptions * Custom intervals (e.g., every 2 weeks, every 3 months) Configure the interval count when creating or updating subscription products through both the dashboard and API. ## Subscription Creation API We've launched a new API endpoint to create subscriptions programmatically. This enables you to set up subscriptions directly without requiring customers to go through the checkout flow. [Read more](/docs/api-reference/current/subscriptions/create-subscription) ## Enhanced Email Confirmations Order confirmation emails now include: * **Invoice PDFs attached** - Invoices are automatically generated and attached to confirmation emails for one-time purchases * **Order details** - Complete breakdown of what was purchased * **Benefits list** - Clear view of all benefits the customer will receive ## Customer Portal Improvements ### Seat Management Customers with seat-based subscriptions can now: * View all active seats * Add or remove seats (with automatic proration) * Manage team members directly from the portal ### URL Encoding Fix Fixed an issue where email addresses with special characters (like `+` signs in email aliases) weren't properly encoded in customer portal links, causing the wrong email to be pre-filled. ## Events & Metering ### Cost Tracking Events can now include cost metadata, enabling you to track costs associated with usage. Costs are displayed throughout the events explorer and analytics. ### Event Explorer Enhancements * Metadata filtering - Search and filter events by metadata fields * Customer filtering - Filter events by specific customers * Query search - Full-text search across event data * Improved event cards with better timestamps and cost visualization ## Order Export You can now export orders to CSV directly from the dashboard. Filter by product and the export will respect your current filters, making it easy to analyze sales data. ## OAuth2 Flow Improvements * If no scope is passed in the authorize request, the client's default scope is now used automatically * Improved organization selector UI in the OAuth2 authorization flow ## Checkout Improvements * Fixed seat selector visibility on mobile devices * Server-side prefilling of checkout link query parameters * Improved discount code validation flow ## Statement Descriptor Enhancement First payments after a trial period now include "TRIAL OVER" in the statement descriptor, making it clearer to customers why they're being charged. ## Bug Fixes * Fixed customer state API for trialing subscriptions * Fixed broken customer links in events explorer * Fixed discount duration calculation for very long durations (capped at 999 months) **2025-10-17** ## Ability to update subscription to an updated price of the product Merchants can now [update existing subscriptions](https://polar.sh/docs/api-reference/current/subscriptions/update-subscription#subscriptionupdateproduct) from archived pricing schemes to current ones within the same product. * Enables migration from grandfathered pricing to current pricing schemes * Prorations calculated using active subscription prices * In the dashboard, a small badge **Upgrade pricing** will indicate that you can update to the same product, but with the new pricing scheme. ![](https://mintcdn.com/polar/P14Bx1Nt4rA16sHk/assets/changelog/2025-10-17/update-subscription.png?fit=max\&auto=format\&n=P14Bx1Nt4rA16sHk\&q=85\&s=84b0f80f4c5d6c6ede3fb478d93febb9) ## New IP ranges From **October 27th, 2025**, [new IP ranges](https://polar.sh/docs/integrate/webhooks/delivery#ip-allowlist) will be added. ## Improved Subscription Cancellation Flow [Benefits](https://polar.sh/docs/features/benefits/introduction) attached to the subscription [are now automatically revoked](https://github.com/polarsource/polar/pull/7271) when the subscription is canceled. ## Ability to specify External ID [External ID can now be specified](https://github.com/polarsource/polar/pull/7275) during creation of a customer via the dashboard. ![](https://mintcdn.com/polar/P14Bx1Nt4rA16sHk/assets/changelog/2025-10-17/create-customer.png?fit=max\&auto=format\&n=P14Bx1Nt4rA16sHk\&q=85\&s=4f96d098affca55b7140c26196e16852) ## Ability to set Return URL for Checkouts and Customer Portal A Return URL can now be set while generating a [checkout session](https://polar.sh/docs/api-reference/current/checkouts/create-checkout-session#body-return-url-one-of-0) or a [customer portal session](https://polar.sh/docs/api-reference/current/customer-sessions/create-customer-session#body-one-of-0-return-url-one-of-0). This allows you to preserve the context for the end users who visit either if they wish to go back to the application. ## Ability to search Customers via their External ID The [List Customers API](https://polar.sh/docs/api-reference/current/customers/list-customers) now accepts Customer's External ID [in the **query** parameter](https://polar.sh/docs/api-reference/current/customers/list-customers#parameter-one-of-0). ## Ability to disable automatic customer emails Via the organization settings, you can now disable the emails we automatically send to customers on certain events. This gives you the ability to own the communications with the customers. ![](https://mintcdn.com/polar/P14Bx1Nt4rA16sHk/assets/changelog/2025-10-17/email-settings.png?fit=max\&auto=format\&n=P14Bx1Nt4rA16sHk\&q=85\&s=d64d9fd9fa62439c370ca5a39a62a47a) **2025-10-10** ## Launched In-Product Chat Support for Merchants ![](https://mintcdn.com/polar/BSq8s4sf_HNjO0FK/assets/changelog/2025-10-10/launched-merchant-support.jpg?fit=max\&auto=format\&n=BSq8s4sf_HNjO0FK\&q=85\&s=8d424a428d041a57cd35ea2e3128071f) We're excited to introduce a chat widget to the Polar dashboard, making it easier than ever for merchants to get help directly within the product. ## Improved Checkout Flow for Invalid Discount Code Previously, if you entered an invalid discount code during checkout, you couldn't continue even after removing the code. Now, clearing the discount input lets you proceed smoothly with the checkout process. ## Improved Customer Portal Rate Limits We've made several improvements to the Customer Portal to handle authentication rate limits more gracefully: * The portal now clearly shows 401 and 429 errors on the OTP (one-time password) page. * If you hit a 429 (too many requests), you'll be redirected to a clear `/too-many-requests` page. **2025-10-01** ## Launched Subscription Trials You can now offer [trial periods](/docs/features/trials) for new subscriptions! This highly requested feature allows you to let customers experience your product before their first payment is due. Trials can be configured in both the dashboard and API when creating or updating subscription products. ## Always display taxes line item in the checkout We've improved our checkout experience to always display taxes (vs lazy loading them on country selection), making charges more transparent for your customers regardless of whether taxes apply to their purchase. ## Do not calculate taxes on free or zero-amount orders Orders with a zero amount (such as promotional products) will no longer have taxes calculated, resulting in a clearer and more accurate order summary for your customers. ## Add confirmation modal for deleting discounts When deleting a discount, you'll now see a confirmation modal to help prevent accidental deletions and provide extra clarity on the impact of your actions. ## Fix infinite rendering loop with date picker Resolved a bug where selecting dates in the date picker could cause an infinite rendering loop, improving reliability for date-related forms. ## Require opt-in if you will be charged immediately Users must now explicitly confirm immediate charges or credits when switching subscription intervals, with the UI providing clearer, contextual explanations of invoicing outcomes. ## Check for `expires_at` when activating license keys License key activation now correctly checks the `expires_at` date, ensuring that only valid, non-expired license keys can be activated. ## Fix customer state for trialing subscriptions The [Customer State API](/docs/api-reference/current/customers/get-customer-state) now properly handles customers with `trialing` subscriptions, so your integrations and dashboards always show an accurate subscription status. **2025-09-22** ## Improved preview of next invoice in Customer Portal We've enhanced the Customer Portal to provide a clearer and more accurate preview of your next invoice. The overview now updates automatically after subscription changes, and you can preview upcoming charges with all relevant taxes and discounts included. ## Cancellation metrics ![](https://mintcdn.com/polar/KPDvrxuIefIR_xN_/assets/changelog/2025-09-22/cancellation-metrics-example.png?fit=max\&auto=format\&n=KPDvrxuIefIR_xN_\&q=85\&s=03281906e75a2f354a6636e54d226296) We've added detailed cancellation metrics, giving you clearer insights into subscription cancellations and their impact on your business performance. **2025-09-12** ## Webhooks payload now includes timestamp We've updated our webhooks server implementation to [include a timestamp in each payload](https://github.com/polarsource/polar/pull/6770), in line with the Standard Webhooks specification. This change ensures that every webhook payload contains precise event timing, making it easier to trace and debug webhook deliveries, and to meet integration requirements for external platforms. **2025-09-05** ## Meter management improvements We've made it easier to manage your meters with new UI functionality for archiving and unarchiving meters directly from the dashboard. You can now archive meters that are no longer needed, which helps keep your meter list organized. Archived meters can be unarchived if you need to use them again. Note that meters cannot be archived if they are still attached to active products or referenced by active benefits. ## Metrics accuracy improvements We've improved the accuracy of our metrics by excluding unpaid orders from all calculations. Previously, orders in pending status were included in metrics, which could lead to inflated numbers. Now, only successfully paid and refunded orders are included in metrics calculations, giving you a more accurate view of your actual business performance. ## Enhanced customer email branding We've improved the branding of emails sent to your customers by using organization-specific 'From' and 'Reply-to' addresses. Customer emails now appear to come from your organization (e.g., "YourOrg (via Polar)") with replies directed to your organization's email address, providing a more professional and branded experience for your customers. **2025-06-12** ## Update subscription discount We've added the ability to update the discount on a subscription. This allows you to add, remove, or change the discount applied to a subscription at any time. This feature is both available through the [API](/docs/api-reference/current/subscriptions/update-subscription) and the dashboard. **2025-06-05** ## Payout Reverse Invoices We've added the ability to generate reverse invoices for payouts directly from the Payouts page. This feature allows you to easily create an invoice that details the sales made on your behalf, minus our fees. [Read more](/docs/features/finance/payouts#reverse-invoices) **2025-05-22** ## Business Purchase Option on Checkout We've added a new "I'm purchasing as a business" checkbox to the Checkout flow. When selected, customers are required to provide their business billing name and complete billing address. **2025-05-19** ## Enhanced Attribution for Checkout Links We've added support for `reference_id` and UTM parameters (`utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, `utm_term`) as query parameters for Checkout Links. These parameters are automatically stored in the Checkout metadata, allowing you to track the source of your traffic and conversions more effectively. [Read more](/docs/features/checkout/links#store-attribution-and-reference-metadata) **2025-05-15** ## Checkouts and payments insights We've added a new **Checkouts** tab under the **Sales**, where you can review all the checkout sessions, successful or not. You can filter them by customer email, status, and product. You can also see the payment attempts for each checkout session, including the reason for any failed or declined payments. ![](https://mintcdn.com/polar/fnujBPxaFvfkZfB0/assets/features/orders/checkout.light.png?fit=max\&auto=format\&n=fnujBPxaFvfkZfB0\&q=85\&s=4672cafc0b218d34a55c5cc006fdb153) The payment attempts information is also available on each order. Besides, we've also added new analytics around checkouts: total number of checkouts, successful checkouts, and conversion rate. **2025-03-11** ## Zapier integration officially launched We're excited to announce the official launch of our [Zapier integration](https://zapier.com/apps/polar/integrations)! Get started now and connect Polar to 2,000+ other web services. > [!NOTE] > > We've focused on **triggers** (webhooks) for now, so you can react to events in Polar and trigger actions in other apps. > > Need to perform actions in Polar? Tell us about your use case [here](https://github.com/orgs/polarsource/discussions/new?category=integrations\&labels=integrations%2Fzapier) and we'll consider adding more actions in the future. **2025-03-05** ## Customer State Maybe one of our neatest features to date! Customer State is a concept allowing you to query for the current state of a customer, including their **active subscriptions** and **granted [benefits](/docs/features/benefits/introduction)**, in a single [API call](/docs/api-reference/current/customers/get-customer-state-by-external-id) or single [webhook event](/docs/api-reference/current/customer_state_changed). Combined with the [External ID](/docs/features/customer-management#external-id) feature, you can get up-and-running in minutes. [Read more](/docs/integrate/customer-state) **2025-03-04** ## Better Auth Plugin Integrating authentication and billing for your users has never been easier. ![](https://mintcdn.com/polar/Ut0vPUvE1pIdMcH2/assets/changelog/2025-03-04/better_auth.jpeg?fit=max\&auto=format\&n=Ut0vPUvE1pIdMcH2\&q=85\&s=41206888e5c593cac95721d75ef3292c) [Better Auth](https://www.better-auth.com/) is an open source authentication framework for TypeScript that is quickly becoming a favorite amongst developers. Today, we're thrilled to have shipped a Polar plugin for Better Auth - in collaboration with them. Checkout our [integration guide](/docs/integrate/sdk/adapters/better-auth). **2025-02-27** ## Customer External ID We've added support for an `external_id` field on Customers. We believe this will greatly simplify the reconciliation process between your system and Polar. Previously, the recommended way to reconcile with your users was to use `metadata`. However, this was not always the most convenient method, especially if you needed to fetch a Customer from our API. With `external_id`, you can now fetch a Customer directly by their external ID through dedicated `GET`, `PATCH`, and `DELETE` endpoints. You don't even need to store Polar's internal ID in your system anymore! [Read more](/docs/features/customer-management#external-id) Of course, you can also directly preset `external_customer_id` when creating a Checkout Session, and it will automatically be set on the newly created Customer after a successful checkout. [Read more](/docs/features/checkout/session#external-customer-id) **2025-02-19** ## Polar's take on Product variants We've released big changes to how we handle products and pricing, allowing us to support a unique approach to what the industry typically calls **variants** 🔥 We believe having a single product with multiple pricing models and benefits adds unneccessary complexity to the user and to the API. Instead, we chose to treat everything as a product, giving you maximum flexibility about the pricing and benefits you want to offer. Thus, we introduce support for **multiple products** at checkout, allowing customers to switch between them before purchasing. Typically, you can offer a monthly and a yearly product, with specific pricing and benefits for each. ![](https://mintcdn.com/polar/Ut0vPUvE1pIdMcH2/assets/features/checkout/session/checkout_multiple_products.light.png?fit=max\&auto=format\&n=Ut0vPUvE1pIdMcH2\&q=85\&s=36f88ae4e5e70735484c068f3605b713) This is available right now using the [Checkout Session API](/docs/features/checkout/session) and [Checkout Links](/docs/features/checkout/links). ### Depreciations * Products can no longer have both a monthly and yearly pricing. Existing products still work, but you'll see a warning like this when trying to edit their pricing: ![](https://mintcdn.com/polar/Ut0vPUvE1pIdMcH2/assets/changelog/2025-02-19/deprecated_pricing.light.png?fit=max\&auto=format\&n=Ut0vPUvE1pIdMcH2\&q=85\&s=49934d3505bcdc38dbeafe43f9a72b58) ### API changes * The `product_id` and `product_price_id` fields are deprecated in the [Checkout Session API](/docs/api-reference/current/checkouts/create-checkout-session). You should now use the `products` field to specify the products you want to include in the checkout. * The `type` and `recurring_interval` fields on `ProductPrice` are deprecated. `recurring_interval` is now set directly on `Product`. # Security and Vulnerability Reporting Source: https://polar.sh/docs/security At Polar, we care deeply about the safety and security of our customers' data and our systems. We welcome security and vulnerability reports as part of our commitment to providing the most secure product possible. ## Making a report If you've read this document and discovered an issue that you believe is in-scope, Please report it using [GitHub Security Advisory](https://github.com/polarsource/polar/security/advisories/new) tool. It should include: * A clear summary of the issue and its potential impact. * Detailed steps to reproduce the issue. * Relevant environmental details (browser, OS, version numbers, etc.). * Any proof-of-concept code that demonstrates the vulnerability, if available. Our security team will review your report and keep you updated on our progress, requesting additional information or clarification when needed. We believe that vulnerability reporting creates a safer, better product for our customers. As such, we might offer compensation for reports that lead to a confirmed vulnerability, at our discretion. ## Timeline We'll get back to you within a few days to acknowledge your report. ## What we're most interested in * Authentication bypass and privilege escalation. * Exposure of personally identifiable information (PII). * Unauthenticated access to user data (outside of intentionally public data). ## In scope * [https://polar.sh](https://polar.sh) * [https://api.polar.sh](https://api.polar.sh) ## Out of scope * Automated scanning. * Social engineering. * Denial of Service attacks. * Attacks that need physical access to someone's computer. * Theoretical attacks you can't actually exploit. * Man-in-the-middle attacks. * Clickjacking or UI redress attacks. * CSV injection. * HTML injection. * Missing security headers, weak TLS cipher suites, or DNS setup issues. We might find these informative, but they probably won't earn a bounty. ## Please be considerate while investigating * Only test with your own account (or get permission from the account owner first). * Don't modify, delete, or store private data that isn't yours. * Avoid anything that might break or slow down our services. * If you get remote access to our systems, don't try to expand or elevate your access. # Support Source: https://polar.sh/docs/support ## Documentation Our documentation covers common questions, setup guides, and product details. We recommend using it as a first point of reference whenever you need guidance or support. If question isn't addressed in the documentation, feel free to reach out to us over email. ## Dashboard Feature requests & bugs can be reported through the "Feedback" button found in the sidebar, bottom left of your Polar dashboard. ## Email You can reach us at [support@polar.sh](mailto:support@polar.sh). We typically respond within **24–48 hours on weekdays** for customers and active merchants, and prioritize questions related to ongoing billing, payouts or payments. Please note that during periods of higher request volume, response times may occasionally be longer. ## Merchant Account Reviews Account reviews are typically performed within 7 days, but can take up to 14 days to complete, depending on volume, weekends, and holidays. More information on our account reviewal process can be found in our [Account Reviews documentation](https://polar.sh/docs/merchant-of-record/account-reviews)