This guide explains how to integrate Chargebee purchases and subscriptions into LeadDyno. Chargebee is a leading subscription billing software powering end-to-end recurring billing, subscription management & auto invoicing. With this integration, you can send transaction details to LeadDyno, along with the affiliate ID in order to track the affiliate's conversion and commissions.
Important Note:
- If you are a customer who has been using the original Chargebee integration, we have a dedicated guide which can be found here. This hyperlinked guide is applicable to APIv1 users. Unsure if this includes you? Send us a note and we’ll help you along your way!
- For new users, Chargebee will automatically assign you to APIv2.
In this article
Requirements
The Chargebee integration requires the following before you can successfully connect with LeadDyno.
1. Chargebee Site address
2. Chargebee API Key.
To start, log in to your Chargebee account. Next, simply follow the steps below:
Chargebee Site Address
First, let’s get your site address. It’s the URL that is found at the top of your Chargebee dashboard. To get your Chargebee site address, please check the URL of your dashboard, it should follow the format {site}.chargebee.com For example, in the image below the Chargebee site address is ldd-ssc-test.chargebee.com, and in this instance what you need is "ldd-ssc-test"
Chargebee API Key
Once you have the Chargebee site address, the next step is to generate the API Key inside your Chargebee account. To find this key, just follow these steps:
1. Go to your Chargebee Home Page, and click on Settings → Configure Chargebee;
2. Once this is done, choose API Keys under API Keys and Webhooks;
3. Choose Add API Key;
4. Select Read-Only Key → All (Please select "All" after selecting "Read-Only Key);
5. Copy the API Key from Chargebee.
Connect to LeadDyno
Ok, it’s time to take the information you’ve gathered from Chargebee (including the site Address and Chargebee API Key) and go ahead and log in to your LeadDyno account. Now that you’re logged in, follow these steps to complete the integration:
1. Connect the Chargebee integration from your LeadDyno Account via Apps → Online Payment.
2. When you scroll down, Chargebee is listed as one of the apps as seen in the image below. Go ahead and click “add"
3. Copy the API Key and Site Address you grabbed from Chargebee and fill in the corresponding information for your Chargebee Site and the API Key. Once this is done please click "Connect"
4. The next step will be to add the Javascript below to the header of your website. Adding this script enables LeadDyno to track when visitors make a purchase. Not sure how to add this script to your website header? We recommend reaching out to the provider for your website to guide you on how to do this.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script type="text/javascript" src="https://static.leaddyno.com/js"> </script>
<script>
LeadDyno.key = "PUBLIC_API_Key";
LeadDyno.recordVisit();
LeadDyno.autoWatch();
$(document).ready(function() {
var cbInstance = Chargebee.getInstance();
cbInstance.setCheckoutCallbacks(function(cart) {
return {
success: function(hostedPageId) {
LeadDyno.recordVisit({ 'purchase_code': hostedPageId, channel: 'chargebee' }, null, true);
}
}
});
});
</script>
Chargebee WebHook
Setting up the Chargebee webhooks enables LeadDyno to listen only (read-only permission) to Chargebee events, so LeadDyno can track the purchase details and associate the related affiliate compensation for purchases made via Chargebee.
Navigate to the Webhook Settings page in Chargebee, and then,
- Create a new webhook named "LeadDyno"
- Enter the Webhook URL as: https://collector.leaddyno.com/chargebee_webhook?key= (Replace it with your private LeadDyno API key)
- Keep the other configurations unchanged and click Create Webhook.
Completing the above setup will enable LeadDyno to track any lead conversions or cancellations made and even calculate the affiliate compensation for purchases.
Limitations / Known Issues
The Chargebee APIv2 integration is currently compatible only with Chargebee's In-App Checkout. This integration is not compatible with other checkout versions such as Full Page Checkout.