Adapters
Use your existing billing provider. Your code stays the same.
Available adapters
| Adapter | Status | Description |
|---|---|---|
| Stripe | Stable | Full Stripe Billing integration |
| Polar | Stable | Polar.sh subscription support |
| Mock | Stable | Testing 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 }),
// ...
});