Billing
Checkout
Stripe embedded checkout flow
Nozle uses Stripe's embedded checkout for payment collection. The flow:
- Customer selects a plan (PricingTable or CheckoutButton component)
- React SDK calls POST /api/v1/checkout with
{ customer_id, plan_code, success_url } - Nozle API creates a Stripe Checkout Session in "setup" mode
- Returns
{ client_secret, invoice_id, amount_cents, currency } - The Checkout component renders Stripe Elements using the client_secret
- Customer enters payment details
- On success, Stripe sends checkout.session.completed webhook to /webhooks/stripe
- Nozle API processes the webhook: creates subscription, provisions entitlements
React implementation
Option A -- CheckoutButton (simplest)
<CheckoutButton planId="growth" label="Subscribe to Growth" />Option B -- Custom flow with useCheckout
const { fetchClientSecret, isLoading } = useCheckout();
const handleCheckout = async () => {
const clientSecret = await fetchClientSecret('growth', '/success');
// Use clientSecret with Stripe Elements
};Option C -- Full Stripe Elements
<Checkout
clientSecret={secret}
publishableKey="pk_live_..."
submitLabel="Subscribe"
onSuccess={(paymentIntentId) => router.push('/welcome')}
/>Server-side (bypass checkout UI)
For B2B scenarios where payment is already on file:
const result = await nozle.subscribe('customer_123', 'growth');
// { subscription_id: 'sub_...', status: 'active' }Note: subscribe() requires a secret key (sk_).