按钮将会话变量传递给贝宝

按钮将会话变量传递给贝宝

本文介绍了如何使用“立即购买"按钮将会话变量传递给贝宝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我的用户登录时,将其用户名和用户ID保存在会话变量中时,他们可以使用Paypal捐款.使用简单的立即购买按钮,您可以在Paypal上简单生成.

When my users are logged in with their username and userid saved in the session variable they can donate using paypal. With the simple buy now button that you can simply generate at paypal.

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="XXX">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

付款成功后,会将所有_POST数据发送到我的Confirm_payment.php中.我可以使用他们支付的邮件,并将其与我的用户数据库进行比较,以找到正确的用户,但是我不能确定他们是否对贝宝和我的网站使用相同的电子邮件.

When they payment is successful they are sent to my confirm_payment.php with all the _POST data. I can use the mail they paid with and compare this with my user database to find the correct user, but I can't be sure that they use the same email for paypal and my site.

我需要将$ _SESSION ['username']传递给Paypal,以便可以使用此信息自动为用户提供捐赠者身份.我可以添加类似以下内容:

I need to pass the $_SESSION['username'] to paypal so I can use this information to give my users donator status automatically. Can I add something like:

<input type="hidden" name="custom" value="custom variable">

输入我的按钮代码?以下是有关可用变量的更多信息:贝宝信息

to my button code? Here is more info on the variables avaliable paypal info

推荐答案

是的,您可以这样添加,这是正确的方法,当paypal ping您回到IPNHandler时,您将获得的值该custom隐藏字段在查询字符串中具有相同的名称.

yes you can add like this, this is the correct way, and when paypal pings you back on IPNHandler then you'll get the value of this custom hidden field in querystring with the same name.

这篇关于如何使用“立即购买"按钮将会话变量传递给贝宝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 20:17