gpt4 book ai didi

php - PayPal 捐赠按钮付款后重定向

转载 作者:太空宇宙 更新时间:2023-11-03 15:46:49 24 4
gpt4 key购买 nike

我知道如何在付款后重定向 PayPal 捐赠按钮,但我需要知道的是,您能否通过此重定向传递已支付的金额。所以它会重定向到 http://example.com/donate?amount=123,这可能吗?谢谢!

编辑:看来我可以使用 IPN(?),我只是不知道如何使用 paypal 的 IPN,有人可以帮助我吗? (是的,我已经阅读了文档,它们令人困惑)

最佳答案

是的,这是可能的,就像这样:

<!-- where you setup your paypal button : -->
<input type="hidden" name="return" value="http://example.com/donate?amount=<?php echo $amount ?>" />

但是(关于安全)

最好将其保存在例如$_SESSION['amount'] 以及引用 ID $_SESSION['reference_id'] = md5('whatever you like' . 'plus salt');

然后在 paypal 按钮中使用 reference_id,如下所示:

<input type="hidden" name="return" value="http://example.com/donate?ref=<?php echo $_SESSION['reference_id'] ?>" />

然后,如果 $_GET['ref'] == $_SESSION['reference_id'],那么您可以使用 $_SESSION['amount'] 变量。

关于php - PayPal 捐赠按钮付款后重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9382985/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com