Plans
billing.plans(). For a complete pricing page, use <PricingTable>.
Checkout
openCheckout() redirects the browser; createCheckout() returns the URL instead. Both take the buyer’s prepaid choices as a second argument, [{ feature_key, steps }].
Checkout redirects to the payment provider’s page. For an embedded card form, use the server’s embedded card checkout.
Subscription
isActive is true for ACTIVE and TRIALING. Pass a product slug to useSubscription() if your project has several products.
Change plan and cancel
{ prorationBehavior: 'none' } as a third argument. Call refetch() after either one: useSubscription() doesn’t update on its own.
Plan picker
usePlanSwitch() starts a checkout for someone without a subscription and changes the plan of someone who has one, so a subscriber never ends up with two. <PricingTable> uses it.
selectPlan() goes straight to checkout. With one, it sets pending and waits for confirmSwitch(). It also returns switchError, checkoutError and checkoutPriceId, the price being redirected to.
Billing portal
openPortal() redirects; createPortal() returns the URL.
