ExperienceWidget, then shows where to switch to useExperienceJourney when you need custom UI.
Prerequisites
- Node.js 18 or later.
- A Fanfare
organizationId. - A browser-safe Fanfare
publishableKey. - An experience ID such as
exp_123.
Step 1: Install The React SDK
Step 2: Add The Provider
Wrap the part of your app that uses Fanfare:Step 3: Render The Experience
ExperienceWidget renders the supported journey UI for the current customer state.
checkoutUrl when the default granted state can navigate directly to your next step.
Step 4: Add A Server Handoff
When your app needs to prepare checkout, useonGranted. Keep the grant out of URLs, console logs, and third-party analytics.
Step 5: Customize Specific States
Use slots when the default widget works but one state needs custom markup.Step 6: Move To Custom React UI When Needed
UseuseExperienceJourney when you want React lifecycle handling but fully custom screens.
What Happens Behind The Scenes
FanfareProviderinitializes the SDK with your browser-safe credentials.- The widget or hook gets a journey for the experience ID.
- The journey resolves the customer’s public state.
- Your UI renders ready, routing, gated, routed, granted, ended, or unavailable states.
- When granted, your app sends the grant to the next trusted step.
Test Locally
- Use a test experience and test publishable key.
- Visit the page in a clean browser profile.
- Confirm the widget renders a public state.
- Confirm admitted-state handling sends the grant only to your own app or backend.
- Repeat with an existing browser session.