You can record a customer’s usage and bill for it at the end of a subscription period by using Metered Billing.
Metered billing is useful in cases where you want to charge your customers a granular amount based on their consumption of your service during the billing cycle, instead of explicitly setting quantities. For example, if you are running an email SaaS business, you can track your customers’ API calls, then bill them for the total number used at the end of each month.
Usage Based Billing with Subscriptions (Stripe Docs)