# Retrieve Subscription Change Timeline

The function, fetchChangeSubscriptionOptions can be invoked to get the change subscriptions options like, end-of-term when a customer is changing his subscription.

# Usage and invocation

You can implement your business logic on cases of subscription change that need to happen immediately and at the end of term, and finally return a value for each scenario.

  • If the changes need to take effect immediately, end-of-term should be set to false.
  • If the changes need to take effect at the term end, end-of-term should be set to true.

Let's take an example. For downgrades, you can choose to make the change during the end of the term. Whereas for upgrades, you can choose to make the change immediately.

# 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

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

# Sample code

  • js

# Sample Output

  • json

# Expected JSON schema for the output

  • json