SWREG integration
A customer focused payment processing company with a cohesive team of professionals who strive to provide excellent service in ecommerce accounts.
Integration with SWREG is very simple – you only need to place saletracking script into the template of order summary page.
Plugin activation
The very first step is to activate your SWREG plugin. When it is active, login to your SWREG admin panel and click to Setup > Customizable templates.
If your templates are disabled, you should enable them by clicking on the top link enable templates and create Summary template.
Edit Summary template – step 1
Open Summary template and edit it’s code. If you don’t have this template customized yet, you should download the system template and make the changes there.
Put the following code right after <body> tag of the template:
<!-- Post Affiliate Pro integration snippet -->
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
<!-- /Post Affiliate Pro integration snippet -->
Note the integration will only work in case your Post Affiliate Pro is at SSL secured domain.
Edit Summary template – step 2
Now find this line:
[FOREACH="BASKET"]
Add the following code right after it:
<!-- Post Affiliate Pro integration snippet -->
<script type="text/javascript">
PostAffTracker.setAccountId('Account_ID');
var i = 1;
var sale = PostAffTracker.createSale();
sale.setTotalCost('###BRTOTAL2###');
sale.setOrderID('###ORDERNO###(' + i + ')');
sale.setProductID('###BRPRODCODE###');
sale.setStatus('P');
PostAffTracker.register();
i = i + 1;
</script>
<!-- /Post Affiliate Pro integration snippet -->
Save your work.
This integration code will create per product commission, with original default currency mount, and order ID with postfix ‘-N’ where N is a number of product iteration. All the commissions will be created as pending. The plugin, which should already be active, will only approve paid transactions.
Add notification
To make the plugin working, you have to setup a notification for new sales. As all transactions are saved into your Post Affiliate Pro as pending, the notification will tell the plugin which transaction to approve. The plugin will only approve paid transactions because SWREG only sends notifications for paid transactions – it may take few days, e.g. in case of wire transfer.
To setup a notification, navigate to your SWREG admin panel, Setup > Event Notifications and click New Notification button. Set the notification format to JSON and set delivery to this URL:
http://URL_TO_PostAffiliatePro/plugins/Swreg/swreg.php?type=new_order
As the plugin supports also refund notification, you can set one for refunds. Follow the same setup, there is just one difference. The URL parameter type has to be set to ‘refunded’ instead of ‘new_order’.
When you are done, save your notification and do not forget to ENABLE IT !