If you want to seamlessly retrieve transaction data from Paypal to your application, make sure to include the notify_url
parameter when setting up your Paypal button.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" id ="businessAccount" name="business" value=“<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7424150d04151834071b19115a1715">[email protected]</a>”>
<input type="hidden" name="lc" value="US">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="cn" value="Add Some Words about this Donation:">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynow_LG.gif:NonHosted">
<input type="hidden" name="on0" value="Donate">
<input id="amount" type="hidden" name="amount" value=“50” >
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
<input id="notify_url" type="hidden" name="notify_url" value=“YOUR URL WHERE YOU WANT TO GET THAT TRANSACTION DETAIL”>
<input id="return" type="hidden" name="return" value=“AFTER SUCCESSFUL TRANSACTION URL FROM YOUR SITE“>
<input id="cancel_return" type="hidden" name="cancel_return" value=“CANCEL TRANSACTION URL FROM YOUR SITE“>
</form>
To handle these notifications efficiently, utilize Instant Payment Notification (IPN). Create an IPN listener page on your server and specify the URL of this page in the value of the notify_url
input tag.
<input id="notify_url" type="hidden" name="notify_url" value=“YOUR URL WHERE YOU WANT TO GET THAT TRANSACTION DETAIL”>
To access a sample of IPN listener code, check it out here.
After a transaction is completed, the Listener will receive detailed information about the transaction.
Note: You can also include custom data with the transaction by setting their values in additional hidden input
tags.