usePlans and useCheckoutSession. Customer-specific hooks such as useCan, useUsage, and usePlan are intentionally not browser exports; retrieve that state from your authenticated backend.
usePlans
Fetches GET /api/v1/plans through the BillingProvider catalog client.
Return value
CatalogPlan contains code, name, amount_cents, amount_currency, and interval.
useCheckoutSession
Calls BillingProvider.createCheckout with a plan code and return URL.
null. It returns a string only for an embedded Stripe client secret. Completed and scheduled results are available through checkout.
Return value
useBillingContext
Returns the required billing context and throws outside BillingProvider.
usePlans and useCheckoutSession for common flows.
useOptionalBillingContext
Returns the billing context or null outside a provider. PricingTable uses this behavior so caller-supplied plans can render without a catalog provider.
useNozleClient
Returns the browser-safe NozleClient:
catalogFetch is for public catalog endpoints only. Do not use it to proxy customer billing requests.
BillingContext
BillingContext is exported for advanced integrations that need React’s direct context API. Its value is either null or:
useBillingContext or useOptionalBillingContext in application components so missing-provider behavior stays explicit.
Checkout result types
createCheckout may resolve to:
- Stripe hosted checkout:
{ type: 'stripe', url }; - embedded Stripe:
{ type: 'stripe', clientSecret }; - Razorpay:
{ type: 'razorpay', orderId }; - immediate completion:
{ type: 'completed', ... }; - scheduled change:
{ type: 'scheduled', ... }; or - legacy hosted checkout:
{ url }.