在 PHP 中结帐后获取 PayPal 确认,无需框架

发布于 2024-09-14 15:21:15 字数 610 浏览 2 评论 0 原文

我曾经有一个“立即购买”按钮,可以通过 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!

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

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

发布评论

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

评论(1

一身仙ぐ女味 2024-09-21 15:21:15

我对此类事情没有任何经验,但谷歌向我展示了一些可能的相关链接此处此处此处。

其主页是 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

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