# Retrieve Allowed Plans and Addons

Using the function, fetchAllowedPlanConfig, following functionalities can be performed:

  • Specify Allowed addons.

  • Specify allowed addons for a particular plan.

  • Specify addons to be automatically attached to a plan when selected.

  • Specify quantity meta for a plan/addon.

# Usage and invocation

This function will be invoked to get the list of plans and addons combination for a particular subscription. Only the plans and addons present in the list will be shown to the customer while changing the subscription. You can write your business specific logic in this function to restrict the plan list and addon list for your customers.

Let's take an example. For users on the Platinum plan you can provide the plan items and addon items from a premium group to choose from during upgrade. Whereas for users on the Gold plan, you can provide the plan items and addon items from a basic group to choose from, during downgrade.

# Instructions for writing the function

  • It should be written in javascript.
  • It should be executable in Node.js v6.0 environment.
  • Some default resources are passed to this function by Chargebee. You can use these resources to write your business logic. The resource formats are similar to the resource output generated from the Node.js client library.
  • You can also use Chargebee’s Node.js client library (if already configured with API key and secret key) for retrieving and using additional resources.
  • Return a JavaScript object that matches the JSON schema given below.

# Parameters

User's existing subscription details.
Parameters for customer.
Details of current plan and addon price points.
Object View properties
Callback that can be passed during the payment process. Usage is limited based on value returned from the redirected page.
Used to log debugging information only while testing (function should be in draft mode) using the Chargebee test site.

# Output parameters

You can use these additional parameters to pass data to Chargebee. It is then displayed on portal for the user to access.

  • use_existing_addons : Set true to carryover addon items from the current subscription to the changed subscription.

  • allowed_addons : List of applicable addon items for the plan item.

  • addons : List of addons items to be auto-attached when a customer moves from one plan item to another.

  • meta_data : This supplies data for the quantity drop-down associated with a plan item or addon item.

# Sample Code

  • js

# Sample Output

  • json

# Expected JSON schema for the output

  • json


If you are still using Product Catalog 1.0 (opens new window), click here to learn more about retrive allowed plans and addons.