New in Chargebee: Explore Reveal and understand your payment performance end-to-end.

Operations that can be performed using Custom Code

Problem Statement

This article describes what you can do with Chargebee’s Custom Code feature, including subscription changes and restricting addons by plan.

  • What actions can be performed using custom code?
  • How to restrict specific addons on selected plans?

Solution

Custom Code is a Chargebee feature that lets you run logic that is not available through the API alone. Examples:

  • Subscription changes: Control whether a subscription change is applied immediately or at the end of the term using fetchChangeSubscriptionOptions.
  • Addon and plan configuration: Use fetchAllowedPlanConfig to:
    • Specify allowed addons
    • Specify allowed addons for a particular plan
    • Auto-attach addons to a plan when selected
    • Specify quantity meta for a plan or addon

You cannot restrict addon downgrade or remove the quantity decrease ("-") button on the portal via this config.