This guide walks you through adding BillingOS to your app. By the end, you’ll have a working pricing page with checkout.Documentation Index
Fetch the complete documentation index at: https://docs.billingos.dev/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites: A BillingOS account with at least one product created in the dashboard.
Step 1: Install the packages
Step 2: Create a session token endpoint
BillingOS uses session tokens to securely identify your customers. You create the token on your server (so your secret key stays private), and the SDK uses it automatically for all API calls. Add your secret key to your environment:.env.local
Step 3: Add the provider
BillingOSProvider wraps your app and handles fetching the session token automatically.
app/providers.tsx
app/layout.tsx
- Fetches a session token from your endpoint when the app loads
- Attaches the token to every API call
- Refreshes the token automatically before it expires
- Injects required CSS on mount (no separate CSS import needed)
Next.js App Router requires
"use client" for components that use React context. That’s why we create a separate Providers wrapper — your layout stays a Server Component.Step 4: Add a pricing page
Drop in thePricingTable component. It fetches your products and renders a complete pricing page with built-in checkout.
app/pricing/page.tsx
Step 5: Test it
Start your dev server and visit/pricing:
Test card number: Use
4242 4242 4242 4242 with any future expiry date and any CVC.What’s next?
Show a pricing page
Customize your pricing table with filters, themes, and custom actions.
Manage subscriptions
Add a self-service customer portal.
Gate features
Control access to features based on plan.