Skip to main content
Our React hooks make it a lot easier to evaluate feature access and usage on the frontend. Since PriceOS can only be safely used on the backend, using these hooks still requires server-side setup, but we’ve created helpers to make this really easy for you.
Make sure your API key is only used server side. It should never be used client side.
Be sure to read Linking Stripe Customers to learn how to link Stripe customers to your own internal ID.
1

Install

Create an API key in the PriceOS dashboard and add to your environment variables.
.env
2

Add server side handlers

If you need to include an auth token from the client, you can do so on the Provider.
3

Add provider component

For full Provider configuration details, see PriceOSProvider.
4

Generate types (optional, but highly recommended)

This will generate a local types file that you can include so all of your features are fully typed.Run with --help to see more configuration options.
Remember to regenerate types any time you create a new feature.
5

Read feature access

6

Track usage (optional)

Only if you’re using PriceOS to track your customers’ usage for limit features.
If the action happens on your backend (for example in a server action, webhook, or background job), it usually makes more sense to track usage on the backend instead.
useTrackUsage with the built-in Next.js handlers (priceos/next) only accepts positive amount values (so that clients can’t reverse their usage). For negative adjustments (for example when removing a team seat), track usage from your backend via the Node.js SDK or REST API endpoints.
For more info see Tracking usage.