Home Integration Methods PayPal Express Checkout (IPN and custom field used by other script)

PayPal Express Checkout (IPN and custom field used by other script)

PayPal Express Checkout integrates using IPN callback even if the callback and custom field is used by other system (e.g. shopping cart). Because of this you will have to choose separator which will separate our and 3rd party cookie value. We will use || in this example.

Note! This is description of integration with PayPal if you use PayPal buttons on your web pages. If you use PayPal as a processing system in your shopping cart, use the method for integrating with shopping cart, not these steps.
1
Choose separator
Choose separator which will separate our and 3rd party cookie value. We will use || in this example. You have to configure Paypal plugin to use this separator. Go to Plugins -> Paypal -> Configure -> Custom Value Separator
2
Paypal button
Now add the following code into EVERY PayPal button form. Please make sure that the custom field you have in your button has id="pap_ab78y5t4a".
This will ensure that referrer will be added to the custom field after the specified separator.
3
Integration with your IPN processing script - part 1
Now the IPN callback is pointed to your script. This callback has to be forwarded also to PAP paypal.php script, which url is http://www.yoursite.com/affiliate/plugins/PayPal/paypal.php. In case, your paypal processing script is in PHP, you can use following code to accomplish that. You can place it at the beginning of your processing file.
4
Integration with your IPN processing script - part 2
The custom parameter is in format 3rdPartySystemValue||PapValue. In order for 3rd party system to work correctly you need to parse 3rdPartySystemValue from the custom parameter. To do this add following code right after PayPal IPN verification.
This is all that is required. Now whenever there's sale, PayPal Express Checkout will use its IPN function to call our sale tracking script, and system will generate commission for the affiliate.