Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Problem with PayPal Standard RC2a module and tax deduction in 'amount'-definition.


Recommended Posts

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']),


'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.




Edited by Andreas2003
Link to comment
Share on other sites

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,



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...