我过去一直使用贝宝通过我的网站销售东西(例如会员资格),但我总是必须通过贝宝验证用户是否真的购买了会员资格(例如),然后才能将其分配给他/她的帐户。现在我想知道是否有一种方法可以将贝宝购买按钮放在我的网页上(例如)购买会员资格,然后一旦用户付款,他就会自动在我的网站上分配会员资格(例如有一个页面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
发布评论
评论(1)
您可以使用 PayPal 即时付款通知来接收来自 PayPal 的服务器到服务器通知,您可以随后验证该通知并用于更新您的数据库。
IPN 的工作原理如下:
您可以为网站付款标准指定 IPN 处理程序,如下所示
对于 Express Checkout 或 Website Payments Pro,只需在 SetExpressCheckout/ 中包含以下内容即可分别调用 DoExpressCheckoutPayment 或 DoDirectPayment API。
NOTIFYURL=http://blah.com/ipn.php
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:
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
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.