@crxbase/payments/react. The root @crxbase/payments import remains available for framework-independent code such as a background script.
Set up the provider
Wrap your popup, options page, or other React interface withCrxbaseProvider:
projectId changes, the provider loads the user for the new project.
Access the client
useCrxbase gives you access to the project client. Use it to retrieve tiers or open crxbase pages:
await useCrxbase().getTiers() to retrieve your tiers and prices.
Read user state
useUser returns the shared current-user state:
Use
useCrxbase and useUser only inside CrxbaseProvider.
Render by user state
Show displays its children when when matches the user’s current state. It supports signed-in, signed-out, and paid, with an optional fallback:
render instead of children. For signed-in and paid, the function receives the signed-in user and TypeScript knows the user exists:
render, not both. render is available only for signed-in and paid because signed-out users do not have a user object. Nesting lets you show different messages to signed-out and signed-in unpaid users. While the user’s status is loading or unavailable, Show displays neither its content nor fallback. Use useUser if you want to display a loading or error state.

