1

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

这是没有十进制数字的输出,有效:

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 

它不适用于三种货币:匈牙利福林、日元、新台币。

有什么帮助吗?将不胜感激。

4

2 回答 2

1

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

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

于 2011-08-05T22:27:30.090 回答
0

这三种货币没有十进制值。每当您输入十进制值时,paypal 都会显示错误。所以尝试将值四舍五入(10.25 到 10 或 11)。

于 2011-08-05T21:06:50.203 回答