Andreas2003 Posted May 26, 2010 Posted May 26, 2010 (edited) Hello together, I have a big problem with the PayPal module, which is included in the RC2a osCommerce files. Filename is "paypal_standard.php". During my first test in paying with Paypal, I received the following error message: The link that you have accessed the PayPal system contains an incorrectly formatted amount for the item. (Sorry, message translated, not the original message). I tried to find the error. In the function "process_button" in line 285, there is the 'amount' definition included in the parameters array. 'amount' => $this->format_raw($order->info['total'] - $order->info['shipping_cost'] - $order->info['tax']), First I tried to fix the amount by this line: 'amount' => '1.10'), which was working. Then I tried the parts of the definition: 'amount' => $this->format_raw($order->info['total']), and 'amount' => $this->format_raw($order->info['total'] - $order->info['shipping_cost']), where both were working too. So, it seems, that there is an error in the tax definition. Then I tried: 'amount' => $this->format_raw($order->info['total'] - $order->info['shipping_cost'] - '1.10'), and received the error message again. Even this was not working: 'amount' => $this->format_raw($order->info['total'] - $order->info['shipping_cost'] - '1'), On the other hand, this was working too: 'amount' => $this->format_raw($order->info['total'] - $order->info['tax']), All trials with changing the formula of amount calculation leads towards the paypal login with no error message, but of course the values mentioned on the paypal site are incorrectly calculated. Can anyone give me some hints, how to solve this ? Thank you very much in advance and sorry for my english. Regards Andreas Edited May 26, 2010 by Andreas2003 Quote
Andreas2003 Posted May 26, 2010 Author Posted May 26, 2010 So, new insight. Now I let me print out all partial values. With that I found out, that the result of the original formula is negative ! So PayPal is not complaining because of the formatting, but because of the value. Here are my example values: Item value: 0.59 Shipping: 4 Total: 4.59 included Tax: 0.73 Result with original code: -0.14 (4.59 - 4 - 0.73) In the PayPal Integration Guide, the 'amount' definition is as follows: Price of the item or the total price of all items in the shopping cart. Thus, the formula would still be correct with: 'Amount' => $ this-> format_raw ($ order-> info ['total'] - $ order-> info ['shipping_cost']), Total = 4.59 and since shipping = 4.00, so I would be the correct item value = 0.59. But with that, Paypal shows me: Total value: € 0.59 Tax: € 0.73 Total: € 4.00 Total including shipping: € 5.32 EUR But then, in the total from last line, the tax reduction is missing. On the other hand, if I comment out the 'tax' definition, then the result is : Total value: € 0.59 Total: € 4.00 Amount: € 4.59 EUR That would be correct, but the tax must still be identified correctly, so this way does not work. Was there a change in PayPal 'amount'-definition, without changing the integration help (see link)? Gained some more experience, but still no breakthrough. Any help appreciated, Regards Andreas Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.