Skip to content

@xtandard/entitlements/billing

The billing intake and port (ADR 0007): createBilling(ent, { providers }) verifies provider webhooks, maps provider items to catalog plans and converges subscription state; createUsageExporter forwards usage to provider meters. Provider adapters live at billing/stripe, billing/polar, billing/paddle, billing/lemonsqueezy, billing/better-auth and billing/manual.

import { … } from "@xtandard/entitlements/billing";
Name Summary
createBilling Bind billing providers to an engine. The returned EntitlementsBilling is what the panel’s POST /webhooks/:provider, /api/portal/checkout|manage and /api/customers/:id/reconcile routes call.
createUsageExporter Export usage from onUsage to provider.reportUsage, batched.
Name Summary
BillingApiError A provider REST call failed (non-2xx or unusable response). Carries the HTTP status.
Name Summary
BillingOptions Options for createBilling.
ProviderHttpOptions Options shared by every provider’s REST client.
UsageExporter What createUsageExporter returns.
UsageExporterOptions Options for createUsageExporter.
Name Summary
FetchLike A fetch-compatible function (injectable for tests).
UnmappedEvent Why BillingOptions.onUnmapped was called.
Name Documented on
BillingEvent @xtandard/entitlements
BillingProvider @xtandard/entitlements
BillingVerificationError @xtandard/entitlements
BillingWebhook @xtandard/entitlements
CheckoutInput @xtandard/entitlements
EntitlementsBilling @xtandard/entitlements
IntakeOutcome @xtandard/entitlements
PortalSessionInput @xtandard/entitlements
ProviderItem @xtandard/entitlements
ProviderSubscription @xtandard/entitlements
ReconcileResult @xtandard/entitlements
UsageRecord @xtandard/entitlements