Launchframe

Billing

Launchframe implements billing behind a provider abstraction so your app code doesn't couple to a specific vendor.

Provider modules

billing-stripe (default)

Stripe checkout sessions, customer portal, and webhook handling.

billing-polar

Polar — developer-friendly billing alternative. Same abstraction interface.

Select your provider:

npx create-launchframe my-app --billing stripe
npx create-launchframe my-app --billing polar
npx create-launchframe my-app --billing both
npx create-launchframe my-app --billing none

Provider contract

interface BillingProvider {
  createCheckoutSession(input: {
    userId: string;
    customerEmail: string;
    priceId: string;
    successUrl: string;
    cancelUrl: string;
  }): Promise<{ url: string }>;

  createCustomerPortalSession(input: {
    userId: string;
    customerId: string;
    returnUrl: string;
  }): Promise<{ url: string }>;

  handleWebhook(input: {
    rawBody: string;
    signature?: string;
  }): Promise<void>;
}

Key files

FilePurpose
src/lib/billing.tsProvider initialization
src/app/billing/page.tsxBilling management page
src/app/api/billing/webhook/route.tsWebhook handler

Environment (Stripe)

STRIPE_SECRET_KEY=sk_test_...
STRIPE_PUBLISHABLE_KEY=pk_test_...
STRIPE_PRICE_ID=price_...
STRIPE_WEBHOOK_SECRET=whsec_...

Environment (Polar)

POLAR_ACCESS_TOKEN=...
POLAR_ORGANIZATION_ID=...
POLAR_WEBHOOK_SECRET=...