use*_*353 3 paypal donations urlvariables
我有一个捐赠按钮,供用户输入捐款金额.我想用按钮发送金额.我可以在按钮设置中的添加高级变量中输入金额= 1.00 - 工作正常.但是,我没有成功将金额作为URL的一部分发送.我在PayPal按钮表单中添加了以下行:
<input type="hidden" name="amount" value="9.99" />
Run Code Online (Sandbox Code Playgroud)
但是当我到达PayPal时,金额字段是空白的.有什么想法我做错了吗?
Rob*_*ert 10
如果您正在创建一个所谓的"托管按钮"(即按钮详细信息存储在PayPal端的按钮),则对于https://www.paypal的请求,将忽略"amount"POST参数. com/cgi-bin/webscr.
这是一项安全功能,可防止人们操作amount
传递给PayPal进行结帐.
您可以通过以下数据确定是否使用托管按钮;
托管按钮,将有一个价值cmd
的_s-xclick
,并包括hosted_button_id
参数.
如果是这种情况,则无法通过传入额外的amount
POST参数来更新金额.
但是,因为您正在处理捐赠,并且金额根据定义是灵活的,您实际上并不需要"托管按钮".在按钮创建表单中,关闭"使用PayPal的主机按钮",或编写自己的指向PayPal.
如果这样做,您可以通过amount
POST参数设置金额.
例如,以下工作正常;
<form method="POST" action="https://www.paypal.com/cgi-bin/webscr">
<input type="hidden" name="cmd" value="_donations">
<label for="amount">Amount: </label><input type="text" name="amount" value="">
<input type="submit" name="submit" value="Pay with PayPal">
</form>
Run Code Online (Sandbox Code Playgroud)
小智 7
Robert的解决方案是在正确的轨道上,但是如果没有隐藏的"业务"字段(应该具有与您的PayPal帐户关联的电子邮件地址的值),非托管的PayPal表单将无法运行.
为了彻底性,应包括其他字段:
<input type="hidden" name="business" value="myemail@here.com">
<input type="hidden" name="item_name" value="Donation Description">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="tax" value="0">
Run Code Online (Sandbox Code Playgroud)