Docs
Growth
Once you've configured pricing tables, in-app offers, or cancel pages, and their associated Plays in Chargebee Growth, you must integrate Chargebee Growth with your website or application to enable them to be displayed to your customers.
The setup includes integrating Chargebee.js on the frontend and, if needed, one of the Chargebee REST API SDKs on the backend. The following table summarizes the type of technical integration required based on your use case.
| Feature | Use Case | Integration Type |
|---|---|---|
| Pricing Table | Display a specific Chargebee-hosted pricing table to new customers. | Chargebee.js (low code) |
| Display a specific Chargebee-hosted pricing table for new or existing customers. | Chargebee.js + Chargebee APIs | |
| Use Plays to display a Chargebee-hosted pricing table dynamically based on customer context. | Chargebee.js + Chargebee APIs | |
| In-app Offers | Use Plays to display Chargebee-hosted in-app offers to existing customers. | Chargebee.js (low code) |
| Use Plays to display in-app offers with fully customized UX to existing customers. | Chargebee APIs | |
| Cancel Pages | Use Plays to display full-page Chargebee-hosted cancel pages. | Chargebee.js (low code) • Chargebee APIs |
Chargebee.js provides you with a single frontend integration for all Chargebee-hosted features such as Cancel Page, Pricing Table, In-app Offers, and more.
In the next sections, we'll elaborate on the use cases summarized in the table above.
You can embed a specific pricing table in your website or application using Chargebee.js. This is the simplest, low-code approach for displaying a pricing table on your website or application.
See the Pricing Table Quickstart to do this.
If you want to select the pricing table to be displayed based on the customer's session, you must select the pricing table using Chargebee APIs and use Chargebee.js to render it on your application.
See this tutorial to display specific pricing tables based on user sessions.
For existing customers, you can also let Chargebee select the pricing table to be displayed based on customer context. You can do this by configuring pricing table plays. Plays help you setup targeting and deploy price experiments.
Follow this tutorial to render pricing tables using Chargebee Growth plays.
The simplest solution is to show pre-built Chargebee-hosted in-app offers to your customers. This low-code solution lets you customize the offer experience in Chargebee Growth. Offers are shown automatically to users when trigger conditions are met. Offer views and dismissals by users are tracked automatically.
See the In-App Offers integration guide to set this up.
For complete control over offer delivery and retention experiences, use the Chargebee Offers REST APIs:
Install the Chargebee client library for the appropriate language in your development environment to use these APIs.
You can display cancel pages as full-page experiences to which you redirect customers to, or you can render them in an iframe in your website or application. There are two approaches for this:
Use Chargebee.js to launch cancel pages directly in your website or application UI. For more information, see the Cancel Page Quickstart.
Use Chargebee REST APIs to create cancel pages and embed them in your website or application. For more information, see this API guide.
⚠️ Deprecated
This section provides the steps to integrate Retention.js, the older version of the Growth Solutions JS SDK. However, note that Retention.js is deprecated and does not receive any new updates. You should migrate to one of the above-mentioned Chargebee.js integrations as soon as possible.
To ensure that Chargebee Growth is initialized correctly, you must embed a JavaScript snippet within your website or application such that it is automatically initialised on page load. Next, you need to create a new Growth instance by passing the application ID of your Chargebee Growth application.
To embed the script on your application or site:
https://app.chargebee.com/retention/kav8jMaojO, then kav8jMaojO is the App ID.<script>
(function ())
const cbretention = new ChargebeeRetention({
api_key: <YOUR_APP_ID>
});
</script>
This step enables Chargebee Growth to identify users, sync subscription data, and direct them to the appropriate offer within Growth solution.
Once the Chargebee Growth instance is created, you need to initialize the offer rendering solution by calling the init() function and passing user-specific details such as customer ID and email address to identify the logged-in user or customer.
To initialize the solution:
Add the following snippet, replacing the placeholders with actual user data:
(function () {
const cbretention = new ChargebeeRetention({
api_key: kav8jMaojO
});
cbretention.init({
customer_id: "5634354", // Customer ID within the integrated billing site
user: {
email: "jdoe@fantasyworld.com", // Your end user's email address
roles: ["engineer", "admin"], // End user's roles
},
});
})();
Your Chargebee Growth instance is now initialized and is ready to process user interactions. If you are using Growth solution alone, this step has you covered.
To use Growth solution along with Chargebee Retention, and to address churn and automate successful retention campaigns, you need to initialize the cancel flows as well and additionally embed the cancel button on your web page. If you have embedded the Chargebee Retention.js snippet on your site or app already, you can proceed to configure a cancel button within your Growth solution to enable a seamless cancellation experience.
To set up cancel flows:
Apply the id="bb-cancel" selector to the button or link users will click to initiate cancellation.
For example: <button id="bb-cancel" href="">Cancel Subscription</button>.
Chargebee Growth will automatically detect this button and direct users to their personalized cancel experience.
If the JavaScript cannot process the request, the button will default to the href URL assigned in the link.
The above implementation steps are all you need to get started and they typically take only a few minutes to complete. Please reach out to us if you have any questions.
See also
Was this article helpful?