- A Free plan that gives users 5 chat messages per month for free
- A Pro plan that gives users 100 chat messages per month for $20 per month.
Autumn provides React hooks and components for an easier developer
experience. If you’re not using Typescript, have an unsupported framework or
just prefer a backend-only setup for full control, use this guide.
1. Create your products
Create a product for each plan that your app offers. In our example we’ll create a “Free” and “Pro” product.Run the following command in your root directory:This will prompt you to login or create an account, and create an Then, push your changes to Autumn’s sandbox environment.
autumn.config.ts
file. Paste in the code below, or view our config schema to build your own.autumn.config.ts
If you already have products created in the dashboard, run
npx atmn pull
to
pull them into your local config.2. Stripe Payments
Checkout
Call thecheckout
function to get Stripe checkout page when the customer wants to purchase the Pro plan, and pass it to your frontend. Once they’ve paid, Autumn will grant them access to the features we defined.
If their payment details are already on file, checkout data (eg, prices) will be returned instead to be displayed to the customer. This lets them confirm their upgrade, downgrade or new purchase.
Make sure you’ve pasted in your Stripe test secret
key
sk_test_...
in the Autumn
dashboard.Attach
If the payment details are on file and the customer is ready to make the payment, use theattach
function to enable the product (and charge the customer if applicable).
3. Build Pricing Logic
There are 3 key functions you need to handle the billing logic once the customer has purchased the Pro plan:check
for feature access to see if the customer is allowed to send a message.track
a usage event in Autumncustomer
to fetch subscription and usage data.
check
function makes an API call to Autumn’s DB to fetch the latest information.
- Add Stripe’s billing portal
- Handle failed payments