本文介绍了通过实施捐赠按钮获取HTML中的Paypapl捐赠交易明细的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为非营利组织开发一个简单的Web应用程序,其中包括Paypal Donation功能.我正在使用HTML5,CSS3和jQuery开发此应用程序.我已经从这里.

我已将所有必需的参数设置为Donation Button,该按钮可将用户引导至Paypal交易页面,并且交易正常.

我的问题是在我的应用程序中获取当前的交易明细,以便我可以将该明细保存到DB进行记录.必需的交易详细信息可能包括:

  1. Donar名称
  2. 捐赠金额
  3. Donar电子邮件地址
  4. 交易日期/时间

在我的应用程序中完成捐赠交易后,是否可以获取这些详细信息?

预先感谢

解决方案

将关注交易数据从Paypal发送到应用程序的最佳方法是在设置Paypal按钮的同时设置notify_url参数.

  <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" [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>

即时付款通知(IPN)可以处理在服务器上,您需要创建IPN侦听器页面,然后在输入标签notify_url的值中指定侦听器页面的URL.

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

您可以在此处获得监听器示例代码.交易完成后,侦听器将获取交易详细信息.

注意::您还可以通过在更多隐藏的input标签中设置自定义数据来发送自定义数据.

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

解决方案

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.

这篇关于通过实施捐赠按钮获取HTML中的Paypapl捐赠交易明细的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 14:56