PayPal Express Checkout integrates using IPN callback even if the callback is used by other system (e.g. shopping cart).
Note! This is description of integration with PayPal Express Checkout if you use PayPalbuttons on your web pages. If you use PayPal as a processing system inyour shopping cart, use the method for integrating with shopping cart,not these steps.

1.

PayPal button

Now add the following code into EVERY PayPal button form

<input type="hidden" name="custom" value="" id="pap_dx8vc2s5">
<script id="pap_x2s6df8d" src="http://URL_TO_PostAffiliatePro/scripts/notifysale.php" type="text/javascript">
</script>

This will ensure that referrer will be stored to the custom field.

2.

Example

Example of updated PayPal form:

&lt;!-- Begin PayPal Button --&gt;&lt;br> &lt;form action="https://www.paypal.com/cgi-bin/webscr" method="post"&gt;&lt;br> &lt;input type="hidden" name="cmd" value="_xclick"&gt;&lt;br> &lt;input type="hidden" name="business" value="paypalemail@yoursite.com"&gt;&lt;br> &lt;input type="hidden" name="undefined_quantity" value="1"&gt;&lt;br> &lt;input type="hidden" name="item_number" value="Product Name"&gt;&lt;br> &lt;input type="hidden" name="amount" value="19.95"&gt;&lt;br> &lt;input type="hidden" name="image_url" value="https://yoursite.com/images/paypaltitle.gif"&gt;&lt;br> &lt;input type="hidden" name="no_shipping" value="1"&gt;&lt;br> &lt;input type="hidden" name="return" value="http://www.yoursite.com/paypalthanks.html"&gt;&lt;br> &lt;input type="hidden" name="cancel_return" value="http://www.yoursite.com"&gt;&lt;br> &lt;span style="font-weight: bold;">&lt;input type="hidden" name="custom" value="" id="pap_dx8vc2s5"&gt;&lt;/span>&lt;br style="font-weight: bold;">&lt;span style="font-weight: bold;">&lt;script id="pap_x2s6df8d" src="&lt;/span>http://URL_TO_PostAffiliatePro/&lt;span style="font-weight: bold;">scripts/notifysale.php" type="text/javascript"&gt;&lt;/span>&lt;br style="font-weight: bold;">&lt;span style="font-weight: bold;">&lt;/script&gt;&lt;/span>&lt;br>&lt;input type="image" src="http://images.paypal.com/images/x-click-but5.gif" border="0" name="submit"&gt;&lt;br> &lt;/form&gt;&lt;br> &lt;!-- End PayPal Button --&gt;

3.

Integration 2

Now the IPN callback is pointed to your script. This callback has to beforwarded also to PAP paypal.php script, which url is http://URL_TO_PostAffiliatePro/plugins/PayPal/paypal.php.In case, your paypal processing script is in PHP, you can use followingcode to accomplish that. You can place it at the beginning of yourprocessing file.

/* PAP integration */
 $ch = curl_init();
 curl_setopt($ch, CURLOPT_URL, "http://URL_TO_PostAffiliatePro/plugins/PayPal/paypal.php");
 curl_setopt($ch, CURLOPT_POST, 1);
 curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST);
 curl_exec($ch);
/* end of PAP integration */

This will ensure that whole IPN callback will be forwarded without affecting your original script


This is all that is required. Now whenever there's sale, PayPal Express Checkout willuse its IPN function to call our sale tracking script, and system willgenerate commission for the affiliate.