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
它不仅仅适用于三种货币: 匈牙利福林, 日圆, 新台币。
有什么帮助吗?将不胜感激。
I am encountering a weird problem from paypal. When My shopping cart pass value with decimal places(like 1.15) it does not work and shows me the error:The link you have used to enter the PayPal system contains an incorrectly formatted item amount.
This is the output of without decimal numbers in amount which works:
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
This is the output of with decimal places which does not work(I deleted some of the variables for security reasons).
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
and it does not work for only the three currencies:
Hungarian Forint,
Japanese Yen,
Taiwan New Dollars.
Is there any help? Will be grateful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的应用程序应通过您正在使用的类将正确的货币格式传递给 PayPal。
因此,如果您在数据库中将价格存储为十进制数字(例如美元),但访问者将其区域设置/查看首选项设置为日元,则您的应用程序应相应地转换价格(在本例中为不带小数的整数) places),然后应该将其传递给您的 PayPal 类。
Your application should pass the correct currency format to PayPal via the class you're using.
So if you're storing prices as decimal numbers in your database (as US dollars for example) but a visitor sets their locale/viewing preference to Yen, then your application should convert prices accordingly (and in this case to an integer with no decimal places), which should then be passed to your PayPal class.
这三种货币没有小数。每当您输入小数值时,贝宝都会显示错误。因此,请尝试将值四舍五入(10.25 至 10 或 11)。
These three currencies does not have decimal value. Whenever you put decimal values paypal will show errors. So try to round the values( 10.25 to 10 or 11).