【问题标题】:Paypal Error: incorrectly formatted item amountPaypal 错误:项目金额格式不正确
【发布时间】:2011-08-04 10:35:01
【问题描述】:

我在 paypal 遇到了一个奇怪的问题。当我的购物车传递带有小数位的值(如 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 

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

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

【问题讨论】:

  • 你能用不可读的代码替换图像吗
  • 添加代码代替截图
  • 您使用了什么贝宝优惠?快速结账 ?进化 ?部分国家有限制cms.paypal.com/us/cgi-bin/…

标签: php currency paypal paypal-sandbox


【解决方案1】:

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

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

【讨论】:

  • 我是否需要使用全球化来获得用户区域设置的正确格式?
【解决方案2】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-08-23
    • 1970-01-01
    • 1970-01-01
    • 2016-05-05
    • 2016-10-13
    • 2016-04-08
    • 2013-08-27
    • 2014-08-25
    相关资源
    最近更新 更多