Skip to main content

Get your first checkout running

This guide walks you through creating a Polar account, setting up your first product, and generating a checkout link. No code required to get started.
1

Create your Polar account

Head to polar.sh and sign up with your GitHub account.
Polar uses GitHub OAuth for authentication. This also enables automatic GitHub repository access benefits if you need them later.
After signing in, you’ll create your first organization. This represents your business or project.
2

Create your first product

Navigate to Products in the dashboard sidebar and click Create Product.
For recurring revenue (SaaS, memberships):
  1. Name: “Pro Plan”
  2. Description: Describe what customers get
  3. Type: Select Subscription
  4. Price: Set your monthly price (e.g., $29/month)
  5. Billing Interval: Choose Monthly or Yearly
You can add both monthly and yearly prices to the same product by creating multiple price points.
Click Create Product to save.
3

Add benefits (optional)

Benefits are what customers receive after purchasing. You can add them now or skip this step.
Automatically invite customers to private repositories:
  1. Go to your product page
  2. Click Add BenefitGitHub Repository Access
  3. Connect your GitHub account if not already connected
  4. Select the repository
  5. Choose permission level (Read, Write, or Admin)
You must be an owner or admin of the repository to grant access.
Auto-assign Discord roles to customers:
  1. Click Add BenefitDiscord
  2. Connect your Discord server
  3. Select the role to assign
  4. Customers will receive an invite link after purchase
Generate unique license keys:
  1. Click Add BenefitLicense Keys
  2. Configure key settings:
    • Prefix for your keys
    • Expiration (optional)
    • Activation limit (optional)
  3. Keys are generated automatically on purchase
Provide secure download links:
  1. Click Add BenefitFile Downloads
  2. Upload your files (PDFs, ZIPs, etc.)
  3. Files are available in the customer portal
Learn more about Benefits →
4

Set up Stripe (for production)

Polar uses Stripe to process payments. For testing, you can skip this step.
By default, you’re in Sandbox mode. All checkouts use Stripe test mode:
  • Use test card: 4242 4242 4242 4242
  • Any future expiry date
  • Any CVC code
Perfect for testing your integration before going live.Learn more about Sandbox →
5

Create a checkout link

Now create a shareable link customers can use to purchase:
  1. Navigate to Checkout Links in the sidebar
  2. Click Create Checkout Link
  3. Configure your checkout:
    Product
    required
    Select the product you created
    Success URL
    optional
    Where to redirect customers after payment:
    https://yoursite.com/welcome?checkout_id={CHECKOUT_ID}
    
    The {CHECKOUT_ID} parameter is replaced automatically.
    Label
    optional
    Internal label to organize your links (e.g., “Twitter Bio Link”)
    Allow Discount Codes
    boolean
    Let customers enter discount codes at checkout
  4. Click Create to generate your link
You’ll get a URL like:
https://polar.sh/your-org/checkout/link-123
Share this link anywhere - website, social media, emails, etc.
6

Test your checkout

Open your checkout link in a new tab to test the flow:
  1. Click through the checkout process
  2. In test mode, use: 4242 4242 4242 4242
  3. Complete the test purchase
  4. Check Orders in your dashboard to see the test order
  5. If you added benefits, verify they were granted in Customers
The customer portal is available at https://polar.sh/customer-portal. Customers can manage subscriptions, download invoices, and access benefits.

What you’ve accomplished

You now have a product that represents what you’re selling. You can:
  • Add more price tiers (monthly + yearly)
  • Update description and images
  • Attach multiple benefits
  • Archive when no longer selling
Your checkout link handles:
  • Secure payment collection
  • Customer account creation
  • Tax calculation (sales tax & VAT)
  • Receipt generation
  • Benefit fulfillment
You can safely test:
  • Different payment scenarios
  • Subscription flows
  • Benefit grants
  • Webhook events
Switch to production when ready.

Next steps

Integrate via API

Create checkouts programmatically with our REST API

Set up webhooks

React to checkout events in your application

Customize checkout

Brand your checkout with custom colors and logos

Add usage billing

Bill customers based on consumption metrics

Common customizations

Add a discount code

  1. Go to Discounts in the sidebar
  2. Click Create Discount
  3. Configure:
    • Code: LAUNCH20 (customer enters this)
    • Type: Percentage or fixed amount
    • Value: 20% or $10 off
    • Duration: Forever, once, or repeating
  4. Customers can enter this code at checkout
Learn more about Discounts →

Offer a free trial

  1. Edit your subscription product
  2. Scroll to Trial Period
  3. Set trial duration (e.g., 14 days)
  4. Choose whether to require a payment method
Customers get full access during the trial. Billing starts automatically after the trial ends. Learn more about Trials →

Embed checkout in your site

Instead of redirecting to Polar’s hosted checkout, embed it:
import { Polar } from "@polar-sh/sdk";

const polar = new Polar({
  accessToken: process.env.POLAR_ACCESS_TOKEN,
});

// Create checkout session
const checkout = await polar.checkouts.create({
  productPriceId: "prp_...",
  successUrl: "https://yoursite.com/success",
});

// Redirect to checkout.url
return Response.redirect(checkout.url);
View full embedding guide →

API-first workflow

Prefer to manage everything via API? Here’s the complete flow:
1

Get an access token

Create a Personal Access Token or Organization Access Token:
  1. Go to SettingsTokens
  2. Click Create Token
  3. Select scopes: products:write, checkouts:write
  4. Copy the token (shown once)
Learn more about Authentication →
2

Create a product

const product = await polar.products.create({
  name: "Pro Plan",
  description: "Full access to all features",
  prices: [
    {
      amountType: "fixed",
      priceAmount: 2900, // $29.00 in cents
      priceCurrency: "USD",
      recurringInterval: "month",
    },
  ],
});
3

Create a checkout

const checkout = await polar.checkouts.create({
  productPriceId: product.prices[0].id,
  successUrl: "https://yoursite.com/success",
  customerEmail: "[email protected]",
});

// Redirect customer to checkout.url
4

Listen for webhooks

Set up a webhook endpoint to receive events:
// POST /webhooks/polar
export async function POST(req: Request) {
  const event = await req.json();
  
  if (event.type === "checkout.completed") {
    // Payment successful!
    const customerId = event.data.customer_id;
    const orderId = event.data.order_id;
    
    // Grant access in your system
    await grantAccess(customerId);
  }
  
  return new Response("OK", { status: 200 });
}
View all webhook events →

Troubleshooting

Issue: Customer completed checkout but didn’t receive benefitsSolutions:
  • Check Orders → select the order → view Benefits tab
  • Look for errors in the benefit grant status
  • For GitHub: Ensure the repository is accessible
  • For Discord: Verify bot has proper permissions
  • Check webhook logs for benefit.grant.created events
Issue: Can’t complete Stripe onboardingSolutions:
Issue: Test checkouts show payment errorsSolutions:
  • Use Stripe test card: 4242 4242 4242 4242
  • Ensure you’re in Sandbox mode (check dashboard banner)
  • Try a different test card from Stripe’s test cards
  • Check browser console for errors
Need more help? Join our Discord community or check GitHub Discussions.

Next.js Integration

Full guide for Next.js apps

Laravel Integration

Complete Laravel setup

Webhooks Guide

Handle checkout events

Build docs developers (and LLMs) love