Framework Integrations
Learn how to integrate Better Billing with your favorite framework
Better Billing provides dedicated adapters for popular web frameworks, making it easy to set up API endpoints for webhooks and billing functionality.
How Integrations Work
All integrations work by converting Better Billing's router to your framework's expected format:
import { toFrameworkHandler } from "better-billing/integrations/framework-name";
// Convert Better Billing API to framework format
const handler = toFrameworkHandler(billing.api);Available Integrations
Choose your framework to get started:
- Next.js - Both App Router and Pages Router
- Solid Start - SolidJS framework integration
- SvelteKit - Svelte framework with multiple approaches
- Node.js/Express - Traditional server setup
- Custom Server - For unsupported frameworks
Webhook Configuration
Once your API endpoints are set up, you'll need to configure webhooks in your payment provider:
Stripe Webhook Setup
- Go to your Stripe Dashboard
- Click "Add endpoint"
- Enter your webhook URL:
https://yourdomain.com/api/billing/stripe/webhook - Select events or choose "Select all events" for full functionality
- Copy the webhook signing secret to your environment variables
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret_hereAPI Routes Created
When you set up any integration, Better Billing automatically creates these routes:
Stripe Plugin
POST /api/billing/stripe/webhook- Stripe webhook handlerGET /api/billing/stripe/checkout-session/success- Stripe checkout success handlerGET /api/billing/stripe/checkout-session/cancel- Stripe checkout cancel handler