如何确保网站的贝宝集成安全

发布于 2024-12-05 20:26:24 字数 279 浏览 0 评论 0 原文

我过去一直使用贝宝通过我的网站销售东西(例如会员资格),但我总是必须通过贝宝验证用户是否真的购买了会员资格(例如),然后才能将其分配给他/她的帐户。现在我想知道是否有一种方法可以将贝宝购买按钮放在我的网页上(例如)购买会员资格,然后一旦用户付款,他就会自动在我的网站上分配会员资格(例如有一个页面buy_result.php 分配会员资格,但仅当用户确实通过 paypal 购买时)。我如何确保用户确实通过我网站的退货页面上的 PayPal 购买了该商品?

提前致谢, 天空。

顺便说一句,我希望我的问题能被理解

I have been using paypal in the past for selling stuff through my website ( e.g. memberships ) but I always had to verify through paypal whether the user really bought the membership (for example) before I could assign it to his/her account. Now I was wondering if there's a way that I can put a paypal purchase button onto my webpage to ( for example ) purchase a membership and then once the user paid, he'll automaticly be assigned the membership on my website ( e.g. there's a page purchase_result.php which assigns the membership, but ONLY if the user really bought it through paypal ). How can I make sure the user actually bought the item through paypal on the return page on my website?

Thanks in advance,
Skyfe.

btw, I hope my question can be understood

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

后来的我们 2024-12-12 20:26:24

您可以使用 PayPal 即时付款通知来接收来自 PayPal 的服务器到服务器通知,您可以随后验证该通知并用于更新您的数据库。

IPN 的工作原理如下:

  1. 您创建 PayPal 并包含一个“notify_url”。此参数的值将是服务器上脚本的完整 URL,称为“IPN 脚本”或“IPN 处理程序”。

您可以为网站付款标准指定 IPN 处理程序,如下所示

对于 Express Checkout 或 Website Payments Pro,只需在 SetExpressCheckout/ 中包含以下内容即可分别调用 DoExpressCheckoutPayment 或 DoDirectPayment API。
NOTIFYURL=http://blah.com/ipn.php

  1. 买家通过 PayPal 完成交易
  2. 一旦买家完成交易,他/她可能会关闭浏览器,或返回您的网站
  3. 。被 PayPal 接受并处理后,PayPal 将向 http://blah.com/ipn.php
  4. 您需要采取所有 POST发送到此脚本的数据,并将其 POST 回 https:// www.paypal.com/cgi-bin/webscr?cmd=_notify-validate
  5. 如果您发回的数据与 PayPal 发送给您的数据匹配,则会返回“已验证”响应。
  6. 如果响应已验证,此时您将在您端查找匹配的交易/买家,并相应地更新您的数据库。

PayPal IPN 的一些示例代码和文档位于 https://www.paypal.com/ipn/
此外,有关制作安全 IPN 脚本的一些技巧可在 https://www.x.com/developers/community/blogs/ppmtsrobertg/securing-your-instant- payment-notification-ipn-script

注意:如果您想在交易中包含任何自定义数据以便稍后读出,请使用“自定义”。

这也将在从 PayPal 发送的 IPN POST 数据中返回。

You would PayPal Instant Payment Notifications to receive a server-to-server notification from PayPal which you can subsequently verify and use to update your database.

IPN works as follows:

  1. You create the PayPal and incude a "notify_url". The value for this parameter will be the full URL to a script on your server, called the 'IPN script' or 'IPN handler'.

You can specify an IPN handler as follows for Website Payments Standard
<input type="hidden" name="notify_url" value="http://blah.com/ipn.php

For Express Checkout or Website Payments Pro, simply include the following in your SetExpressCheckout/DoExpressCheckoutPayment or DoDirectPayment API call respectively.
NOTIFYURL=http://blah.com/ipn.php

  1. A buyer completes a transaction via PayPal
  2. Once the buyer completes the transaction, he/she may close the browser, or return to your website
  3. Once the transaction is accepted and processed by PayPal, PayPal will send out a notification to http://blah.com/ipn.php
  4. You need to take all POST data that was sent to this script, and POST it back to https://www.paypal.com/cgi-bin/webscr?cmd=_notify-validate
  5. If the data you send back matches the data PayPal sent you, a 'VERIFIED' response is returned.
  6. If the response is VERIFIED, it's at this point that you would look up the matching transaction/buyer on your end, and update your database appropriately.

Some sample code and documentation for PayPal IPN is available at https://www.paypal.com/ipn/
In addition, some tips on making a secure IPN script are available at https://www.x.com/developers/community/blogs/ppmtsrobertg/securing-your-instant-payment-notification-ipn-script

Note: If you want to include any custom data along with the transaction which you can read out later, use 'custom'.
<input type="hidden" name="custom" value="xxxxx">
This will also be returned in the IPN POST data sent from PayPal.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文