Implement your app’s payments and pricing model in under 5 minutes
autumn.config.ts
file in your root directory and prompt you to login / create an account. Add the following code to your autumn.config.ts
file.npx atmn pull
to
pull them into your local config.autumn-js
.env
file.
/api/autumn/*
path, which will be called by Autumn’s frontend React library. These routes in turn call Autumn’s API.
The handler takes in an identify
function that should return a customerId
. This is typically your internal user ID or organization ID from your auth provider.
<AutumnProvider>
component, and pass in your backend URL. This lets Autumn know how to reach the backend handler you mounted in the previous step.
The Provider component can also take in a
getBearerTokenfunction, which should be used for auth frameworks with separate backend and frontend, eg using Clerk with Express. This will pass in the
Authorizationheader from the request to the backend, which can be used in the
autumnHandler` identify function.checkout
to redirect the customer to a Stripe checkout page when they want to purchase the Pro plan. Once they’ve paid, Autumn will grant them access to the features we defined.
If their payment method is already on file, CheckoutDialog
will open instead to let the customer confirm their new subscription or purchase, then handle the payment.
Alternatively, use our PricingTable component to show a pricing table that handles the checkout for you.
sk_test_...
in the Autumn
dashboard.check
for feature access to see if the customer is allowed to send a message.track
a usage event in Autumn (typically done server-side)customer
to display usage data in the UI.