- 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’s client-side hooks are supported for
fullstack TypeScript apps. Please use the Server SDK for other frameworks.
1
Create your pricing plans
Create a plan for each pricing tier that your app offers. In our example we’ll create a “Free” and “Pro” plan, and assign them features.- CLI
- Dashboard
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
2
Installation
Create an Autumn Secret key, and paste it in your.env variables. Then, install the Autumn SDK. If you’re using the CLI, this will be done for you..env
If you’re using a separate backend and frontend, make sure to install the
library in both.
3
Add Endpoints Server-side
Server-side, mount the Autumn handler. This will create endpoints in the/api/autumn/* path, which will be called by Autumn’s frontend React hooks. These endpoints in turn call Autumn’s API.The handler takes in an identify function where you should pass in the user ID or organization ID from your auth provider.Autumn’s customer ID is the same as your internal user or org ID generated
from your auth provider. No need to store any extra IDs.
4
5
Create an Autumn customer
From a frontend component, use theuseCustomer() hook. This will automatically create an Autumn customer if they’re a new user and enable the Free plan for them, or get the customer’s state for existing users.React
6
Stripe Payment Flow
Callattach when the customer wants to purchase the Pro plan. This will return a Stripe payment URL. Once they’ve paid, Autumn will grant access to “100 messages per month” defined in Step 1.Use Stripe’s test card
4242 4242 4242 4242 to make a purchase in sandbox.
You can enter any Expiry and CVV.React
The
redirectMode: "always" flag will always return a payment URL.New purchases redirect to Stripe Checkout to enter payment details, and subsequent charges redirect to an Autumn hosted, one-click confirmation page.You can build your own billing confirmation flows by using the previewAttach function.Track and limit usage
Enforce usage limits and feature permissions using Autumn’s
check and
track functions


