Paypal 中的 IPN 与 PDT [英] IPN vs PDT in Paypal

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

问题描述

我在 PayPal 的即时付款通知 (IPN) 和付款数据传输 (PDT) 之间进行选择时遇到了一些麻烦.

I'm having some trouble choosing between PayPal's Instant Payment Notification (IPN) and Payment Data Transfer (PDT).

基本上,用户在我的网站上购买一次性产品,在 PayPal 上付款,然后返回我的网站.我了解 IPN 的工作原理,但我现在看到我可以使用 PDT 更轻松地触发成功购买后发生的各种操作,因为数据会在那里返回(而不是需要单独的侦听器).

Basically, users buy a one-off product on my site, pay on PayPal, and return to my site. I understand how IPN works but I'm now seeing that I might be able to trigger the various actions that take place after a successful purchase more easily with PDT, as the data gets returned there and then (as opposed to needing a separate listener).

但是,PayPal 的 PDT 文档包含以下隐晦的行:PDT 不适用于信用卡或快速结账交易."...但我找不到关于该主题的任何进一步内容.

However, PayPal's PDT documentation contains this cryptic line: "PDT is not meant to be used with credit card or Express Checkout transactions." ... but I can't find anything further whatsoever on the topic.

  1. 信用卡真的不能用于 PDT 吗?我想要的不止一句话.

  1. Are credit cards REALLY not meant to be used with PDT? I would like more than a sentence.

这是否意味着用户必须拥有/创建一个 PayPal 帐户才能付款?

Does that mean that a user must have/create a PayPal account to pay?

这是否意味着如果我想允许用户使用他们的 PayPal 帐户和/或直接使用信用卡付款,我必须实施 IPN?

Does it mean that if I want to allow users to pay with their PayPal accounts AND/OR with credit cards directly, I must implement IPN?

任何经历过这种情况的人都可以透露一些信息吗?

Could anyone who's gone through this kindly shed some light?

推荐答案

PDT 和 IPN 的 API 是相似的.主要区别在于您何时收到通知.因此,我建议两者都实施.

The APIs for PDT and IPN are similar. The main difference is when you receive the notification. For that reason I would recommend implementing both.

  • 使用 PDT,您可以立即收到通知,可以进行任何所需的额外处理并向用户显示确认页面.
  • 使用 IPN,即使用户的计算机在向您发送 PDT 之前发生爆炸,您也可以保证收到付款已收到的通知.

同时实施并获得两全其美.但如果你只做一个,IPN 是可靠的.

Implement both and get the best of both worlds. But if you're only doing one, IPN is the reliable one.

一个问题:如果您同时实施两者,那么您的付款就有可能被处理两次.注意确保不会发生这种情况.我编写的应用程序几乎完全相同地处理 PDT 和 IPN(后端部分是相同的),并且该代码在数据库中获取每个网络用户的锁定,以便如果同一用户尝试多次提交完全相同的付款只能处理一次.处理后,该过程的结果将重新用于任何后续处理尝试.

One catch: if you implement both then there's a chance your payments could be processed twice. Take care to ensure that doesn't happen. The application I wrote handles the PDT and IPN almost identically (the backend part is the same) and that code acquires a per-web-user lock in the database, so that if the same user tries to submit the exact same payment multiple times it can only be processed once. Once processed the result of that process is re-used for any subsequent attempts to process it.

编辑还有一件事:IPN 携带的信息比 PDT 多.您可以从 IPN 收到许多不同的消息,例如退款通知等,因此您确实应该实施它.

Edit One more thing: IPN carries more information than PDT. There are lots of different messages that you can receive from IPN, such as chargeback notification, etc, and thus you really should implement it.

PayPal 的 PDT 系统将订单确认发送到使用 PayPal Payments Standard 的商家网站,并让他们验证此信息.然后,此类站点可以在本地的订单确认"页面中显示这些数据.

PayPal's PDT system sends order confirmations to merchant sites that use PayPal Payments Standard and lets them authenticate this information. Such sites can then display this data locally in an "order confirmation" page.

IPN 提供与上述相同的功能.那么,什么时候应该选择 PDT 而不是 IPN?

IPN provides the same capabilities described above. So, when should you choose PDT instead of IPN?

使用 PDT,当客户完成付款时,您的站点会立即收到通知.但是,对于 IPN,客户完成付款与您的网站收到此事件通知之间存在重大延迟.

With PDT, your site is notified immediately when a customer completes payment. With IPN, however, there is a material lag between the time a customer completes payment and the time your site receives notification of this event.

因此,如果您的网站包含需要立即付款通知的功能,请使用 PDT.

So, use PDT if your site includes a feature that requires immediate payment notification.

例如,考虑一家数字音乐商店.使用 PDT,这家商店可以让客户立即下载他们的购买,因为 PDT 会立即发送订单确认.使用 IPN,这种立即订单履行是不可能的.

For example, consider a digital music store. With PDT, this store can let customers download their purchases right away since PDT sends order confirmations immediately. With IPN, such immediate order fulfillment is not possible.

PDT 有一个主要弱点:它只会发送一次订单确认.因此,当 PDT 发送确认时,您的站点必须正在运行;否则,它将永远不会收到消息.

PDT has a a major weakness: it sends order confirmations once and only once. As a result, when PDT sends a confirmation, your site must be running; otherwise, it will never receive the message.

相比之下,使用 IPN,订单确认的交付实际上是有保证的,因为 IPN 会重新发送确认,直到您的站点确认收到.因此,PayPal 建议您实施 IPN 而不是 PDT.

With IPN, in contrast, delivery of order confirmations is virtually guaranteed since IPN resends a confirmation until your site acknowledges receipt. For this reason, PayPal recommends that you implement IPN rather than PDT.

IPN 的另一个优点是它发送多种类型的通知,而 PDT 只发送订单确认.因此,使用 IPN,您的站点可以接收例如退款通知和订单确认.注意:如果您的站点必须立即收到付款通知,您可以同时实施 IPN 和 PDT.但是,如果您这样做,您的站点将收到每次销售的两个订单确认.因此,您必须小心地仅对给定确认消息的一个副本采取行动(例如,运送产品).

Another advantage of IPN is that it sends many types of notifications, while PDT sends just order confirmations. So, using IPN, your site can receive, for example, chargeback notifications as well as order confirmations. Note: If your site must be notified of payments immediately, you can implement both IPN and PDT. However, if you do, your site will receive two order confirmations for each sale. As a result, you must be careful to take action (say, ship a product) on just one copy of a given confirmation message.

文档在这里

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

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