Skip to main content
The React SDK has two browser-safe responsibilities:
  • read the public plan catalog with a publishable pk_ key; and
  • render checkout and billing UI using data or callbacks supplied by your application.
It does not accept a secret key, choose a Nozle customer, or call customer billing APIs directly.

Configure BillingProvider

Wrap billing UI in BillingProvider. Your createCheckout callback calls an authenticated merchant endpoint; that endpoint derives the customer from the logged-in user or team and calls Nozle with a restricted sk_.

Provider props

BillingProvider throws when publishableKey does not begin with pk_.

Implement the merchant endpoint

The merchant endpoint must:
  1. authenticate the application user;
  2. derive the Nozle customer from server-owned user or team data;
  3. reject browser-provided customer identifiers;
  4. validate the requested plan and exact HTTPS return origin; and
  5. call Nozle with a least-privilege sk_.
See Merchant backend billing for a complete route.

Framework notes

All interactive exports are client components. In Next.js App Router, render the provider and interactive SDK components from a file containing "use client". Customer billing status, invoices, subscriptions, cancellation, credits, usage, and entitlements must come from your authenticated backend. Pass that returned state into components such as FeatureGate, UsageMeter, and PlanBadge.
Never expose an sk_, master key, customer session, or internal credential in a browser bundle. CORS and Origin headers are not authentication.

Next steps