不能在paypal沙箱中POST项目价格

时间:2012-02-24 22:17:15

标签: paypal sandbox

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="YYHZM9FTBZQGW">
<input type="hidden" name="amount" value="20.00">
<input type="image" src="https://www.sandbox.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.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

这是一个贝宝沙盒按钮。我想要做的就是发布用户在我的网站上购买的所有产品的总价格。

我创建了一个没有任何内容发布的按钮,因为基本上我想在将来使用php变量动态发布,所以我认为我不需要在沙箱创建按钮功能中设置项目价格,名称,数量。我怎么想这样做。

paypal sandbox

这是输出。我希望商品价格与描述和数量相同,不可编辑

1 个答案:

答案 0 :(得分:2)

您无法动态覆盖金额的原因是因为您有一个所谓的“PayPal托管按钮”。
使用托管按钮,金额存储在PayPal一侧,不能用'amount'变量覆盖。 您要么使用非托管按钮,要么使用BMUpdateButton API调用动态更新按钮的金额。

BMUpdateButton的示例请求如下所示:

USER=Your API username
PWD=Your API password
SIGNATURE=Your API signature
VERSION=82.0
HOSTEDUBTTONID=The value of <input type="hidden" name="hosted_button_id" value="">
BUTTONTYPE=The type of button. E.g. BUYNOW
BUTTONCODE=The type of code you want to get back. E.g. HOSTED
L_BUTTONVAR0=amount=The new amount with a period as separator
L_BUTTONVAR1=item_name=Optional: a new item name if you wish

同样,您也可以使用BMCreateButton API创建新按钮,或使用BMButtonSearch API搜索所有已存储托管按钮的列表(以查找按钮的hosted_button_id)自动,例如)

使用托管按钮的原因是因为它更安全。非托管的,未加密的按钮基本上会使金额处于操纵状态。欺诈性交易等待发生。