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_ret开发者_运维百科urn 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.
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.
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).
精彩评论