# 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
loaded
Function
This function will be called once the portal is loaded.
close
Function
This function will be called once the portal is closed by the end user.
visit
Function
This function will be called everytime a user visits a section in the customer portal.
Arguments - Hide
sectionType
String
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
id
String
subscriptionCustomFieldsChanged
Function
This function will be called whenever a subscription custom fields are changed
Arguments - Hide
data
Object Hide properties
subscription
Object Hide properties
id
String
subscriptionCancelled
Function
This function will be called when a subscription is canceled.
Arguments - Hide
data
Object Hide properties
subscription
Object Hide properties
id
String
subscriptionResumed
Function
This function will be called when a subscription is resumed.
Arguments - Hide
data
Object Hide properties
subscription
Object Hide properties
id
String
subscriptionPaused
Function
This function will be called when a subscription is paused.
Arguments - Hide
data
Object Hide properties
subscription
Object Hide properties
id
String
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
id
String
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
id
String
subscriptionReactivated
Function
This function will be called when a canceled subscription is reactivated.
Arguments - Hide
data
Object Hide properties
subscription
Object Hide properties
id
String
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();
// Set portal session from browser
cbInstance.setPortalSession(() => portalSession);
// Create chargebee portal 
const cbPortal = cbInstance.createChargebeePortal()
// Open portal
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
sectionType
String
params
Object Hide properties
subscriptionId
String Required if the sectionType involves a subscription
callbacks
Object Hide properties
loaded
Function
This function will be called once the portal is loaded.
close
Function
This function will be called once the portal is closed by the end user.
visit
Function
This function will be called everytime an user visits a section in the customer portal.
Arguments - Hide
sectionType
String
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
id
String
subscriptionCustomFieldsChanged
Function
This function will be called whenever a subscription custom fields are changed.
Arguments - Hide
data
Object Hide properties
subscription
Object Hide properties
id
String
subscriptionCancelled
Function
This function will be called when a subscription is canceled.
Arguments - Hide
data
Object Hide properties
subscription
Object Hide properties
id
String
subscriptionResumed
Function
This function will be called when a subscription is resumed.
Arguments - Hide
data
Object Hide properties
subscription
Object Hide properties
id
String
subscriptionPaused
Function
This function will be called when a subscription is paused.
Arguments - Hide
data
Object Hide properties
subscription
Object Hide properties
id
String
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
id
String
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
id
String
subscriptionReactivated
Function
This function will be called when a canceled subscription is reactivated.
Arguments - Hide
data
Object Hide properties
subscription
Object Hide properties
id
String

# Example

const cbInstance = Chargebee.getInstance();
const cbPortalInstance = cbInstance.createChargebeePortal();
cbPortalInstance.openSection({
  sectionType: Chargebee.getPortalSections().ACCOUNT_DETAILS
}
1
2
3
4
5