Skip to main content
The current React SDK exports two data hooks: 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.
If checkout returns a hosted URL, the hook navigates to it and returns 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.
Use this only when building a custom catalog or checkout component. Prefer 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:
Prefer 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 }.
Stripe webhooks remain authoritative. A browser redirect or completion callback does not activate a paid plan by itself.