# 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 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.
# Output parameters
You can use these additional parameters to pass data to Chargebee. It is then displayed on portal for the user to access.
trueto 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
# Sample Output
# Expected JSON schema for the output