Polar Documentation

website·Indexed 41 days ago

https://polar.sh

Developer platform for selling digital products and subscriptions. Features include a checkout API (v2026-04), embedded checkouts, automated benefits for GitHub and Discord access, customer portals, and cost insights for tracking profits and customer lifetime value.

Tokens
85.1K
Snippets
363
Records
736
Agent score
74%

What's inside Polar

  1. Overview of Polar Automated Benefits

    Polar provides built-in benefit (entitlement) automation to handle common upsells for developers and designers. These benefits are standalone resources that can be linked to one or multiple products or subscription tiers, allowing for centralized management and consistency across different offerings.
  2. Overview of Single Sign-On (SSO) in Polar

    Single Sign-On allows teams to sign in to Polar using their own identity provider (IdP). Polar supports any provider implementing OpenID Connect (OIDC), such as Google Workspace, Okta, Microsoft Entra ID, and Keycloak. SSO is available on the Scale plan. When configured, anyone who authenticates via the identity provider automatically becomes a member of the organization with the Member role.
  3. Overview of the Stripe to Polar migration process

    Migrating from Stripe to Polar involves a multi-stage workflow where both billing systems coexist. New customers are routed to Polar, while existing subscriptions continue to renew on Stripe until they are explicitly switched. The migration follows these six stages:

    1. Move new sales to Polar: Integrate Polar API/webhooks for new checkouts.
    2. Connect Stripe account: Provide a restricted API key for read and cutover access.
    3. Assess and import catalog: Import products, prices, and customers into Polar.
    4. Move saved cards: Perform an account-to-account copy of payment methods from Stripe to Polar.
    5. Switch billing to Polar: Transition selected subscriptions to renew in Polar.
    6. Reconcile and clean up: Verify data and retire Stripe processing where applicable.
  4. Overview of Polar Usage Based Billing

    Polar's Usage Based Billing allows developers to charge customers based on application usage. The workflow consists of three main steps: ingesting events from the application, creating Meters to aggregate those events into measurable usage, and adding metered prices to Products to bill customers for that usage.
  5. Overview of Polar billing infrastructure

    Polar is a complete billing infrastructure and Merchant of Record (MoR) that enables developers to sell digital products and subscriptions globally. Unlike simple payment processors, Polar handles international tax compliance (VAT, GST, sales tax), product management, and automated delivery of benefits. As the Merchant of Record, Polar calculates, collects, and remits taxes worldwide, removing the legal and administrative burden from the developer.
  6. Overview of Polar Usage Based Billing ingestion strategies

    Polar provides an ingestion framework and API to report usage events for billing purposes. To simplify the reporting of complex usage metrics, Polar offers several specialized ingestion strategies:

    • LLM Strategy: For reporting Large Language Model usage.
    • S3 Strategy: For reporting file uploads to S3.
    • Stream Strategy: For streaming-related usage.
    • Delta Time Strategy: For time-based usage increments.
  7. Overview of Unit-Based Pricing

    Unit-based pricing allows customers to purchase a specific quantity of a non-human unit (e.g., devices, licenses, gigabytes, servers) and pay for it up front. It is ideal for per-device licensing, prepaid capacity, or any quantity-based product where volume discounts should apply to a declared quantity.

    Key characteristics:

    • The buyer declares the quantity at checkout.
    • Payment is made up front.
    • Benefits are granted once per purchase, regardless of the quantity bought (e.g., buying 40 devices grants one license key, not 40).
  8. Overview of Usage Based Billing Meters

    Meters are used to filter and aggregate ingested events to define what usage is charged to customers. Polar uses these definitions to compute usage over time, both globally and per customer. Common examples include tracking AI token usage, video streaming duration, or file upload sizes.
  9. Overview of the Polar Customer Portal

    The Customer Portal is a hosted, self-service page provided by Polar that allows customers to manage their relationship with a business without requiring manual support. It is always available and cannot be disabled to ensure customers can access tax documents, cancel subscriptions (meeting legal requirements like California's Automatic Renewal Law), and update payment methods in a PCI-compliant manner.

    Key customer capabilities include:

    • Viewing active subscriptions and purchase history.
    • Downloading and editing invoices (e.g., adding VAT numbers or billing addresses).
    • Downloading payment receipts.
    • Accessing benefits such as license keys, file downloads, and Discord access.
    • Canceling active subscriptions.
    • Updating default payment methods to recover from failed payments.
    • Optional actions (configurable in Settings): changing email addresses, switching plans, managing seats, pausing/resuming subscriptions, and viewing metered usage.
  10. Overview of Feature Flag Benefits

    Feature Flag benefits provide a lightweight, API-driven way to grant feature access to customers without requiring external service integrations. Access is determined simply by whether a customer has the benefit grant. Common use cases include gating premium features behind subscription tiers, offering beta access to select users, differentiating product tiers, or controlling API rate limits and usage quotas.
  11. Track customer usage meter balances

    To monitor a customer's remaining credits for a given meter, you can:

    1. Use the Customer State integration for a general overview of the customer and their active meters.
    2. Use the Customer Meters API to specifically query the balance of meters.

    Important: Polar does not automatically block usage when a customer's balance is exceeded. You must implement your own application logic to prevent further usage once the balance reaches zero.

  12. Authenticate requests to the Polar API

    The Polar API provides two primary mechanisms for authenticating requests. Organization Access Tokens (OAT) are recommended for most use cases, while the OAuth 2.0 Provider is intended for partner integrations. All bearer tokens must be kept private and should never be exposed in client-side code.