Checkout sessions provide a secure, hosted payment flow for your products. Create one-time or subscription checkout experiences that handle payment processing, tax calculation, and customer management.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/polarsource/polar/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Checkout sessions are temporary payment flows that:- Expire after 30 days (configurable)
- Support multiple products and prices
- Handle tax calculation automatically
- Process payments via Stripe
- Create orders and subscriptions upon success
- Grant benefits automatically
Creating Checkout Sessions
Create checkout sessions programmatically via API or from checkout links.- API
- Client-side
Checkout Configuration
Products & Pricing
Configure which products customers can purchase:When multiple products are provided, customers can switch between them in the checkout UI.
Customer Pre-fill
Pre-populate customer information for faster checkout:Billing Requirements
- Standard
- Full Address
- Business
By default, customers only need to provide their country for tax calculation.
Seat-Based Configuration
For seat-based products, control the seat selection:Trials
Control trial availability at checkout:Discounts
Apply discounts or allow discount codes:Redirects
Checkout Flow
Checkout Status
Checkouts progress through these statuses:- open
- confirmed
- succeeded
- failed
- expired
Initial state. Customer can complete checkout.
Updating Checkout Sessions
Update open checkout sessions to modify configuration:Client-Side Access
Access checkout sessions from your frontend using the client secret:Embedding Checkout
Embed checkout in an iframe for seamless integration:Custom Fields
Collect additional data via custom fields attached to products:Subscription Upgrades
Upgrade free subscriptions to paid tiers via checkout:Only free subscriptions can be upgraded via checkout. Paid subscription changes use the subscriptions API.
Metadata
Store custom data on checkout sessions:- Copied to created orders and subscriptions
- Included in webhooks
- Searchable via API
Event Streaming
Subscribe to real-time checkout updates via Server-Sent Events:Payment Methods
Polar uses Stripe to process payments and supports:- Credit/debit cards (Visa, Mastercard, Amex, etc.)
- Apple Pay & Google Pay
- SEPA Direct Debit (EUR)
- ACH Direct Debit (USD)
- Link (Stripe’s one-click checkout)
Tax Handling
Taxes are automatically calculated based on:- Customer billing address
- Customer IP address (fallback)
- Product tax category
- Merchant of record jurisdiction
Error Handling
Payment Failed
Payment Failed
Status changes to
failed. Customer can retry with a different payment method.Already Active Subscription
Already Active Subscription
Returns
403 if customer already has an active subscription to the product.Expired Checkout
Expired Checkout
Returns
410. Create a new checkout session.Trial Already Redeemed
Trial Already Redeemed
Returns
403 if customer attempts to use a trial they’ve already redeemed.Organization Not Ready
Organization Not Ready
Returns
403 if the organization isn’t configured to accept payments.Best Practices
Pre-fill Customer Data
Pre-fill Customer Data
Pre-fill email and billing information when possible to reduce friction and increase conversion.
Use Metadata
Use Metadata
Store tracking information (campaign IDs, affiliate codes, etc.) in metadata for attribution.
Success URLs
Success URLs
Always provide a success_url to redirect customers after payment. Include
{CHECKOUT_ID} to retrieve details.Handle Webhooks
Handle Webhooks
Listen for
checkout.succeeded webhooks rather than relying solely on redirects.Test in Sandbox
Test in Sandbox
Use sandbox mode to test the full checkout flow before going live.
API Reference
Create Checkout
Create a new checkout session
Get Checkout
Retrieve checkout details
Update Checkout
Modify open checkout session
Confirm Checkout
Process payment and complete