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 APIsTo start with,

  1. Create your base plans with price set as $0 (or whatever the base fee that you would charge your customer as minimum amount)

  2. Create non-recurring quantity based addons to handle credit packages

  3. 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

  4. After user selects the plan in your website, you can show them a dropdown containing the addons, so that the customer could select how many packs of credits they want to purchase. You can include a custom Javascript within the form that would ensure they select an addon before checking out.

  5. Once the user clicks Checkout, pass the selected addon along with the plan specific hosted page URL.

  6. On successful payment, you’ll receive a Payment Succeeded webhook which would also help you with the addon quantity.

  7. Activate their subscription to your application accordingly and track their credit balance in your end

  8. When their credit balance is running low, you can show them a popup within your application asking them to replenish their credit balance.

  9. 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.

  10. 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.

  11. 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.

  12. 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.

  13. 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.