成功付款后如何从Paypal获取交易详细信息 [英] How can get transaction details from paypal after successful payment

查看:372
本文介绍了成功付款后如何从Paypal获取交易详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我发送给Paypal的数据是


My sent data to paypal is

"https://www.paypal.com/cgi-bin/webscr/cmd=_cart&upload=1&business=seller.email@something.com&currency_code=USD&bn=BusinessName&return=http://www.sellersite.com&item_number_1=55&item_name_1=battery&amount_1=55&quantity_1=2&item_number_2=52&item_name_2=bat&amount_2=5&quantity_2=3"

我想在成功付款后在"http://www.sellersite.com"上向买方显示那些发送的数据(项目编号,项目名称,金额,数量)和贝宝交易ID. (假设卖方拥有一个带有Paypal的商户帐户,他将通过网站的admin部分将该Paypal ID输入数据库.因此,我不会考虑他的Paypal帐户设置,我的工作只是为Paypal付款创建环境.卖方).

如果我写这样的脚本

And I want to show those sent data(item number, item name,amount,quantity) and the paypal transaction id to the buyer on "http://www.sellersite.com" after successful payment. (Suppose, the seller has the merchant account with paypal and he would enter that paypal id into database from admin section of the website. So,I would not think about his paypal account settings, my job is just to create the environment for paypal payment for the seller.)

If I write a script like

$T_ID=$_REQUEST['tx']; // or $T_ID=$_GET['tx']; **ref(tx):- "https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/howto_html_paymentdatatransfer"

$item=$_REQUEST['item_number_1']; // or $item=$_GET['item_number_1'];

那我可以从贝宝那里得到那些数据吗?

Then would I get those data from paypal ?

请告诉我.

-谢谢.

推荐答案

它不会那么简单.您需要设置付款数据传输(PDT),以便在买家完成付款后将详细信息发送回您的退货网址.

It's not going to be quite that simple. You'll need to setup Payment Data Transfer (PDT) in order to get details sent back to your return URL after the buyer completes the payment.

如果您只是要向用户显示详细信息,这很有用,但是不建议您更新自己的数据库,发送电子邮件通知等,因为无法保证将访问此页面,因此代码不会总是运行.

This is useful if you're simply going to display details back to the user, but it's not recommended for updating your own database, sending out email notifications, etc. because there is no guarantee this page will ever be reached so the code won't always run.

对于这种情况,您需要使用即时付款通知(IPN).这与PDT非常相似,除了它将始终将数据POST到服务器上的IPN侦听器,而不管用户是否将其返回给您的返回URL,并且它总是在结帐系统之外发生.

For that sort of thing you'll want to use Instant Payment Notification (IPN). This works very similar to PDT except that it will always POST data to your IPN listener on your server regardless of whether or not the user makes it back to your return URL, and it happens outside of your checkout system all together.

这篇关于成功付款后如何从Paypal获取交易详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆