Your business model might require you to setup prepaid credit packs that your customers can then buy and use within your application.
In such cases, you would typically want to,
Setup a way for them to select initial credit package and purchase it
Offer them a way to replenish their credits or choose a different credit pack on an ongoing basis
Offer them a way to choose not to top up with more credits
A scenario like this is possible in Chargebee using our APIs. To start with,
Create your base plans with price set as $0 (or whatever the base fee that you would charge your customer as minimum amount)
Create non-recurring quantity based addons to handle credit packages
List your addon packages in your website, along with an option to choose quantity. You can also have a flat-fee based subscription plan and a credit based plan. In this case, you can create multiple plans in Chargebee and list them along with addons
Once the user clicks Checkout, pass the selected addon along with the plan specific hosted page URL.
On successful payment, you’ll receive a Payment Succeeded webhook which would also help you with the addon quantity.
Activate their subscription to your application accordingly and track their credit balance in your end
When their credit balance is running low, you can show them a popup within your application asking them to replenish their credit balance.
If they select Yes, you can call the Create Invoice for Addon API to include the addon they selected at the time of subscriptions and charge them immediately.
You can also use Charge Addon at Term End API to schedule the charge to be charged at the time of their renewal, instead of an immediate charge.
If they select No, you can call the Cancel Subscription API with end_of_term parameter as true to schedule the subscription for cancellation at term end.
You can also offer another option (ex: "Change"), on clicking which, they could be shown the list of addons again and select the number of credits they want to purchase.
You can then trigger the API call immediately as explained earlier to charge them for the credit pack and get the changed details via webhooks and update your records accordingly.
As these are API driven, you can hide the logic from users and present them with a seamless checkout and top-up experience.