Example
An AI writing tool offers a Pro plan at $20/month that grants 1,000 messages per month. When the billing period resets, the customer’s message balance is reset back to 1,000.
Setting up
- CLI
- Dashboard
Define a recurring plan in your Push changes with
autumn.config.ts:autumn.config.ts
atmn push.Attaching a subscription
Use billing.attach to attach a subscription to a customer. WithredirectMode: "always", a checkout URL is always returned for the customer to complete payment or confirm the plan change.
- Creates a Stripe subscription with the plan’s prices
- Grants the customer their included balances for each consumable feature
- Starts the billing cycle — balances reset automatically at the start of each period
Billing intervals
Plans support the following billing intervals:
You can create a separate plan for each interval you want to support. For example, if you want to support monthly and annual plans, you can create a
pro_monthly plan and a pro_annual plan.
You can also configure a custom interval_count to charge at non-standard intervals (e.g., every 2 months).
Billing interval vs reset interval
The billing interval (how often the customer is charged) and the reset interval (how often their feature balance replenishes) are configured independently. They don’t have to match.ExampleThis is useful when you want to offer an annual discount while still metering usage on a shorter cycle.
A plan billed at $200/year could grant 100 messages/month. The customer pays once a year, but their message balance resets to 100 every month.
Managing subscriptions
Once a customer has an active subscription, you can manage upgrades, downgrades, and cancellations. See Managing Subscriptions for details on:- Upgrades — prorated charges for switching to a higher-priced plan
- Downgrades — scheduled at end of billing period
- Cancellations — immediate or end-of-period