Home Integration Methods SWREG


Integration with SWREG is very simple - you only need to place sale tracking 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:
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:

Add the following code right after it:
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:
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 !