Home Integration Methods PayPal

PayPal

PayPal integrates using IPN callback.
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.
Also, make sure you don't already use PayPal IPN for another purpose, such as some kind of 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.
1
Integration code
Now add the following code into EVERY PayPal button form
This will tell PayPal that it should silently call http://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.
2
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="http://www.yoursite.com/affiliate/plugins/PayPal/paypal.php">
<input type="hidden" name="custom" value="" id="pap_dx8vc2s5">
<script id="pap_x2s6df8d" src="http://www.yoursite.com/affiliate/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=value1&data2=value2&data3=value3&data4=value4&data5=value5&coupon_code=coupon1&channelId=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 ... PAP4 script calling notifysale.php is per page - have to be below all buttons)
3
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 </body> tag add the following code:
NOTE: The PayPal links must be in your page somewhere above the  <!-- PAP Integration snippet -->  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. 

Does this also handle refunds and chargebacks?

7 years ago John
Does this also handle refunds and chargebacks?

It support also refunds and chargebacks

7 years ago Martin Pullmann, Q.U.
Yes, it is also possible to handle refunds and charge-back too.

New Paypal link instructions

2 years ago Bill Stacy
Awesome job on the new paypal link instructions guys!

Very much appreciated!

Paypal Links

4 months ago Kelvin G
Been Trying to Do the Paypal links. And Finding it Difficult cause On my website it wont let me Write it in the format i see. I has me Write it in Web adrress Form. Is this in Html Format? What is Simplier to Format my paypal service.

Paypal Intergration

4 months ago Kelvin G
Also About the Link At the Footer <snnipet>, What Do you mean <body>??? how do i put it please Step by step instruction. need some help with this.

PayPal Integration

4 months ago Decashgenuis
Please make a short video on this as soon as possible, today maybe? :) Happy Monday let's make this money!