Portal Object
Chargebee portal instance object is used to fulfil portal related actions.
Use createChargebeePortal
to create a portal instance object.
open
This function is used to open Chargebee’s self-serve portal.
Syntax
cbPortalInstance.open(options, forwardOptions)
1
Parameters
options
Object Hide properties This function will be called once the portal is loaded.
This function will be called once the portal is closed by the end user.
This function will be called everytime a user visits a section in the customer portal.
paymentSourceAdd
Function This function will be called whenever a new payment source is added in portal.
paymentSourceUpdate
Function This function will be called whenever a payment source is updated in portal.
paymentSourceRemove
Function This function will be called whenever a payment source is removed from portal.
subscriptionChanged
Function This function will be called whenever a subscription is changed.
Arguments -
Hide data
Object Hide properties subscription
Object Hide properties subscriptionCustomFieldsChanged
Function This function will be called whenever a subscription custom fields are changed
Arguments -
Hide data
Object Hide properties subscription
Object Hide properties subscriptionCancelled
Function This function will be called when a subscription is canceled.
Arguments -
Hide data
Object Hide properties subscription
Object Hide properties subscriptionResumed
Function This function will be called when a subscription is resumed.
Arguments -
Hide data
Object Hide properties subscription
Object Hide properties subscriptionPaused
Function This function will be called when a subscription is paused.
Arguments -
Hide data
Object Hide properties subscription
Object Hide properties scheduledPauseRemoved
Function This function will be called when a subscription that is scheduled for pause is removed.
Arguments -
Hide data
Object Hide properties subscription
Object Hide properties scheduledCancellationRemoved
Function This function will be called when the schedule to cancel a subscription is removed.
Arguments -
Hide data
Object Hide properties subscription
Object Hide properties subscriptionReactivated
Function This function will be called when a canceled subscription is reactivated.
Arguments -
Hide data
Object Hide properties subscription
Object Hide properties forwardOptions
Object Hide properties sectionType
String Required
Allowed Values:
All values present in Chargebee.getPortalSections()
params
Object Hide properties subscriptionId
String Required if the sectionType involves a subscription related action paymentSourceId
String Required if the sectionType involves a payment source related action Example
const cbInstance = Chargebee.getInstance();
cbInstance.setPortalSession(() => portalSession);
const cbPortal = cbInstance.createChargebeePortal()
cbPortal.open();
1
2
3
4
5
6
7
openSection
Use this method if you want to open a particular section as a separate card, instead of opening the entire customer portal.
Only the below section types can be opened as a separate card:
- SUBSCRIPTION_DETAILS
- ACCOUNT_DETAILS
- ADDRESS
- PAYMENT_SOURCES
- BILLING_HISTORY
Syntax
cbPortalInstance.openSection(options, callbacks)
1
Parameters
options
Object Hide properties params
Object Hide properties subscriptionId
String Required if the sectionType involves a subscription callbacks
Object Hide properties This function will be called once the portal is loaded.
This function will be called once the portal is closed by the end user.
This function will be called everytime an user visits a section in the customer portal.
paymentSourceAdd
Function This function will be called whenever a new payment source is added in portal.
paymentSourceUpdate
Function This function will be called whenever a payment source is updated in portal.
paymentSourceRemove
Function This function will be called whenever a payment source is removed from portal.
subscriptionChanged
Function This function will be called whenever a subscription is changed.
Arguments -
Hide data
Object Hide properties subscription
Object Hide properties subscriptionCustomFieldsChanged
Function This function will be called whenever a subscription custom fields are changed.
Arguments -
Hide data
Object Hide properties subscription
Object Hide properties subscriptionCancelled
Function This function will be called when a subscription is canceled.
Arguments -
Hide data
Object Hide properties subscription
Object Hide properties subscriptionResumed
Function This function will be called when a subscription is resumed.
Arguments -
Hide data
Object Hide properties subscription
Object Hide properties subscriptionPaused
Function This function will be called when a subscription is paused.
Arguments -
Hide data
Object Hide properties subscription
Object Hide properties scheduledPauseRemoved
Function This function will be called when a subscription that is scheduled for pause is removed.
Arguments -
Hide data
Object Hide properties subscription
Object Hide properties scheduledCancellationRemoved
Function This function will be called when the schedule to cancel a subscription is removed.
Arguments -
Hide data
Object Hide properties subscription
Object Hide properties subscriptionReactivated
Function This function will be called when a canceled subscription is reactivated.
Arguments -
Hide data
Object Hide properties subscription
Object Hide properties Example
const cbInstance = Chargebee.getInstance();
const cbPortalInstance = cbInstance.createChargebeePortal();
cbPortalInstance.openSection({
sectionType: Chargebee.getPortalSections().ACCOUNT_DETAILS
}
1
2
3
4
5