PayWhirl makes it easy to manage recurring payments.
Integration with PayWhirl is done by using a PayWhirl’s built-in App called “Custom Tracking Scripts”.
Install the app
To start with the integration, navigate to your PayWhirl account and then to Apps & Integrations. Find and install an app called Custom Tracking Scripts.
Once installed you will see two different tabs on the settings page. One section will load scripts on EVERY page PayWhirl provides and the other section will only load scripts AFTER CONVERSIONS, when people complete checkout successfully – this is what we will use.
Sale tracking
The first step is to give your app a name. You can name it e.g. Post Affiliate Pro
Now, choose the ‘Conversion‘ tab and use the following code in it:
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
<script type="text/javascript">
PostAffTracker.setAccountId('Account_ID');
{% for invoice in invoices %}
papSkus = '';
{% for item in invoice.items %}
papSkus += '{{item.sku}}, ';
{% endfor %}
var sale{{ loop.index }} = PostAffTracker.createSale();
if ({{invoice.paid}}) {
sale{{ loop.index }}.setTotalCost({{ invoice.amount_due }} - {{ invoice.shipping_total }} - {{ invoice.tax_total }});
} else {
sale{{ loop.index }}.setTotalCost(0);
}
{% if invoice.subscription_id %}
sale{{ loop.index }}.setOrderID('{{ invoice.subscription_id }}');
{% else %}
sale{{ loop.index }}.setOrderID('{{ invoice.id }}');
{% endif %}
sale{{ loop.index }}.setProductID(papSkus.slice(0, -2));
sale{{ loop.index }}.setData1('{{ customer.email }}');
sale{{ loop.index }}.setCurrency('{{ invoice.currency }}');
sale{{ loop.index }}.setCoupon('{{ invoice.promo_code }}');
{% if loop.index != invoices|length %}
sale{{ loop.index }}.doNotDeleteCookies();
{% endif %}
{% endfor %}
PostAffTracker.register();
</script>
If you scroll down a little you will see a full list of available variables, so if you was to customize the sale tracking code, feel free to do so using the available variables.
Webhook setup
To track also recurring payments you’ll need to set up a webhook under Developer > Webhooks where you need to create a webhook for account event charge.succeeded. If you are looking to track refunds as well then create the webhook for charge.refunded as well.
The webhook must be created for the following URL:
https://URL_TO_PostAffiliatePro/plugins/PayWhirl/paywhirl.php
The recurring commissions will only track if you use the Recurring Commissions feature or the Lifetime Commissions plugin.
Plugin activation
The last step of the integration is to activate the tracking plugin in your Post Affiliate Pro account. Log in to your merchant panel and go to Configuration > Plugins where you need to find and activate the PayWhirl webhook handling plugin. Once the plugin is activated you can configure it to enable/disable refunds tracking and to set what details should be saved into the extra data fields of the commission.
Do not forget to integrate your site with the click tracking code.
This text explains how to integrate Tilda, a platform for creating websites without code, with Post Affiliate Pro, a tracking software for affiliate programs. The process involves adding a webhook, creating a custom field, and adding custom code. The Tilda plugin can then be enabled and configured in the Post Affiliate Pro merchant panel. It is important to also integrate the click tracking code into landing pages for affiliate banners and links.