Getting Started

Product Catalog



Invoices, Credit Notes and Quotes



Site Configuration

Data Privacy & Security

Data Operations

Reports and Analytics



Refersion lets you build an affiliate program. It lets you track partners, sales and customer referrals.

With Chargebee, you can track the number of conversions in your hosted pages that have happened via affiliate referrals.

The integration tracks sign ups and payments in Chargebee, and gives commissions to affiliates that you've created in Refersion.

Integration Steps 

1: If you do not already have a Chargebee account, sign up for one here. 

2: Sign up for a Refersion  account and connect it with Chargebee. If you already have a Refersion account, log in to Refersion and then click here. 

3: Configure these details in Refersion and connect to Chargebee.

Store URL: This is your website's URL. For example:

Site Title: Your business's name.

Shop Currency: Select the currency you're selling in. The same currency should be configured in Chargebee.

Chargebee Site URL: Your Chargebee domain name. For example: acmeinc.

API Key: Add your Chargebee API key. You can find this under Settings > API & Webhooks > API Keys.

4: Configure your Refersion credentials in Chargebee.

The keys in Refersion can be found under, Account > Settings > Refersion API.

Copy the credentials and paste it in Chargebee under Settings > Third Party Integrations > Refersion.

Setting up commissions in Refersion 

An Offer is used for configuring affiliate commissions in Refersion. This is done under Manage > Offers.

There is a Default Offer in Refersion. You could edit this or create a new one. To create a new offer, use the Create New button.

Once you've created a new offer, you can make it default.

Creating Affiliates 

Affiliates can be created by either allowing them to create their affiliate account or you can do it on their behalf.

To allow them to register themselves, click on the Affiliate Registration link under Affiliate Links in your Refersion dashboard. Link the URL to your website.

You can create new affiliates under Manage > Affiliates.

  • One time charges added to customers are not tracked. Only one time charges applied to subscriptions will be updated in Refersion.
  • No updates are made in Refersion when refund transactions happen in Chargebee.
  • For subscriptions in Trial and Future state, a $0 invoice amount is sent to Refersion to track the conversion.

If you make use of Chargebee's hosted pages for sign ups, additional setup is not necessary. The plugin setup as described above is enough.
If you are an API user, follow the steps mentioned in the following section for additional setup.

Refersion for Chargebee's API Users 

For API users of Chargebee, setting up Refersion involves additional steps.

Step 1 Creating subscriptions

During sign up, call the Create subscription API  and include the parameters affiliate_token and created_from_ip in the API call.

affiliate_token - This value must be unique to every order and pixel fire(explained below). This value should not be something that can be easily guessed. Consider using the user's Session ID, since this is unique. You need to generate this token at your end for every order.

created_from_ip - IP address from where the signup request originated. This is used by Refersion for tracking/logging the source.

Step 2 Pixel tracking

A tracking pixel must be fired from the client-side when the customer completes the sign up successfully. Normally, this is done when the sign up is successful and the customer is being redirected to a Success or Thank you page.

The following pixel URL must be used along with parameters:



k = refersion_public_key (your Refersion public key)
ci = affiliate_token

The affiliate_token should be the same token used when creating the subscription(in step 1).

Sample URL:

Implement pixel tracking in jquery 

Invoke this method once the server has responded with the success status for the checkout.
Note: In case you are redirecting the user to another page, it should be done only in "handleSuccessfulCheckout" function otherwise the order will not be properly attributed to the affiliate.

function refersionPixelTracking(refersionPublicKey,affiliateToken){

//Provide a timeout incase refersion fails to respond
window.refersionTimeoutId = setTimeout(function() {
}, 2000);

//Create a hidden image.
var img = document.createElement("img"); = "hidden"; = "fixed"; = "0px"; = "0px";

//On success immediately proceed to the "successful checkout handling"
img.onload = function (e){

//Ignore failures and immediately proceed to the "successful checkout handling"
img.onerror = function (e){

img.src = "" + encodeURIComponent(refersionPublicKey) + "&ci=" + encodeURIComponent(affiliateToken);

function handleSuccessfulCheckout(){

//Clear the refersion timeout.

//Implement the rest of the checkout steps such as forwarding the user to a Thank You page.

Was this article helpful?