PayPal 捐赠按钮付款后重定向 [英] PayPal Donate Button Redirect After Payment
问题描述
我知道如何在付款后使 PayPal 捐赠按钮重定向,但我需要知道的是,您能否通过此重定向传递已支付的金额.所以它会重定向到 http://example.com/donate?amount=123
,这甚至可能吗?谢谢!
看来我可以用 IPN(?) 做到这一点,我只是不知道如何使用 paypal 的 IPN,有人可以帮助我吗?(是的,我已经阅读了文档,它们令人困惑)
是的,有可能,就像这样:
<!-- 您设置贝宝按钮的地方:--><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'] 变量.
I know how to make a PayPal donate button redirect after payment, but what I need to know is, can you pass the payed amount through this redirection. So it would redirect to http://example.com/donate?amount=123
, is this even possible?
Thanks!
EDIT: It seems I can do it with IPN(?), I just don't know how to use paypal's IPN, can anyone help me? (yes I have read the docs, they are confusing)
yes it is possible, like so:
<!-- where you setup your paypal button : -->
<input type="hidden" name="return" value="http://example.com/donate?amount=<?php echo $amount ?>" />
But (concerning security)
It would be better to keep it in e.g. $_SESSION['amount']
along with a reference id $_SESSION['reference_id'] = md5('whatever you like' . 'plus salt');
And in the paypal button use that reference_id like so:
<input type="hidden" name="return" value="http://example.com/donate?ref=<?php echo $_SESSION['reference_id'] ?>" />
And then, if $_GET['ref'] == $_SESSION['reference_id']
, then you can use the $_SESSION['amount'] variable.
这篇关于PayPal 捐赠按钮付款后重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!