贝宝:尝试使用“捐赠"按钮传递金额 [英] Paypal: trying to pass an amount with a Donation button

查看:118
本文介绍了贝宝:尝试使用“捐赠"按钮传递金额的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设置了一个捐赠"按钮,供用户输入捐赠金额.我正在尝试通过按钮发送一笔金额.我可以在按钮设置的添加高级变量"中输入amount = 1.00-效果很好.但是,我没有成功发送金额作为URL的一部分.我已经在PayPal按钮表单中添加了以下行:

I have a Donate button set up for the user to enter the donation amount. I am trying to send an amount with the button. I can enter amount=1.00 in the Add Advanced Variables in the button setup - that works fine. However, I have had no success sending the amount as part of the URL. I have added the following line to the PayPal button form:

<input type="hidden" name="amount" value="9.99" />

但是当我进入Pay​​Pal时,金额字段为空白.有什么想法我做错了吗?

but the amount field is blank when I get to PayPal. Any thoughts what I am doing wrong?

推荐答案

如果要创建所谓的托管按钮"(即,按钮详细信息存储在PayPal一侧的按钮),则对 https://www.paypal.com/cgi-bin/的请求,将忽略金额"的POST参数webscr .
这是一项安全功能,可以防止人们操纵传递给PayPal的amount进行结帐.

If you're creating a so called 'hosted button' (that is, a button where the button details are stored on the PayPal side), then the 'amount' POST parameter is ignored for requests to https://www.paypal.com/cgi-bin/webscr.
This is a security feature to prevent people from being able to manipulate the amount passed to PayPal for checkout.

您可以通过以下数据来确定您是否正在使用托管按钮;
托管按钮的cmd值为_s-xclick,并包含hosted_button_id参数.

You can identify whether you're using a hosted button by the following data;
Hosted buttons will have a value for cmd of _s-xclick and include the hosted_button_id parameter.

在这种情况下,您无法通过传递额外的amount POST参数来更新金额.

If this is the case, you cannot update the amount by passing in an extra amount POST parameter.

但是,由于您正在处理捐款,而且捐款的定义很灵活,因此实际上您不需要托管按钮". 在按钮创建表单中,关闭带PayPal的主机按钮",或自行编写以指向PayPal.
如果执行此操作,则可以 通过amount POST参数设置金额.

However, because you're dealing with donations and the amount is flexible by definition, you don't in fact need a 'hosted button'. In the button creation form, turn off 'Host button with PayPal', or write your own to point to PayPal.
If you do this, you can set the amount via the amount POST parameter.

例如,下面的方法可以正常工作;

For example, the below works fine;

<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>

这篇关于贝宝:尝试使用“捐赠"按钮传递金额的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆