Skip to content

@xtandard/entitlements/billing/better-auth

better-auth’s Stripe plugin as a billing source: subscription callbacks that feed entitlements plus plans generated from the catalog.

import { … } from "@xtandard/entitlements/billing/better-auth";
Name Summary
betterAuthStripe Callbacks + plans for @better-auth/stripe’s subscription option. Pass the engine (a billing intake with a webhook-less stripe provider is created for you) or an existing EntitlementsBilling (then pass catalog to get plans).
toBetterAuthPlans Generate the plugin’s plans from the catalog: one per plan (current version) that has a Stripe price id — name is the plan key, priceId the first mapped price, limits the plan’s features, freeTrial the plan’s trial and group its group (omitted for "base").
Name Summary
BetterAuthPlansOptions Options for toBetterAuthPlans.
BetterAuthStripeCallbackData What the plugin passes to its subscription callbacks.
BetterAuthStripeOptions Options for betterAuthStripe.
BetterAuthStripePlan A plugin plan (structural subset of @better-auth/stripe’s StripePlan).
BetterAuthStripeSubscription The plugin’s Subscription row (structural subset of @better-auth/stripe’s type).
BetterAuthStripeSubscriptionOptions The plugin subscription option fragment returned by betterAuthStripe.