简单的Paypal IPN示例? [英] Simple Paypal IPN examples?

查看:316
本文介绍了简单的Paypal IPN示例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望有一个带有输入按钮的文本输入表单,该按钮会转到贝宝(paypal),付款后,表单的内容应该放在mysql数据库中.

这听起来微不足道,但是我在使用贝宝(Paypal)的IPN时遇到了困难.

任何人都可以向我指出正确的方向吗?

谢谢!

解决方案

PayPal在其网站上有一些示例代码.但是,您将面临的更大问题是用户可能需要实时响应.通常,这是通过处理用户单击链接以返回到您的站点时提交到您的站点的PDT数据来完成的.稍后,PayPal会将类似的数据发布到您的IPN url.您需要避免两次处理数据.

此外,所讨论的数据仅是有关交易的PayPal数据.它不包含任意数据.您可能应该先记录客户的订单,然后再将其发送到Paypal,否则请寻找传递变量.例如,在创建计费协议时,存在一个名为custom的变量,该变量会在创建时传递回给您.您可以在该变量中存储订单ID或任何您想要的内容.请仔细验证其内容,以确保其正确的交易明细.

I would like to have a text input form with a submit button that goes to paypal, upon payment the contents of the form should go in a mysql database..

This sounds trivial, but I'm having such a hard time with paypal's IPN.

Can anyone point in me in the right direction?

Thanks!

解决方案

PayPal has some sample code on their website. However the bigger problem you'll face is that the user will probably want a real-time response. This is usually done by processing the PDT data that is submitted to your site when the user clicks the link to return to your site. At some point later PayPal will post to your IPN url similar data. You need to avoid processing the data twice.

Also the data in question is only PayPal's data about the transaction. It does not contain arbitrary data. You should probably record the customer's order before sending them to paypal, or else look for a pass-through variable. For example, when creating a billing agreement, there is a variable called custom which is passed back to you as you created it. You can store an order id or whatever you want in that variable. Be careful to validate its contents to make sure it's still correct for the transaction details.

这篇关于简单的Paypal IPN示例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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