aMember version 4 uses a new file structure and new code, so here is a new integration method.

1.

First, locate file:
application/default/views/_form.phtml

In this file, we will add a special code to the form, so visitor ID is read and sent to processing file. Change this line:
echo $form->render($renderer);
to this code:

$form_res = $form->render($renderer);
$tracker = '<input type="hidden" name="pap_custom" value="" id="pap_dx8vc2s5">
    <script id="pap_x2s6df8d" src="http://URL_TO_PostAffiliatePro/scripts/notifysale.php?accountId=default1" type="text/javascript">
    </script>';
echo str_replace('</form>',$tracker.'</form>',$form_res);

Save your work and based on what do you want to integrate, continue in proper step.

2.

Integration with PayPal within aMember - step 1

Now edit this file:
/amember/library/Am/Paysystem/PayProcessMediator.php
Find function process() and within this function, find line:
$this->callback($this->onAction);
Inset this code just below the mentioned line:

$this->result->getAction()->addParam('custom', $_POST['pap_custom']);

With this line, we've added a new parameter called 'custom' to array which will be used to create a request sent to PayPal. Thanks to this, we are sending visitor ID so we can use it later to determine who was the referring affiliate.
Save your work and proceed to step 3.

3.

Integration with PayPal within aMember - step 2

The last step is to handle the IPN notification sent from PayPal and to resend it to your Post Affiliate Pro. Navigate to Configuration> Setup/Configuration> PayPal in your aMember admin panel and activate 'Resend Postback'. If it is already active, just add a new line with this URL:

http://URL_TO_PostAffiliatePro/plugins/PayPal/paypal.php

Save your work and that's it. Do not forget to activate your PayPal IPN handling plugin in Post Affiliate Pro to make it all working.

4.

PayPal and use of Cart feature in aMember

In case you are using aMember Cart feature, you have to do the previous steps and additionally, you have to modify this file application/cart/views/cart/choose-paysys.phtml - find this line:
<input type="hidden" name="a" value="choose-paysys" />
and add the following code below the line:

<!-- Post Affiliate Pro integration snippet -->
    <input type="hidden" name="pap_custom" value="" id="pap_dx8vc2s5" />
    <script id="pap_x2s6df8d" src="http://URL_TO_PostAffiliatePro/scripts/notifysale.php" type="text/javascript">
    </script>
<!-- /Post Affiliate Pro integration snippet -->

Save your work and you are done.

5.

Integration of aMember signup

If you want new users to become affiliates automatically, it is possible to synchronize aMember signup form with Post Affiliate Pro. Thanks to the built-in plugin, you can easily set it up in aMember admin back-end.