Adapters

Use your existing billing provider. Your code stays the same.

Available adapters

AdapterStatusDescription
StripeStableFull Stripe Billing integration
PolarStablePolar.sh subscription support
MockStableTesting without a real provider

How adapters work

Each adapter implements the same interface:

interface BillingAdapter {
  getEntitlement(userId: string): Promise<Entitlement | null>;
  parseWebhook(body: string, signature: string): Promise<BillingEvent>;
}

Swap providers by changing one line:

import { createEnhancedClient } from "@fuime/billing-sdk";
import { stripe } from "@fuime/billing-sdk/stripe";
// import { polar } from "@fuime/billing-sdk/polar";

const billing = createEnhancedClient({
  provider: stripe({ apiKey: process.env.STRIPE_KEY }),
  // provider: polar({ accessToken: process.env.POLAR_TOKEN }),
  // ...
});