Partner
The faster, safer way to send money, make an online payment, receive money or set up a merchant account.
PayPal integrates using IPN callback.
Note! This is a description of integration with PayPal buttons used on your website. If you use PayPal as a payment processing system in your shopping cart, use the method for integrating with the specific shopping cart, not these steps.
Also, make sure you don’t already use PayPal IPN for another purpose, such as some kind of a digital delivery or membership registration.
To integrate with PayPal, you have to turn on the PayPal IPN handling plugin in the merchant panel of Post Affiliate Pro (Network) in the ‘Plugins’ section. Then follow the steps below.
Integration code
Now add the following code into EVERY PayPal button form:
<input type="hidden" name="notify_url" value="https://URL_TO_PostAffiliatePro/plugins/PayPal/paypal.php">
<input type="hidden" name="custom" value="" id="pap_dx8vc2s5">
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/notifysale.php" type="text/javascript">
</script>
This will tell PayPal that it should silently call https://URL_TO_PostAffiliatePro/plugins/PayPal/paypal.php script upon every sale, and it will pass all sale variables including the custom field to this script.
Example
Example of updated PayPal form:
<!-- Begin PayPal Button -->
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="paypalemail@yoursite.com">
<input type="hidden" name="undefined_quantity" value="1">
<input type="hidden" name="item_number" value="Product Name">
<input type="hidden" name="amount" value="19.95">
<input type="hidden" name="image_url" value="https://yoursite.com/images/paypaltitle.gif">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="return" value="http://www.yoursite.com/paypalthanks.html">
<input type="hidden" name="cancel_return" value="http://www.yoursite.com">
<input type="hidden" name="notify_url" value="https://URL_TO_PostAffiliatePro/plugins/PayPal/paypal.php">
<input type="hidden" name="custom" value="" id="pap_dx8vc2s5">
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/notifysale.php" type="text/javascript"></script>
<input type="image" src="http://images.paypal.com/images/x-click-but5.gif" border="0" name="submit">
</form>
<!-- End PayPal Button -->
In notify_url is possible to use additional parameters: data1-data5, coupon code, channel Id, in this case notify_url will look so:
http://www.yoursite.com/affiliate/plugins/PayPal/paypal.php?data1=value1data2=value2data3=value3data4=value4data5=value5coupon_code=coupon1channelId=mychannel
Notice, that if recurring commission is created, into data1 field will be inserted transactionId.
This is all that is required. Now whenever there’s sale, PayPal will use its IPN notification to inform our sale tracking script about new transaction, and system will generate commission for the affiliate.
Note: If you have more buttons at one page, you should use only the custom field code in each button. The script tag should be inserted only once per page.It even doesn’t need to be in the button form, it can be somewhere in the body of the page. (click tracking is per page (have to be above all buttons), “custom” field is per button, “notify_url” is per button too … PAP script calling notifysale.php is per page – have to be below all buttons)
Using PayPal links
If you use just simple PayPal links like:
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MWU1Y4K24N3HY">Click here to order</a>
Then you have to skip the above given steps and do the integration the following way:
- into each link add: id=”paypallink” so the link would look like this:
<a id="paypallink" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MWU1Y4K24N3HY">Click here to order</a>
- under the JavaScript version of click tracking code that is supposed to be in the footer of your page right above the tag add the following code:
<!-- Post Affiliate Pro Integration snippet -->
<script>
PostAffTracker.writeCookieToLink('paypallink', 'custom');
</script>
<!-- /Post Affiliate Pro Integration snippet -->
NOTE: The PayPal links must be in your page somewhere above the line.
There is one last step behind and that is to set your PayPal’s Notification URL to point to the PayPal Ipn Handling plugin of Post Affiliate Pro (Network).
So, log in to your PayPal account, navigate to Profile > Selling Preferences > Instant Payment Notification Preference, click ‘Edit settings‘, enable the IPN messages by selecting ‘Recieve IPN messages (Enabled)‘ and set the Notification URL to:
http://URL_TO_PostAffiliatePro/plugins/PayPal/paypal.php
That’s it.