Paypal错误:项目金额格式不正确

时间:2011-08-04 10:35:01

标签: php currency paypal paypal-sandbox

我遇到了一个来自贝宝的奇怪问题。当我的购物车传递带小数位的值(如1.15)时,它不起作用并显示错误:您用于进入Pay​​Pal系统的链接包含格式错误的项目金额。

这是无数十进制数的输出:

paypal_class->dump_fields() Output:

Field Name     Value
amount_1       70.00 
business       xxxxxxxxxxxxxxxx
cancel_return  xxxxxxxxxxxxxxxxxx
cmd            _cart 
currency_code  HUF 
invoice        171SPLINTERCELLCONVICTIONxxxxxxxxxxxxxxxxxxx
item_name_1    Apple 
item_number_1  211 
notify_url     xxxxxxxxxxxxxxxxxxxxxxxx
on0_1          Option 
os0_1          Default 
quantity_1     1 
return         xxxxxxxxxxxxxxxxxxxxxxxxx
rm             2 
shipping_1     5 
tax_cart       0.00 
upload         1 

这是带小数位的输出不起作用(出于安全原因,我删除了一些变量)。

paypal_class->dump_fields() Output:

Field Name     Value
amount_1       70.15 
business       xxxxxxxxxxxxxxxxxx
cancel_return  xxxxxxxxxxxxxxxxxxx
cmd            _cart 
currency_code  HUF 
invoice        172SPLINTERCELLCONVICTIONxxxxxxx
item_name_1    Apple 
item_number_1  211 
notify_url     xxxxxxxxxxx 
on0_1          Option 
os0_1          Default 
quantity_1     1 
return         xxxxxxxxxxx 
rm             2 
shipping_1     5 
tax_cart       0.00 
upload         1 

并且它不仅适用于三种货币: 匈牙利福林, 日圆, 台湾新元。

有任何帮助吗?将不胜感激。

2 个答案:

答案 0 :(得分:1)

您的应用程序应通过您正在使用的课程将正确的货币格式传递给PayPal。

因此,如果您将数据存储为数据库中的十进制数(例如美元),但访问者将其区域设置/查看首选项设置为日元,那么您的应用程序应相应地转换价格(在这种情况下为整数)没有小数位),然后应该传递给你的PayPal类。

答案 1 :(得分:0)

这三种货币没有小数值。每当你输入小数值时,paypal都会显示错误。因此,尝试舍入值(10.25到10或11)。

相关问题