Home Integration Methods s2Member (WordPress membership module)

s2Member (WordPress membership module)

s2Member is a WordPress plugin for professional WordPress membership management. The integration is easy, you only have to place a code to a special s2Member config section.
Place the tracking code
The first step to integrate the sale tracking code into your s2Member is to place the following code to s2Member section API / TrackingSignup Tracking Codes:
In case you need to track also some other details, you can see variables available right below this section (in s2Member).
Recurring commissions
If you want to payout recurring commissions to your affiliates, you have to enable s2Member plugin in your Post Affiliate Pro. Set a secret word there and then navigate to your s2Member admin, to API / Notifications> Payment Notifications and use this notification URL (set the secret word there):
To make this working correctly, you have to use Recurring commission feature in your Post Affiliate Pro set to work with API. In your campaign, you have to configure recurring commissions and set recurrence to 'varied' which means it will cooperate with s2Member notifications.
Register affiliates
As you can see in the plugin configuration, there is a checkbox for affiliate registrations. In case you want to create an affiliate account for every new member, you have to check the checkbox and then, in your s2Member administration navigate to API / Notifications> Signup Notifications and set this URL there:
This is it, save your work.
Parent affiliate
This will create a new affiliate for every new member. In case you want to track also a parent affiliate, you have to create an additional (optional) field in your s2Member subscription form (General Options> Registration/Profile Fields) and name it 'visitorID' (the same for unique field ID).
The next step is to set a custom script in Footer Design section of General Options> Login/Registration Design. Please insert this code there:
This code will make sure the parent affiliate info (a cookie value) is stored in this field, and the field itself is hidden from the form.
The last step is to add &visitorID=%%visitorID%% to your signup notification in s2Member.
Refund tracking
In case you want to track refunds and automatically mark commission as refunded when it is refunded, you have to navigate to your s2Member admin, to API / Notifications> Refund/Reversal Notifications and use this notification URL (set the secret word there):
That's it, save your work.
s2member and PayPal - integration of the dynamic checkout form
If you are using PayPal as a payment gateway in s2member then a different approach of integration is needed.

First of all, into the notify_url field of each 'checkout' button ('paypal-checkout-button.php','paypal-sp-checkout-button.php', etc. ) found at

you have to add:

if the default notify_url field code looks like this:
 <input type="hidden" name="notify_url" value="%%notify_url%%" />

then change it to this one:
 <input id="pap_ab78y5t4a" type="hidden" name="notify_url" value="%%notify_url%%" />

Afterwards, into the footer file of your current theme, so into 

you have to add the following code:
In case you wanted to track a product ID as well, add this attribute to your s2memerb PayPal form code:
s2member and PayPal - forwarding PayPal's instant payment notification to Post Affiliate Pro
The last step of the integration is to look up the following file:

and find the line:
public static function paypal_notify() {
and place the following code right below it:
That's it.
Now, log in to the merchant panel of Post Affiliate Pro (Network), navigate to the "Plugins" section and activate the "PayPal IPN Handling" plugin.

NOTE: If you wish the paying customer to be automatically created as an affiliate, then in the 'PayPal IPN Handling' plugin  turn on the "Register new affiliate with every occured event" option.

NOTE2: The  'PayPal IPN Handling' automatically handles the refunds -- if a previously tracked transaction (that resulted in a commission) is refunded in PayPal, then it will be automatically refunded in Post Affiliate Pro (Network) as well. 
Do not forger to integrate your WordPress with the click tracking code.