• Pricing
  • Blog
Log inBook a demo

Balance Template

Balance-based billing with fixed unit prices. Customers prepay a balance and consume it per request at prices you set.

Templates
Live DemoSource
Balance Template

Next.js SaaS template for API products that charge fixed unit prices against a prepaid balance. Customers load a dollar balance and every action deducts real dollars at the price you set.

Two plans (Starter, Pro) with different starting balances. Two features with fixed per-unit costs: API calls and image processing.

Stack: Next.js 16, Better Auth, Drizzle ORM, PostgreSQL, Commet SDK

Quick Start

commet create my-app -t balance-fixed
cd my-app
pnpm install
pnpm dev

What's Included

  • Two plans with different starting balances ($25, $75)
  • Two features with fixed unit prices (API Call, Image Processing)
  • Balance deduction per usage at fixed rates
  • Block on exhaustion — usage stops when balance runs out
  • Interactive usage demo on dashboard
  • Customer billing portal with top-up support
  • Pricing page with balance amounts

Key Files

  • lib/auth/auth.ts — Better Auth + Commet plugin with usage module
  • lib/payments/commet.ts — Checkout session creation
  • app/(dashboard)/dashboard/page.tsx — Balance overview with usage simulation
  • app/pricing/page.tsx — Dynamic pricing page
  • app/api/commet/portal/route.ts — Customer portal redirect

Learn More

  • Consumption Models — Balance model details
  • Track Usage
  • Customer Portal

Run commet create my-app -t balance-fixed to start from this template, or browse the source on GitHub.

Subscription billing built for developers and agents

Get startedBook a demo

Accept global payments, handle usage-based pricing, subscriptions, and seats — without building your own infrastructure.

Status unavailable

Frameworks

  • Next.js
  • Remix
  • Nuxt
  • SvelteKit
  • Astro
  • Express
  • Hono
  • Django
  • FastAPI

Resources

  • Documentation
  • Guides
  • Blog
  • Templates
  • Changelog
  • Glossary
  • Billing for AI models

Company

  • Solutions
  • About
  • Open Source

Compare

  • Stripe Billing
  • Orb
  • Chargebee
  • Lago
  • Autumn
  • Yuno

AI

  • Commet Agents
  • MCP Server
  • Skills
  • Claude Code
  • Codex
  • Cursor
Follow us
© 2026 Commet Co.TermsPrivacy PolicyCookie Policy