• Pricing
  • Blog
Log inBook a demo

Add billing with Bun

Add subscriptions, usage-based pricing, metered billing, and payments to your Bun application using the Commet Node SDK.

Start billing for freeRead docs

Billing that fits your stack

Bun runs TypeScript natively — no build step. Install the SDK with bun add, import it, and start billing. Same API as Node, faster cold starts.

index.ts
import { commet } from "./commet";
Bun.serve({
async fetch(req) {
const url = new URL(req.url);
if (url.pathname === "/subscribe" && req.method === "POST") {
const { email, customerId } = await req.json();
await commet.customers.create({ email, id: customerId });
const sub = await commet.subscriptions.create({
customerId,
planCode: "pro",
});
return Response.json({ checkoutUrl: sub.checkoutUrl });
}
return new Response("Not found", { status: 404 });
},
});
import { commet } from "./commet";
Bun.serve({
async fetch(req) {
const url = new URL(req.url);
if (url.pathname === "/subscribe" && req.method === "POST") {
const { email, customerId } = await req.json();
await commet.customers.create({ email, id: customerId });
const sub = await commet.subscriptions.create({
customerId,
planCode: "pro",
});
return Response.json({ checkoutUrl: sub.checkoutUrl });
}
return new Response("Not found", { status: 404 });
},
});
Terminal
bun add @commet/node
bun add @commet/node

Install in seconds

Add billing to your Bun app with the Commet SDK. Fast, lightweight, and native TypeScript support.

Get startedDocumentation

Frequently Asked Questions

Install the Commet SDK, add your API key, and start billing. Follow the Bun integration guide for a step-by-step walkthrough with code examples.

Commet supports metered (pay for what you use), credits (block when exhausted), balance (spend across features), seats (per-user pricing), and boolean (feature gating). Learn more in the consumption models guide.

Yes. Call the usage tracking method whenever a billable event happens. Commet aggregates usage and bills it at the end of each billing period. Works for API calls, AI tokens, storage, or any custom metric. See the usage tracking guide for details.

Yes. Commet has a built-in AI model catalog with per-token pricing. You can track input, output, and cache tokens with configurable margins. See the AI token billing guide for setup instructions.

Yes. Commet is a Merchant of Record that handles taxes, compliance, refunds, and payouts. Stripe Tax is integrated for automatic tax calculation. Read more about the Merchant of Record model.

Commet has no setup fees and no monthly minimums. You only pay 5% + $0.40 per successful transaction. You can start building and testing for free using the sandbox environment. See pricing for details.

Commet works with every framework

Pick your stack — the SDK is the same everywhere. Subscriptions, usage tracking, and checkout work the same across Node, Python, Go, Java, and PHP.

  • Next.js
  • Express
  • Hono
  • Remix
  • SvelteKit
  • Nuxt
  • Astro
  • Python
  • Flask
  • FastAPI
  • Django
  • PHP
  • Laravel
  • Symfony
  • Go
  • Encore
  • Java

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