Docschargebeedocs

HomeBillingPaymentsRevRecGrowthReveal
Support

Product Updates


  • Release Notes

Getting Started


  • Overview
  • Chargebee Billing Data Centers
  • Object Relationship Model
  • Understanding Sites
  • Chargebee Tech Glossary
  • Articles and FAQ

Implementing Chargebee


  • Implementation Guide
  • Go-live Checklist
  • Articles and FAQ

AI in Chargebee


  • Chargebee Agents
  • Chargebee Copilot
  • Chargebee MCP Server (Model Context Protocol)

Developer Resources


  • Developer Resources Overview
  • Articles and FAQ

Product Catalog


  • Product Catalog Overview
  • Coupons
  • Articles and FAQ

Subscriptions


  • Working with Subscriptions
  • Billing
  • Orders
  • Articles and FAQ

Customers


  • Managing Customers
  • Account Hierarchy
  • Email Notifications
  • Branding
  • Configure Multiple Languages
  • Articles and FAQ

Entitlements


  • Entitlements Overview
  • Features Overview
  • Feature Management
  • Managing Product Entitlements
  • Subscription Entitlements
  • Customer Entitlements
  • Grandfathering Entitlements
  • Articles and FAQ

Usage Based Billing


  • Understanding Usages
  • Setting up Usage Based Billing
  • Metered Billing
  • Articles and FAQ

Chargebee CPQ


  • Chargebee CPQ
  • Chargebee CPQ for Salesforce
  • Chargebee CPQ for HubSpot

Invoices, Credit Notes, and Quotes


  • Invoices
  • Credit Notes
  • Quotes [Legacy]
  • Transactions
  • Articles and FAQ

Taxes


  • Overview
  • Configuring Taxes
  • Country-specific Taxes
  • Articles and FAQ

Hosted Capabilities


  • Overview
  • Hosted Checkout
  • Hosted Self-Serve Portal
  • Hosted Pages Features
  • Additional Hosted Pages
  • Payment Components
  • Pricing Table
  • Managing Payments with Chargebee.js
  • Mobile-Optimized Hosted Pages
  • Articles and FAQ

Site Configuration


  • Users & Roles
  • Custom Fields & Metadata
  • Approvals
  • Mandatory Fields
  • File Attachments & Comments
  • Advanced Filter Options
  • Multicurrency Pricing
  • Multi-decimal Support
  • Configuring Reason Codes
  • Events and Webhooks
  • API Keys
  • Time Zone
  • Time Machine
  • Transfer Configurations
  • Articles and FAQ

Multi Business Entity


  • Multi Business Entity Overview
  • Customer Transfer Overview
  • Articles and FAQ

Mobile Subscriptions


  • Overview
  • Omnichannel Subscriptions
  • Omnichannel One-Time Orders
  • Mobile Subscriptions (Legacy)

Reports and Analytics


  • RevenueStory
  • Home Dashboard
  • Frequently Asked Questions
  • FAQs for Classic Reports Sunset
  • Articles and FAQ

Integrations


  • Sales
  • Customer Support and Success
  • Finance
  • Tax
  • Marketing
    • Refersion
    • MailChimp
    • Zapier
    • ActiveCampaign
  • Stitch
  • Collaboration
  • Contract Management
  • Ecommerce Management
  • Articles and FAQ

Data Privacy & Security


  • Two Factor Authentication
  • SAML Single Sign-On
  • System for Cross-Domain Identity Management (SCIM)
  • EU-GDPR
  • Consent Management
  • Personal Data Management
  • Compliance Certificates
  • HIPAA Guidelines
  • PCI Recommendations and Integration Types
  • Articles and FAQ

Data Operations


  • Bulk Operations
  • Migration
  • Articles and FAQ
  1. Billing
  2. Integrations
  3. Marketing
  4. Refersion
  1. Billing
  2. Integrations
  3. Marketing
  4. Refersion

Refersion

Introduction

Refersion is an affiliate marketing platform that connects to your e-commerce store and manages every aspect of your program in one place. It helps online shops track sales driven by promoters, influencers, and affiliates. Easier to create, grow, and track your very own affiliate program. Getting set up takes minutes and requires zero technical knowledge.

image

You can use Refersion to:

  • Create an affiliate marketing program.
  • Add affiliates to your program.
  • Record the bonuses of your affiliates.

The Chargebee-Refersion integration enables you to track and report the purchases that are generated by your affiliates. The report on the aforementioned purchases can be found in your Refersion Account.

If you are an API user, contact support to set up order tracking for your site via the API.

Setup Integration

Configure Credentials

You need to configure credentials in both Chargebee and Refersion before you get started.

Setting up the Integration in Refersion

If you already have a Refersion account, follow these steps to set up an integration in Refersion:

  • Log into Refersion using the credentials.

If you are new to Refersion, sign up for a Refersion account.

  • Click Account > Settings > Tracking.
  • Enable V4 Tracking.
  • Click Add Tracking.
  • Refersion is equipped to track visits and orders on the website placed by your customers, who visited the website/app through your affiliates.
  • Insert this snippet of JS code into the web pages (on your website) that you would like Refersion to keep a track of for affiliate redirected visits.
image

As a part of the signup process, you will be prompted to connect with the platforms you are using along with your website.

  • Select Chargebee from the platform options listed here.
    image
  • Configure Refersion's Credentials in Chargebee: Enter the following information:
    • Chargebee Thank You Page: This field displays two options in the dropdown as listed here:
      • Hosted - Your Thank you page is managed by Chargebee.
      • Self-Hosted - You manage your own Thank you page.

Refer to Chargebee's Integrations Options for further details on configuring credentials.

  • Shop URL: This is your website's URL example: http://www.acmeinc.com
  • Chargebee Site URL: example: acmeinc.chargebee.com
  • Refersion API keys (Public and Secret): To find this information in Refersion click Account > Settings > Refersion API. Click here to know more on how to find the keys in Refersion.

Copy the details under API Keys and Subdomain, as they come in handy in the upcoming step(when you add Refersion's credentials in Chargebee).

image

Follow these steps to set up the integration from Refersion to Chargebee within the Chargebee store:

  1. Select Hosted from the drop-down of the Chargebee Thank You.
  2. Enter the Website URL in the Enter Your Shop URL field.
  3. Enter the Chargebee Site URL.
  4. Enter the Refersion API Keys and Subdomain information.
  5. Click Connect Chargebee.

Connecting to Refersion

Now that you have set up the integration in Refersion log into the Chargebee site to connect to the created Refersion account.

1.Connecting to Refersion Account

  • Login to Chargebee.
  • Click Apps>Go to Marketplace> Refersion.
  • Enter your Refersion API Keys, and Subdomain information.
  • Click Save.
    image

2. Setup the Webhook in Chargebee

Chargebee can send the order data back to Refersion using Webhooks. To configure Refersion's webhook in your Chargebee site, sign in to your Chargebee site.

  • Click Settings > Configure Chargebee > Webhooks and click Add new webhook.
  • Configure the Refersion's Webhook URL, with the Refersion API Keys, and Subdomain details:
    https://<SUBDOMAIN>.refersion.com/tracker/chargebee/conversion/v2/?public_key=<PUB_KEY>&private_key=<SEC_KEY>
    
  • Click Save.

3. Setup the Checkout

  • Add Chargebee JS to your header.
  • If you are using, Chargebee's Drop-In Script to generate the Subscribe button, Note:Add the parameter data-cb-refersion-enabled="true" to your Chargebee JS function in the header.
  • If you are using, Chargebee JS and generating your own Subscribe buttons, Add the following script in all the pages that have the checkout/subscribe button.
<!-- REFERSION TRACKING: BEGIN -->
<script>
! function(e, n, t, i, o, c, s, a) {
    e.TrackingSystemObject = "r", (s = n.createElement(t)).async = 1, s.src = "https://cdn.refersion.com/refersion.js", s.onload = function() {
        r.pubKey = "<PUB_KEY>";
        // Uncomment next line if you need to debug during testing
        // r.settings.dbg_mode = true;
        r.settings.fp_off = true;
        r.initializeXDLS().then(() =>; {
            r.launchDefault().then(() =>; {
                const rfsnTrackingEvent = new Event("refersion-loaded");
                document.dispatchEvent(rfsnTrackingEvent);
            });
        });
    }, (a = n.getElementsByTagName(t)[0]).parentNode.insertBefore(s, a)
}(window, document, "script");
</script>
<!-- REFERSION TRACKING: END -->
/* Note to Add the Public Key to the code */

4. Setup your Thank you / Conversion page

Chargebee's default Thank you page

  • Chargebee supports its native Thank you page, where post purchase, users will be shown a close button that signifies the completion of the transaction.
  • Conversions will be tracked automatically in Refersion via Chargebee's Server-Side integration.

Custom Thank you page You can also choose to redirect users to a custom Thank you page designed by you. Chargebee supports this out of the box. To enable this and then track the conversion on Refersion,

  • Navigate to plans, select the plan, and add the Redirect URL.
    image
  • To the configured Redirect URL / Thank you page, add ?rfsn_ci=Find Domain Here .
If your Thank you page's URL was, 
https://acmeinc.com/success.html

This would be,
**https://acmeinc.com/success.html*?rfsn_ci=`subscription.id`**
  • Add this JS snippet to your Custom Thank you page.
<!-- REFERSION TRACKING: BEGIN -->
  <script>
  function rfsn_getQS(e) {
      e = e.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
      var t = new RegExp("[\\\\?&]" + e + "=([^&#]*)"), 
      n = t.exec(location.search); 
      return n == null ? "" : decodeURIComponent(n[1].replace(/\\+/g, " "));
  }
  document.addEventListener("refersion-loaded", function() {
    const cart = rfsn_getQS('rfsn_ci');
    let id = '', aid = '', cs = '', url = window.location.href;
    try {
        id = localStorage.getItem("rfsn_v4_id");
        aid = localStorage.getItem("rfsn_v4_aid");
        cs = localStorage.getItem("rfsn_v4_cs");

        if (id && aid && cs) {
            r.sendCheckoutEvent(cart, id, url, aid, cs);
        } else {
            console.warn("Missing Refersion parameters.");
        }
    } catch (error) {
        console.error(error);
    }
  });
  console.log(rfsn_getQS('rfsn_ci'));
  </script>
<!-- REFERSION TRACKING: END -->

5. Allow-listing your Domain

Allowlist your domain in Chargebee.

  • Go to Settings.
  • Navigate to Configure Chargebee > Checkout & Self Serve Portal > Advanced Settings > Add Domains and add your site.

This is applicable only when you are using Chargebee's Checkout.

How to Test

  • Create a Test Affiliate on Refersion.
  • Go to Perform Test Order on Refersion's Home Page.
  • Select the Test Affiliate from the drop-down.
image
  • Click Get Test Link, this will generate a unique test URL for you.

    image
  • Copy the link, open a new incognito window, and paste the URL.

    image
  • Test the Subscription purchase flow.

  • Post the purchase, the plan you just bought should reflect as a Conversion on Refersion against the test affiliate. You can see this in the Manage > Conversions section on Refersion.

image

FAQ

1.What does Refersion track on my website?

Refersion tracks and reports on two things:

  • Visits to your website that are a direct result of your affiliates (these are tracked through the affiliate URLs that you set up in your Refersion site)

  • Orders made on your website (or with Chargebee's hosted pages) are a direct result of your affiliates.

2.Chargebee communicates with Refersion via webhook. Where can I find this webhook on my Refersion site?

The webhook that Chargebee uses to communicate with Refersion needs to be set up manually using your Refersion subdomain, your public API key, and your secret API key. It cannot be copied from your Refersion website and pasted in Chargebee.

3. Where can I find my API keys in Refersion? Your API keys are available at Account > Settings > Refersion API.

Log in to your Refersion account and navigate to this page to access your API keys.

4.How do I know what version of Refersion to choose in Chargebee?

If you are a new user or are using the Chargebee-Refersion integration for the first time, then choose version two.

Articles & FAQs

The CB token referenced in parameter token_id is not present
Can I have "Chargebee Login" and "SSO on API" both at the same time to manage the access to the Self Serve Portal?
Why am I asked to setup an account when I am accepting an invite for my organisation?
Salesforce Sync Error due to state mism
'Sync Errors: Contact:There''s a problem with this country, even though it may appear correct. Please select a country/territory from the list of valid countries.: Mailing Country:MailingCountry --'

Show more

Was this article helpful?