PayPal Express Checkout (IPN and custom field used by other script)
Integrate PayPal Express Checkout with Post Affiliate Pro using IPN callback and custom fields. Configure a separator for cookie values and add specific code to PayPal button forms for seamless affiliate tracking and commission generation.
PayPal Express Checkout (IPN and custom field used by other script) integration
The faster, safer way to send money, make an online payment, receive money or set up a merchant account.
PayPal Express Checkout integrates using IPN callback even if the callback and customfield 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.
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.
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” :
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
<script type="text/javascript">PostAffTracker.setAccountId('Account_ID');
PostAffTracker.setAppendValuesToField('||');
PostAffTracker.writeCookieToCustomField('pap_ab78y5t4a');
</script>
This will ensure that referrer will be added to the custom field after the specified separator.
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:
/* PAP integration */
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://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 */
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:
<?php
$separator = '||';
if ($_POST['custom'] != '') {
$explodedCustomValue = explode($separator, $_POST['custom'], 2);
if (count($explodedCustomValue) == 2) {
$_REQUEST['custom'] = $_POST['custom'] = $explodedCustomValue[0];
}
}
?>
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.
Frequently asked questions
- What is PayPal Express Checkout (IPN & custom field) integration?
It is a method to integrate PayPal Express Checkout with Post Affiliate Pro using IPN callbacks and a custom field, enabling efficient affiliate tracking even when the custom field is used by another system, like a shopping cart.
- How do I set up the custom value separator for PayPal integration?
Go to Plugins > Paypal > Configure > Custom Value Separator and set the separator (e.g., ||) to differentiate between Post Affiliate Pro and third-party system values in the custom field.
- How do I forward IPN callbacks to Post Affiliate Pro?
After your IPN processing script receives the callback, use cURL to forward the data to the Post Affiliate Pro PayPal integration script (paypal.php).
- How should I handle the custom parameter in the IPN script?
After PayPal IPN verification, parse the custom parameter to extract the third-party system value by splitting it using the chosen separator (e.g., ||).
- When should I use this integration method?
Use this method when you add PayPal buttons directly to your web pages and need to track affiliate sales, not when PayPal is used solely as a payment processor in your shopping cart.
Enhance Your Affiliate Tracking with PayPal Express Checkout
Discover seamless PayPal Express Checkout integration with Post Affiliate Pro, featuring IPN callbacks and custom field handling. Maximize your affiliate marketing potential today.