简体   繁体   English

使用贝宝付款信息

[英]Payment info using paypal

I have Integrated Paypal using php. 我已经使用php集成了Paypal。 I know there is return url ,that means when payment is received it will return to the url for our website. 我知道这里有返回网址,这意味着当收到付款时,它将返回我们网站的网址。
My Question is if payment is received and due to internet problem it does not return to our web page, how do I know that payment is received from a particular user? 我的问题是,是否已收到付款,并且由于互联网问题而无法返回我们的网页,我如何知道已从特定用户收到付款?

If there is a network issue and PayPal cannot issue the IPN message, then according to their documentation, they will retry 15 times up to 4 days. 如果存在网络问题,并且PayPal无法发布IPN消息,则根据他们的文档,他们将重试15次,最多4天。

The IPN message service does not assume that your listener will receive all IPN messages. IPN消息服务不假定您的侦听器将收到所有IPN消息。 Because the Internet is not 100% reliable, IPNs can get lost or be delayed. 由于Internet并非100%可靠,因此IPN可能会丢失或延迟。 To address these issues, the IPN message service includes a retry mechanism that re-sends a message at various intervals until your listener acknowledges receipt . 为了解决这些问题, IPN消息服务包括重试机制,该机制以各种间隔重新发送消息,直到您的侦听器确认收到为止 An IPN message may be present up to four days after the original was sent. 在发送原始IP地址后的四天内,可能会出现IPN消息。 The maximum number of retries is 15. 最多可重试15次。

https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNIntro/ https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNIntro/

This item below might help. 下面的此项可能会有所帮助。 Instant Payment Notification should work, but in the case of a network failure, if the payment reached PayPal but the purchaser did not get back to your site to complete a purchase, then you should still receive an email from PayPal telling you that you have received a payment. 即时付款通知应该可以正常工作,但是在网络故障的情况下,如果付款已到达PayPal,但购买者没有回到您的网站来完成购买,那么您仍然应该收到PayPal的电子邮件,告知您已经收到付款。

using paypal button - can my webpage tell if paypal transaction was successful or not? 使用贝宝按钮-我的网页可以判断贝宝交易是否成功吗?

You get a confirmation email with their name and email address - be aware that occasionally this may not be the user's current, most active email address. 您会收到一封确认电子邮件,其中包含他们的姓名和电子邮件地址-请注意,有时候这可能不是用户当前最活跃的电子邮件地址。 You can also log in to your PayPal dashboard to see all details as well, of course. 当然,您也可以登录贝宝(PayPal)仪表板以查看所有详细信息。

You can look up your payment details from the email and compare them to your own user records in your database. 您可以从电子邮件中查找付款详细信息,并将其与数据库中您自己的用户记录进行比较。 If the email they use for PayPal is not the same as the one they registered on your site with, you can still look up their name from the email - in practice it seems to happen extremely rarely that payments have such a problem in my personal experience 如果他们用于PayPal的电子邮件与他们在您的网站上注册的电子邮件不同,您仍然可以从电子邮件中查找他们的名字-在实践中,付款的问题在我个人经历中似乎很少发生

I set up a script which emails my users with a passcode to get to the online product they bought which is emailed to them so they can submit that later along with their email address. 我设置了一个脚本,该脚本通过密码向我的用户发送电子邮件,以获取他们购买的在线产品,并通过电子邮件发送给他们,以便他们以后可以将其连同其电子邮件地址一起提交。 This is the first thing that happens on return to my script so at least if the site fails to respond properly they can get to what they bought later. 这是返回我的脚本时发生的第一件事,因此,至少如果该站点无法正确响应,他们就可以在以后购买到它们。

The script uses PHPMailer and cc's me with their passcode so I have it available to re-send to them if they write with a complaint. 该脚本使用PHPMailer和cc是我以及他们的密码,因此如果他们写信投诉,我可以将其重新发送给他们。 It doesn't help if the PayPal return for Instant Payment Notification fails completely but the other answers cover that very fully and detail the PayPal repeat attempt process well. 如果“即时付款通知”的PayPal退货完全失败没有帮助,但是其他答案非常完整,并且详细说明了PayPal重试过程。

Instant Payment Notification scripts can be downloaded from PayPal for modification by yourself as per the article linked to above. 可以从贝宝(PayPal)下载即时付款通知脚本,以根据上面链接的文章由您自己进行修改。

To be perfectly honest, this is one of PayPal Standard's largest holes. 老实说,这是PayPal Standard最大的漏洞之一。 IPN is a POST callback (as is PDT) and they check to make sure they get a 200 response or else they retry (and you can use the IPN history in your PayPal account to resend missing IPNs). IPN是POST回调(与PDT一样),它们会检查以确保得到200响应,否则会重试(您可以使用PayPal帐户中的IPN历史记录重新发送丢失的IPN)。 But this method still relies on you getting the callback in a timely manner and it's not foolproof. 但是此方法仍然依赖于您及时获取回调,并且它不是万无一失的。 Worse, you need to verify the IPN call and that introduces yet another point of failure in calling PayPal to make sure they did indeed send you the IPN you got. 更糟糕的是,您需要验证IPN呼叫,这会在调用PayPal时引入另一个故障点,以确保它们确实向您发送了您获得的IPN。

There's a couple of ways to deal with this 有两种方法可以解决这个问题

  1. Audit your account regularly. 定期审核您的帐户。 This is a good idea in general, but for a small website this shouldn't be terribly hard. 一般来说,这是个好主意,但是对于小型网站而言,这并不难。 Match your invoices up to your PayPal payments. 将您的发票与您的PayPal付款进行匹配。 Obviously this doesn't scale well so... 显然这不能很好地扩展,所以...
  2. Switch to Payments Pro. 切换到Payments Pro。 There's more hurdles to this (like more PCI compliance, SSL certificate, etc) but the major advantage is that the API is far less susceptible to the whims of the Internet and only involves one call for credit cards (you can ignore the IPN because the API tells you everything you need to know). 这样做还有更多障碍(例如,更多的PCI合规性,SSL证书等),但是主要优点在于,该API不太容易受到Internet异想天开的影响,而只涉及一次信用卡呼叫(您可以忽略IPN,因为API会告诉您所有您需要了解的内容。 The worst that can happen is you send a payment API call and fail to get a response. 可能发生的最糟糕的情况是,您发送了付款API调用,但未得到响应。 This is exceptionally rare as PayPal makes sure their API is 99.9% reliable (IPN relies on your server being reliable). 这是非常罕见的,因为PayPal确保其API的可靠性为99.9%(IPN依赖于服务器的可靠性)。 Speaking from experience, Payments Pro has far fewer issues than IPN does. 从经验来看,Payments Pro的问题远少于IPN。

In your application, you should have a status field for orders. 在您的应用程序中,您应该有一个订单状态字段。 If you haven't received the ipn, you wouldn't change the status to Paid . 如果您尚未收到ipn,则不会将状态更改为付费

After that, if you receive an email from Paypal that someone has paid, check the order number, and change the status manually. 此后,如果您收到来自Paypal的电子邮件,表明有人已经付款,请检查订单号,然后手动更改状态。

how do I know that payment is received from a particular user? 我怎么知道从特定用户处收到付款?

Paypal will send an email both user and you. 贝宝将向用户和您发送电子邮件。

Paypal offers 2 solutions for your problem. 贝宝为您的问题提供2种解决方案。

  1. PayPal IPN - it notifies the server with a POST request to a specific URL, whena transaction has been successful, declined, aborted by user and so on. PayPal IPN-当交易成功,被拒绝,被用户中止等等时,它会向特定URL发出POST请求来通知服务器。 Paypal provide an IPN Simulator (the worst simulator ever) in order to test its functionality. 贝宝提供IPN模拟器(有史以来最糟糕的模拟器)以测试其功能。 you may give it a try at : https://developer.paypal.com/developer/ipnSimulator/ 您可以在以下网址尝试一下: https : //developer.paypal.com/developer/ipnSimulator/
  2. Paypal WebHooks - The webhooks are the "New Kid in the Block",they are basically "user-defined HTTP callbacks that receive events for the subscribed event types. Webhooks are asynchronous, the order is not guaranteed, and idempotency may lead to the same event being sent more than once." Paypal WebHooks-Webhooks是“块中的新手”,它们基本上是“用户定义的HTTP回调,用于接收订阅的事件类型的事件。Webhooks是异步的,不能保证顺序,并且幂等可能导致相同的结果活动被多次发送。” as stated in the Paypal documentation. 如Paypal文档中所述。 You can read more about it on : https://developer.paypal.com/docs/integration/direct/rest-webhooks-overview/ 您可以在以下网址了解更多信息: https : //developer.paypal.com/docs/integration/direct/rest-webhooks-overview/

For any further help, comment below and I shall try to help. 如需其他帮助,请在下面评论,我将尽力提供帮助。

Cheers, 干杯,

您必须为此使用notify_url

<input type="hidden" name="notify_url" value="https://domain-name.com/ipn.php">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM