Salman Nazir
Salman Nazir

Reputation: 2837

Get Paypapl Donation Transaction Detail in Html with Donation Button Implemented

i am working on a simple web application for a non-profit Organization which include Paypal Donation feature. i am developing this application using HTML5 , CSS3 and jQuery.I have implemented Donation button from here.

I have set all required parameters to Donation Button that leads user to Paypal Transaction Page and transaction is working fine.

My problem is to get the current transaction detail in my application so that i can save that details to DB for the records. Required Transaction details may Include :

  1. Donar Name
  2. Donation Amount
  3. Donar E-mail Address
  4. Transaction Date / Time

Is there any way to get these detail when the donation transaction complete in my application?

Thanks in Advance

Upvotes: 2

Views: 175

Answers (1)

Salman Nazir
Salman Nazir

Reputation: 2837

Best Way to get concern transaction data from Paypal to application is to set notify_url parameter while setting the 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=“[email protected]”>
         <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>

Instant Payment Notification (IPN) is there to handle this notification to your server.On Server you need to create IPN listener page and then specify the URL of the listener page in value of input tag notify_url .

<input id="notify_url" type="hidden" name="notify_url" value=“YOUR URL WHERE YOU WANT TO GET THAT TRANSACTION DETAIL”>

You can have the Listener sample code here. When the transaction will complete , Listener will get the transaction detail .

Note : You can send custom data will this transaction as well by setting their values in more hidden input tags.

Upvotes: 3

Related Questions