Recurly

A SaaS-based company providing recurring billing management as an outsourced service.

This integration method uses Recurly API get the details of the purchased plan and to record a commission with the subscription values.

The integration requires the Recurring Commissions feature for tracking the recurring payments/trial conversions.

1.

Recurly configuration

This integration method uses external "Thank you page", so if you do not have one, please create it. When you have the site, navigate to Configuration->Plans section of your Recurly admin panel and edit your plans. Towards the bottom of the edit plan screen check the checkbox for Bypass Recurly Confirmation and set Return URL After Success to your thank you page.
Add this string to each URL:

?account_code={{account_code}}&plan={{plan_code}}

In case you already have question mark in the link, change the one in above code to ampersand (&) symbol.

2.

Enable API

In Recurly admin panel go to Integrations->API Credentials section enable your API if it is not enabled yet, and get your API key.

Now, navigate to Integrations->Webhooks and use Configure button to add new Endpoint and point its URL to https://URL_TO_PostAffiliatePro/plugins/Recurly/recurly.php

Finally, enable Recurly plugin in your Plugins section of your Post Affiliate Pro merchant panel and set your API key there.

3.

Integration code

Open your thank you page for editing and paste this code to the file:

<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
<script type="text/javascript">
var $_GET = get_query();
var callBack = false;

PostAffTracker.setAccountId('Account_ID');
try {
  PostAffTracker.track();
}
catch(e){}

PostAffTracker._cmanager.loadHttpCookies();
if (getVisitorId() != null && getVisitorId().indexOf('null') != -1) {
	PostAffTracker._cmanager.readAllFlashCookies();
	setTimeout(function() {visitorCallBack();}, 1800);
	PostAffTracker.executeOnResponce.push(function() {visitorCallBack();});
} else {
	visitorCallBack();
}

function getVisitorId() {
	return PostAffTracker._getAccountId() + PostAffTracker._cmanager.getVisitorIdOrSaleCookieValue();
}

function visitorCallBack() {
  if (callBack == false && "null" != getVisitorId()) {
    callBack = true;
    var pixel = document.createElement("img");pixel.width=1;pixel.height=1;
    pixel.src = 'https://URL_TO_PostAffiliatePro/plugins/Recurly/recurly.php?papCookie=' + getVisitorId() + '&account_code=' + $_GET.account_code + '&plan=' + $_GET.plan;
    document.body.appendChild(pixel);
  }
}

function get_query(){
    var url = location.search;
    var qs = url.substring(url.indexOf('?') + 1).split('&');
    for(var i = 0, result = {}; i < qs.length; i++){
        qs[i] = qs[i].split('=');
        result[qs[i][0]] = decodeURIComponent(qs[i][1]);
    }
    return result;
}
</script>


Do not forget to integrate your site with the click tracking code.