如何将要支付的总金额发送给贝宝 [英] How to send the total amount to be paid to paypal

查看:101
本文介绍了如何将要支付的总金额发送给贝宝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用<input type="hidden" name="amount" value="{$total}">发送要由客户支付的总金额,其中{$total}保存总金额(聪明),但是当我单击paypal的立即购买"按钮时,它显示要支付的金额为0.00 .怎么了?我的代码是:

I am trying to send the total amount to be paid by the customer with <input type="hidden" name="amount" value="{$total}"> where {$total} holds the total amount(smarty) but when I click buy now button of paypal,it shows amount to be paid as 0.00 . Whats wrong ?My code is :

Total :
{$total}

<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="SVXVEBF9CH4YU">

<input type="hidden" name="amount" value="{$total}">

<input type="image" src="https://www.paypalobjects.com/en_GB/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.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>

我正在localhost中对其进行测试,这是否会造成此问题?

I am testing it in localhost,is this creating that problem ?

推荐答案

之所以无法动态覆盖金额,是因为您拥有所谓的"PayPal托管按钮".
使用托管按钮,金额存储在PayPal一侧,并且不能用'amount'变量覆盖. 您可能想要使用非托管按钮(如Peter Szymkowski在其答案中使用的按钮),或者使用

The reason you can't override the amount dynamically, is because you have a so-called 'PayPal hosted button'.
With a hosted button, the amount is stored on PayPal's side and can't be overwritten with the 'amount' variable. You'll either want to use a non-hosted button (as Peter Szymkowski is using in his answer), or use the BMUpdateButton API call to dynamically update the button's amount.

对BMUpdateButton的示例请求如下所示:

An example request for BMUpdateButton would look as follows:

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

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

Similary, you could also use the BMCreateButton API to create a new button, or use the BMButtonSearch API to search through a list of all your stored hosted buttons (to find the hosted_button_id of your button automatically, for example)

使用托管按钮的原因是因为它更安全.一个非托管,未加密的按钮将基本上使数量不受控制.欺诈交易等待发生.

The reason to use a hosted button is because it's more secure. A non-hosted, unencrypted button would basically leave the amounts open to manipulation. Fraudulent transactions waiting to happen.

这篇关于如何将要支付的总金额发送给贝宝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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