Getting Started

Building Blocks

Custom Fields

Subscription Features

Localization

Invoices

Credits

Order Management

Billing Features

Taxes

Payment Methods

Direct Debit Payments

Configuring Gateways

Revenue Recovery

Hosted Pages

Notifications

Reports and Analytics

Data Privacy & Security

Fraud Management

Migration

Open Source Resources

Other Features

API Integration

Third Party Integrations

Refersion 

Introduction 

Refersion helps you build a custom affiliate referral program. You can use Refersion to create affiliate programs, add affiliates and record their bonuses.
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.

Note

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

Setup Integration 

Step 1: Configure Credentials

You need to configure credentials in both Chargebee and Refersion before you get started.
It goes both ways- Chargebee's should be configured in Refersion and vice versa.

Configure Chargebee's Credentials in Refersion

If you are new to Refersion, sign up for a Refersion account. As a part of the signup process, you will be prompted to connect with the platforms you are using with your website, select Chargebee from the list.
If you already have a Refersion account, log in and navigate to Account > Settings > Tracking and click the Add Tracking option. Select Chargebee from the list of platforms displayed.

Now you will be prompted with a page, where you can need to enter the details of your business:

  • Chargebee Thank You Page: Of the two options given, here you mention whether your ‘Thank You' page is self-hosted or not.
    Hosted - Your Thank you page is managed by Chargebee
    Self-Hosted - You manage your own Thank you page
    Refer Chargebee's Integrations Options for further details.
  • Shop URL: This is your website's URL (example: http://www.acmeinc.com).
  • Chargebee Site URL: example: acmeinc.chargebee.com
Note

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).

Configure Refersion's Credentials in Chargebee

Log in to your Chargebee site and navigate to Settings > Third Party Integrations > Refersion
Fill in the following details of your Refersion account:

Refersion API keys (Public and Secret): You can find this information in Refersion by navigating to Account > Settings > Refersion API

Or you can find these details from the prompt that appeared in your Refersion account while you were setting up Chargebee in Refersion. Click here to know more on how to find the keys in Refersion.

Subdomain: Subdomain refers to the name of your Refersion shop as it appears in your Refersion URL (example: acme.refersion.com)
Version: If you are new user or have started using Refersion, select v2 from the dropdown menu.

Step 2: Add Tracking Script

Refersion is equipped to track visits and orders in your website that occur as a direct result of your affiliates. Insert this snippet of JS code into the webpages (on your website) that you would like Refersion to keep a track of for affiliate redirected visits.

Step 3: Configure Webhooks

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 and navigate to Settings > Configure Chargebee > Webhooks and click Add new webhook.

Here Webhook URL needs to be focused on. Replace SUBDOMAIN, PUB_KEY and SEC_KEY in the URL mentioned below with Refersion's Subdomain, Public Key and Secret Key, and the rest can stay as is.

https://SUBDOMAIN.refersion.com/tracker/chargebee/conversion/v2/?public_key=PUB_KEY&private_key=SEC_KEY

For details on the rest of the webhook settings, refer Webhook Settings page.

Configurations in Hosted pages

Once you configure the webhooks, you need to pass a few parameters in the checkout page. This depends on the type of the checkout that you are using.

Refer to the below sections accordingly:

If you are using the hosted pages and have your own Thank you page (self-hosted)

Note
  • If you are using Chargebee's checkout page, then this does not apply to you.

Add Refersion's URL Parameter

If you're using your own Thank You page, you need to add Refersion's URL parameter to your redirect URL. For that, log in to your Chargebee site and navigate to Product Catalog > Plans and select the plan your affiliate is referring you for and Edit the plan.

Find the section Hosted Page & Customer Portal and add the snippet ?rfsn_ci=#{{subscription.id}} to the configured Thank you page

*Add Refersion's code snippet to your Thank you page *

Add the following code snippet from Refersion in your Thank you page for Refersion's tracking.
Replace SUBDOMAIN and pub_key in the snippet with Refersion's Subdomain and Public Key, without changing the rest of the code.

Click here to know how to find Refersion's Subdomain and Public Key.

*<!-- REFERSION TRACKING: BEGIN -->*
<script src="//SUBDOMAIN.refersion.com/tracker/v3/pub_key.js">
</script><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," "))}
**if** (rfsn_getQS('rfsn_ci')) {
        _refersion(**function**(){
                _rfsn._addCart(rfsn_getQS('rfsn_ci'));
                _rfsn._setSource("CHARGEBEE");
        });}</script>
*<!-- REFERSION TRACKING: END —>*

If you are using Chargebee.js

When you are using the Chargebee.js you need to do the following:

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

  • Add the following script in all the pages that has the checkout/subscribe button.

Example:
<script src="//SUBDOMAIN.refersion.com/tracker/v3/pub_key.js">
  • If you are using the drop-in script, add the attribute data-cb-refersion-enabled="true" in the header script of the plans.
Example:
<script src="https://js.chargebee.com/v2/chargebee.js" 
data-cb-site="your-site" data-cb-refersion-enabled="true">
  • If you are using Checkout via API, then pass the enableRefersionTracking parameter as True while initializing Chargebee's instance.
Example:
$( document ).ready(function() {
  var chargebeeInstance = Chargebee.init({
    site: "your-site",
    enableRefersionTracking: true
  });
});

Track Affiliate Payments 

After setting up your campaign in Refersion, for every transaction made through your affiliate, you can find a report on the purchase in your Refersion Account. Learn more about how Refersion handles payments to affiliates.

FAQ 

1. What does Refersion track on my website?

Refersion tracks and reports on two things:

  1. 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) and
  2. Orders made on your website (or with Chargebee's hosted pages) that are a direct result of your affiliates.
    Tracking orders also help Refersion calculate the commission owed to your affiliate for facilitating the sale.

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.

Was this article helpful?
Loading…