Autumn with TypeScript
Implement pricing & billing with React and Node.js
Create your Autumn account and let’s create a the pricing for a premium AI chatbot.
We’re going to charge users $20 per month for 10 messages.
1. Create the product
Create a product in the Products tab.
2. Install autumn-js
3. Integrate Autumn
From our application’s frontend, whenever a customer wants to send a chatbot messages, we’ll first check if they’re allowed to.
If they are, we’ll send a usage event to Autumn. Autumn will then update the customer’s usage and remaining balance.
When they click the “Upgrade to Pro” button, they’ll be redirected to a Stripe checkout page to subscribe.
You can use a Publishable Key when making attach
and entitled
requests from the frontend. To handle product upgrades and downgrades however, you’ll need to use a Secret Key from the backend.
Autumn will automatically create a customer if the customer ID is new.
Make sure you’ve pasted in your Stripe test secret
key sk_test_...
in the Autumn
dashboard.