billingsdk

Stripe

Full-featured adapter with checkout, subscriptions, customer portal, usage metering, and webhooks.

Installation

npm install billingsdk-core billingsdk-stripe

Configuration

import { stripe } from "billingsdk-stripe";

const adapter = stripe({
  secretKey: process.env.STRIPE_SECRET_KEY!,
  webhookSecret: process.env.STRIPE_WEBHOOK_SECRET,
  stripeAccount: process.env.STRIPE_ACCOUNT, // optional Connect
});

Get your secret key from the Stripe Dashboard. For webhook verification, add a webhook endpoint in Stripe and use its signing secret.

Capabilities

Checkout
Subscriptions
Customer Portal
Usage Billing
Subscription Pause
Subscription Resume
Webhook Verification

Usage Metering

Stripe is the only adapter that supports usage-based billing via meter events:

await billing.usage.report({
  customerId: "cus_123",
  meter: "ai_generations",
  quantity: 1,
});

const { total } = await billing.usage.get({
  customerId: "cus_123",
  meter: "ai_generations",
});