Display usage and billing data in your app for your users
Software applications typically ship with a billing page. This allows customers to change plan, cancel subscription and view their usage.The customer endpoint will return the current state of the customer, including their active plans, feature usage and remaining balances.
Display the plan the user is currently on. You can also display price information and features granted with that plan.As users can have multiple active plans (eg, add ons), this is an array.
The Stripe billing portal is a convenient way to allow users to manage their payment method, see past invoices and also cancel their current plan. You can also set up “churn offers” to encourage users to stay with you.
To use the Stripe billing portal, you’ll need to enable it in your Stripe settings.
Autumn replicates your usage data to Clickhouse, so you can retrieve aggregate time series usage data for your customers. The response can be passed into a charting library like Recharts to display a usage history graph.
Copy
Ask AI
import { useAnalytics } from "autumn-js/react";const { list } = useAggregateEvents({ featureId: 'messages', range: '30d'})