pro, and three features, priority-support (Boolean), max-projects (Customizable), and ai-credits (Meter).
Code samples use the Node SDK on the server and the React SDK in the browser. The Python SDK has the same server methods, and the JavaScript SDK covers browsers without React.
Before you start
Get your API keys
Open Settings → API keys. The server key goes in your backend and must never ship to a browser. The client key goes in your frontend and only reads data.
Work in sandbox first
New accounts start in sandbox, where you can complete the whole flow with test cards. Sandbox and production keep separate keys, customers, and checkout links, so keep everything on this page in one environment:- Tell each SDK which environment to use:
environment: 'sandbox'on the Node client,environment="sandbox"on the React provider. - Copy checkout links from the dashboard while in sandbox mode. Sandbox links include
/sandbox/in the path.
1. Create a customer
Create a customer in Kelviq when someone signs up in your app, using your own user ID as thecustomerId. Every later call, from checkout to entitlement checks to usage reports, uses this same ID.
2. Checkout links
Every published product has a checkout link. You can use it as is, or add query parameters to choose the plan and attach a customer.Get a checkout link
- Go to Product catalog → Products and open your product
- Click Get Link to open the link builder
- Choose the plans to include and the default billing period
- Copy the generated URL
Attach the customer
A checkout link on its own does not know who is buying. To tie the purchase to the customer from step 1, addcustomer_id to the link. Use ? before the first parameter and & before each one after it.
customer_id, the link still works for emails, landing pages, and marketing campaigns. See Static checkout URL for every parameter, including success_url for the page to return to after payment.
Or create the checkout from your backend
When the customer is already logged in to your app, you can build the checkout on the server instead of in a link. The session carries the customer ID and the return URL, and nothing has to be assembled in the browser.After the purchase
When checkout completes, Kelviq creates the subscription and the customer’s entitlements are live right away. Your app can read them with the checks in the next step. If you also want the event in your own systems, such as sending a welcome email, subscribe tocheckout.completed and subscription.created through webhooks. Webhooks are optional.
3. Check feature access
Your app checks features, not plans. Movingpriority-support to a different plan is a dashboard change, not a deploy.
React: set up the provider
Wrap your app inKelviqProvider with the client key and the signed-in user’s customer ID. Every hook and component below reads from it.
KelviqProvider for the full list of props.
React: show or hide UI
React: read all entitlements
refreshAllEntitlements from the useKelviq hook so the new plan shows without a reload.
Node: enforce a limit on the server
Anything that must not be bypassed belongs on the server.max-projects is a Customizable feature: each plan stores its own limit in usageLimit. getEntitlement returns null when the customer does not have the feature, so treat that as no access.
client.entitlements.invalidateCache({ customerId }) there to drop the cache early.
4. Report usage (Meter features)
For Meter features such asai-credits, send usage events from your backend each time the customer consumes something. Kelviq counts them against the plan’s limit and resets the count each billing cycle.
DELTA adds value to the customer’s current usage. SET replaces current usage with value, for numbers you already count yourself, such as seats in use.
Next steps
- Pricing table and paywall components for a drop-in pricing page
- Customer portal so customers can manage their own subscription
- Webhooks for events in your own systems
Need help?
Have questions, need help with implementation, or want a walkthrough?Email us at hi@kelviq.com or book a demo.