PHP 验证 PayPal 捐赠

发布于 2024-08-16 19:04:04 字数 88 浏览 4 评论 0原文

我如何验证贝宝捐款?

在用户面板中我有一个捐赠按钮。一旦有人真正捐款,我就想为他做点什么。但我不知道如何检查用户是否实际捐赠或只是单击了捐赠按钮。

How can I verify a paypal donation?

In the user panel I have a donate button. And once someone actually donates I want to do something to him. But I do not know how to check if the user actually donated or just clicked the donate button.

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

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

发布评论

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

评论(3

笔落惊风雨 2024-08-23 19:04:04

查看 Paypal 的 IPN(即时付款通知)

当有人向您的 Paypal 帐户付款或捐款时,Paypal将向您的网络服务器发送一条包含所有付款详细信息的帖子消息。然后,您可以向 Paypal 发回一条消息,以确保付款是真实的...

甚至还有一些 贝宝网站上的代码示例。其中包括一个用于 PHP 的。

请注意,您必须先启用 IPN 并在您的 PayPal 帐户中定义回调 URL,然后才能开始使用 IPN。

Look in to Paypal's IPN (Instant Payment Notification)

When someone makes a payment or donation to your Paypal account, Paypal will send a post message to your web server with all the payment details. You can then send a message back to Paypal to make sure that the payment was real...

There are even some code examples on paypal's website. Including one for PHP.

Note you have to enable IPN and define the call back URL in your paypal account before you can start using IPN.

蝶…霜飞 2024-08-23 19:04:04

在同一手册中。然而,这可能有点困难,因为您将需要一个接收付款信息的 PHP 脚本。

返回网址 – 让人们返回您网站上的页面(如果他们
单击返回链接或按钮
PayPal 付款确认页面。

要了解更多信息,请参阅第 2 页的步骤 2 – 指定高级功能
您的捐赠按钮或 HTML
用于显示 PayPal 的变量
结账页面。

自动返回 – 让 PayPal 自动将用户返回到您的页面
网站。
重要提示:PayPal 建议您开启付款数据传输
当您打开自动返回时。和
自动返回,PayPal 重定向
人们从以下位置访问您的网站
替代贝宝付款
确认页面没有
显示查看可打印收据链接,
所以人们无法打印 PayPal 付款
收据。支付数据传输
提供交易信息
你需要让人们打印
来自您网站的收据。

要了解更多信息,请参阅自动返回。

付款数据传输 – PayPal 包含有关
当您使用时完成的交易
返回 URL 或自动返回发送
人们回到您的网站。使用
付款数据传输的信息
提供显示“谢谢,
打印您的收据”页面
网站。

要了解更多信息,请参阅开发者上的付款数据传输页面
中央。

It's in the same manual. It may be a bit tougher to do however, as you will need a PHP script that receives the payment info.

Return URL – Let people return to a page on your website if they
click a return link or button on the
PayPal payment confirmation page.

To learn more, see Step 2 of Page 2 – Specifying Advanced Features
of Your Donate Button or HTML
Variables for Displaying PayPal
Checkout Pages.

Auto Return – Have PayPal return people automatically to a page on your
website.
Important: PayPal recommends that you turn Payment Data Transfer on
when you turn Auto Return on. With
Auto Return on, PayPal redirects
people to your website from an
alternative PayPal payment
confirmation page that does not
display a View Printable Receipt link,
so people cannot print PayPal payment
receipts. Payment Data Transfer
provides the transaction information
that you need to let people print
receipts from your website.

To learn more, see Auto Return.

Payment Data Transfer – PayPal includes information about the
completed transaction when you use a
return URL or Auto Return to send
people back to your website. Use the
information that Payment Data Transfer
provides to display a “thank you,
print your receipt” page on your
website.

To learn more, see the Payment Data Transfer page on Developer
Central.

若相惜即相离 2024-08-23 19:04:04

有两种方法可以检查捐赠者的捐赠情况:

1)使用“notify_url”参数(安全)

2)使用“return”参数(不安全)

代码示例:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">

    <!-- Identify your business so that you can collect the payments. -->
    <input type="hidden" name="business"
        value="[email protected]">
    <input type="hidden" name="bn" value="mbjtechnolabs_SP">
    <!-- Specify a Donate button. -->
    <input type="hidden" name="cmd" value="_donations">

    <!-- Specify details about the contribution -->
    <input type="hidden" name="item_name" value="Friends of the Park">
    <input type="hidden" name="item_number" value="Fall Cleanup Campaign">
    <input type="hidden" name="amount" value="25.00">
    <input type="hidden" name="currency_code" value="USD">

    <!-- Display the payment button. -->
    <input type="image" name="submit" border="0"
    src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif"
    alt="PayPal - The safer, easier way to pay online">
    <img alt="" border="0" width="1" height="1"
    src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" >
</form>

当有人进行捐赠时,捐赠者会自动重定向到返回网址,但此选项并不安全,因为可能有人直接打开此网址。

了解捐赠者捐赠的最佳方式是选择 paypal notification_url 参数。

PayPal 将向notify_url 发送post 请求。

There are two way to check donor made donation:

1) used "notify_url" parameter (safe)

2) used "return" parameter ( unsafe)

Code example:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">

    <!-- Identify your business so that you can collect the payments. -->
    <input type="hidden" name="business"
        value="[email protected]">
    <input type="hidden" name="bn" value="mbjtechnolabs_SP">
    <!-- Specify a Donate button. -->
    <input type="hidden" name="cmd" value="_donations">

    <!-- Specify details about the contribution -->
    <input type="hidden" name="item_name" value="Friends of the Park">
    <input type="hidden" name="item_number" value="Fall Cleanup Campaign">
    <input type="hidden" name="amount" value="25.00">
    <input type="hidden" name="currency_code" value="USD">

    <!-- Display the payment button. -->
    <input type="image" name="submit" border="0"
    src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif"
    alt="PayPal - The safer, easier way to pay online">
    <img alt="" border="0" width="1" height="1"
    src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" >
</form>

When some one made donation donor automatically redirect to return url but this option is not safe because may be some one direct open this url.

best way to know donor made donation choose paypal notify_url parameter.

PayPal will send post request to notify_url.

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