Billing Flows
Using Autumn to manage billing flows like upgrading, cancelling, paywalls and more
Autumn handles your billing flows, so you don’t need to build and maintain user flows like:
- Purchasing a product
- Inputting quantities for prepaid products
- Upgrading, downgrading, cancelling or renewing a product’s subscription
- Paywalling features
- Failed payments [coming soon]
You can use our customizable shadcn/ui components to handle these out-of-the-box, or use our React hooks and SDK to roll your own.
Product Change
The product change dialog will open when a customer wants to change their active product, such as when they upgrade or downgrade, to let them preview how much will be charged, and confirm the change.
Install
This will download the product-change-dialog component in your /components
directory, under a /autumn
folder.
You can swap clean
for classic
or dev
to use a different style that suits your brand. View them all at pricecn.com.
Usage
Pass in the product-change-dialog
component to the AutumnProvider
component. This allows Autumn to automatically open the product change dialog when they want to change their active product.
Now when you use the attach()
hook, Autumn will first call the check({withPreview: true})
function to preview the purchase. The product change dialog will open if:
- The customer needs to input a quantity for their purchase (ie, if the product has prepaid prices)
- If the customer’s payment method is already on file (ie, for upgrades, downgrades or add-ons).
When the customer confirms the purchase, Autumn will attach the product to the customer.
If there are no inputs required and it’s a new customer (without an existing payment method), the customer will be redirected straight to the Stripe checkout page.
Scenarios
The check({withPreview: true})
call can return a preview
object that contains a scenario
enum, which is used to control the dialog’s contents. It can be one of the following:
Scenario | Description |
---|---|
upgrade | The customer is upgrading their product |
downgrade | The customer is downgrading to another paid tier |
cancel | The customer is downgrading to a free product |
renew | The customer is reactivating a product that was previously cancelled |
scheduled | The product is already scheduled to start at a future date (eg, for downgrades), so no changes are needed |
active | The customer already has the product active, so no changes are needed |
When you install product-change-dialog
, a /lib/autumn/get-product-change-texts.tsx
file is also installed. This file contains the dialog texts for each scenario, which you can customize how you want.
Paywall
A paywall that prompts users to upgrade to the next tier when they hit a usage limit, or don’t have access to a feature.
Install
This will download the pricing-dialog
component in your /components
directory, under a /autumn
folder.
You can swap clean
for classic
or dev
in the installation URL to use a different style that suits your brand. View them all at pricecn.com.
Usage
Pass in the paywall-dialog
component to the check
function (exported from the useAutumn
hook).
Now when you use the check()
function, Autumn will automatically pass in the withPreview: true
parameter. If data.allowed: false
is returned for the feature, the paywall will open with the following details:
- The feature they don’t have access to, or have run out of
- The next product tier they should upgrade to, in order to access the feature (or an add-on if no additional tier exists)
- A button that lets them purchase the next tier or add-on
Scenarios
The check({withPreview: true})
call can return a preview
object that contains a scenario
enum, which is used to control the dialog’s contents. It can be one of the following:
Scenario | Description |
---|---|
usage_limit | The customer has hit a usage limit for the feature |
feature_flag | The customer doesn’t have access to the feature |
The preview
object also contains a products
array, which contains the products that the customer can purchase to access the feature.
When the pricing-dialog
component is installed, a /lib/autumn/get-paywall-texts.tsx
file is also installed. This file contains the dialog texts for each scenario (depending on the available products), which you can customize how you want.
Pricing Table
The pricing table component displays your available products, the features available in each and any prices. It synchronizes with the products you define in Autumn.
Install
This will download the product-change-dialog component in your /components
directory, under a /autumn
folder.
You can swap clean
for classic
or dev
to use a different style that suits your brand. View them all at pricecn.com.