我曾经有一个“立即购买”按钮,可以通过 PayPal 进行操作,然后,通过该按钮的高级选项,我将用户重定向到“成功”页面,该页面将提供他们购买的产品的序列号。
显然,这个页面必须通过 PayPal 提供的变量从 PayPal 获得确认,以便知道付款实际上已被处理,而不仅仅是某人在浏览器中输入页面 URL 来获取序列号。
我只在 PHP 中完成此操作,没有下载任何 API,据我所知,使用 PayPal 的 $_POST 或 $_SERVER 变量。有几个嵌套的“if”,但最终效果很好。
现在我已经在谷歌上搜索了一个小时试图找到我使用的代码。我找到的只是框架下载和臃肿的API,而我实际上只需要知道这些事情:
我有一个空白的 PHP 文件等待建议。在虚拟伪代码中,它会围绕以下内容:
<?php
$serial = ...;
if ($paypal_succeeded)
{
echo($serial);
}
?>
请不要告诉我这是不可能的,我知道我已经做到了,我只是丢失了旧代码。
谢谢!
I used to have a "Buy Now" button that would go through PayPal, and then, through the button's advanced option, I redirected the users to a "Success" page that would give the serial for the product they purchased.
Obviously, this page had to get confirmation from PayPal, through the variables PayPal gave it, in order to know that a payment had actually been processed, and not only some person typing the page's URL in his browser to get a serial.
I did this only in PHP, without downloading any API, using, as far as I can remember, $_POST or $_SERVER variables from PayPal. There were a couple of nested "if"s, but in the end, it worked fine.
Now I've been Googling for an hour trying to find the code I used. All I find is framework downloads and bloated APIs, while I really only need to know these things:
- Did the order process?
- What is the email of the buyer?
I have a blank PHP file waiting for suggestions. In dummy-pseudo-code, it would go around the lines of:
<?php
$serial = ...;
if ($paypal_succeeded)
{
echo($serial);
}
?>
Please don't tell me this is impossible, I know I already did it, I just lost my old code.
Thanks!
发布评论
评论(1)
我对此类事情没有任何经验,但谷歌向我展示了一些可能的相关链接此处、此处和此处。
其主页是 https://www.paypal.com/ipn
I don't have any experience with this sort of thing, but google showed me a few possible relevant links here, here, and here.
The main page for this was https://www.paypal.com/ipn