Jump to content

[SOLVED] Paypal Error (Value differs fom Cart Value after completing order)


Recommended Posts

Hi - we have noticed that carts that are completed with payment by Paypal are being completed with an unusal error.

The cart say value £61.24 and paypal sends us £61.23.

the penny difference is nothing for us to worry about - how ever it shows up on the order
as:

Warning £61.23 paid instead of £61.24.

the customer also emails us to ask to confrim payment as in their account it shows as "Payment Error"

on several other completed orders there has alway been 1 pence difference in payment that the that of the cart.

This error has only started over the last 6 or 7 Paypal payments.


So has anyone any ideas as to


A) its cause

and

B) how to resolve it.



Hope someone can help

As always thanking you in advance for any help and assistance given.

Regards

Ian

Link to comment
Share on other sites

Hi Again,

Further to our previous post - we thought we better advise that we undertook a test purchase (not to final completing) but into the paypal account for payment and the correct values did show both for cart and payment request.

So we now unsure as to if their is a problem or the customer has simply paid the wrong amount.

so any further help on this is still required just in case there is a blip in the system.

Thank you

Ian

Link to comment
Share on other sites

Hello Again,

We now seem to have found the error - perhaps it is an error of Prestacart not adding the correct values.

As you can see from below the amounts
24.11 + 24.62 actually add up to 48.73
But PS cart adds them to 48.74 which is 1 pence value to much.

So although PS cart shows value 48.74 it actually advises paypal that the value is 48.73 (+ shipping as shown below.



£24.11 1 1 £24.11

£24.62 1 1 £24.62
Total products: £48.74
Total shipping: £12.50
Total: £61.24



So with this in mind Boys and Girls - does anyone have an idea as to why the cart adds up the individual values wrongly.

Hope someone can help

Regards

Ian

Link to comment
Share on other sites

OK - so we have more to report on this subject.

It now seems that the carts raised and paid for bu paypal where there is a payment error also causes another fault in Prestshop.

We have now found that even after changing the value to "Payment Accepted" that the cart fails to remove the stock qty from the data base.

So to recap.

!) payment value in the cart increases by 0.01 pence when two or more products are purchased.
2) payment is received via paypal with 0.01 pence less than cart value (which actually the correct value)
3) the system show to us and customer that their is a payment error
4) to correct payment error - change the value to "Payment accepted"
5) the PS FO does not change stock values - this has now to be done manually???

Does anyone know what is causing this to happen - perhap a PS team player can assist.

Regards


Ian

Link to comment
Share on other sites

OK - some intersting data for those who are following this post.

We have traced the possible error down to the products page.

VAT Value

and Retail Price with VAT Value.

although we type in 24.62 for the RP with Vat price after updatin the product page the system fro reasons unknown, re-calculate the RP with VAT price which is dependant on the VAT Value.

As there is 6 decimal places if the value becomes (say for example) 24.623786 for the 1st item.

And a 2nd item is 24.114789 then the cart seems to add all values (48.738575) to get to 48.74 going for the higher figure as a round off value. Although each piece actuall costs 24.62 & 24.11 which give a true value of 48.63 which is why the paypal value is 0.01 pence short of the cart value.

So the obvious question is this.

Can the prices (in our case and most others we would think) be shown only with 2 decimal points rather than the 6 being used now.

Can any one advise if it can be changed and if so, where to do this.

Regards

Ian

Link to comment
Share on other sites

Hi - We seem to have now resolved this issue after scolling the Forum (using different search words) and came up with several other PS users with the same problem as us.

After carefull reading we found one posting to be of interest and have applied the script changes and undertaken some small tests. Initial testing proved to be sucessful with paypal and we will report back here in a few days time - or sooner if it has failed but if you have or have had same problem being the rounding up of decimal point errors then use the coding below to resolve it.

Also, we believe the issue will also clear up the stock qty removal problem as the paypal payment (and all others) should be OK now.

Thank you to tomerg3 for the code advice written below.

Regards

Ian

Ps as a novice - and in my hast to resolve this issue I posted this to the wrong forum section!!




In /classes/Cart.php (around line # 570) you will see the following code

foreach ($products AS $product)
{
   $price = floatval(Product::getPriceStatic(intval($product['id_product']), $withTaxes, intval($product['id_product_attribute']), 6, NULL, false, true, $product['quantity']));
   $total_price = $price * intval($product['quantity']);
   $order_total += $total_price;
}



Comment out the $price = … line (add // in front of it) and add the new line below it.


foreach ($products AS $product)
{
   //$price = floatval(Product::getPriceStatic(intval($product['id_product']), $withTaxes, intval($product['id_product_attribute']), 6, NULL, false, true, $product['quantity']));
   $price = round(floatval(Product::getPriceStatic(intval($product['id_product']), $withTaxes, intval($product['id_product_attribute']), 6, NULL, false, true, $product['quantity'])),2);
   $total_price = $price * intval($product['quantity']);
   $order_total += $total_price;
} 



This will round the price of each product (with taxes) to 2 decimal points and should resolve this issue.

If it doesn’t make a different just remove the new line, and un-comment the old one.

Link to comment
Share on other sites

Hi

I have the same problem for long now and can't go live with my shop because of this problem. I have applied the code changes tomerg3 suggested. It did worked ok for a few days but then the rounding paypal error started again.

I got a message from presta shop team member that on PS 1.3 it is fixed but can't really use that because it is all in alfa stages.

I'm quite desparate for a fix to this problem :-)

Link to comment
Share on other sites

Hi Bambi,


The problem for us has been resolved and it now works - although we monitor the paypal payments every day.

However - just so that you can see if you undertook the same style of changes, this is what we did:

On the server we downloaded the file classes/Cart.php using a ftp transfer programme.

(We now have a small number of directories on company drive where we dump and test files etc.)

We used MS word pad (simple text editor) to make the changes which we have shown above.

Again using our ftp programme we changed the file name that the PS uses on the working server (in our case we simply renamed it cart-mdr.php)

This is so that the file can be re-used if the changes dont work or give a problem.

We then uploaded the amended file (still called cart.php) to the working directory Classes.

We then atempted to open the front office to ensure it worked and the undertook a number of paypal test purchases. All proved to be successful.


I think we also changed all permissons for the directory and all files contained in the directories to 777 - unsure if this helped the situtation - but is seemed ok for us.

We have not changed our PS software for any of the latest versions as we chose to learn as much about this one before upgrading. (we think this is good policy) The version we currently are using is Version 1.2.4.0 - 4.025s

Our company operates two PS sites one in the UK and one in Poland. Both use the same version.

We decided to make this change only to the UK site at the present time - as although we have been using PS for since November last year - it was really only when we had to increase the VAT from 15% to 17.5% on 1st January that the rounding up problem started to show.

The paypal 0.01 problem has not shown it self on the Polish site as yet, but interestingly enough, we have not changed the VAT (TAX) on that site.

It very important to note with PS that when you change/amend something that you thouroughly check other parts of PS to ensure they continue to work as expected.


We hope perhaps this will have helped you a little - please let us know.

Cheers

Ian

Link to comment
Share on other sites

Hi Ian - MDR Direct ,

ThanX for your detailed reply.

I guess the main problem is as you said that when original code is edited it has impacked on other parts of the shop. I guess I have made other changes that infuenced tomerg codes in PayPal.

Might be some permissions that cause the problem?

Other wise I can's explain how PayPal is working fine for others.

Regards

:-)

Link to comment
Share on other sites

Hi Bambi,

I know it sounds rather daft !! but perhaps if you change the file and directory permissions of all your PS to all 777 - we have changed many file and directories as we have tried to amend or make work other parts of the PS programme - in the Modules area for example, we wanted to amend various text and we found the only way was to change the permissions and of course in other areas such as emails to customer we needed to make all permissions to 777.

When the PS software is 1st loaded it seems to make sense to get the user to change what he/she needs to be changed – and although we think PS is 100% 1st Class – unless you know your way around the workings of a programme it is a case of treading carefully when making any change.

I am sure there is much still to be learned by me about PS – but it is a good programme. Remember this though. It is working for many thousands of other users so if you have a problem it probably is to do with something you have not done, changed, allowed, amended installed correctly. But we have learned so far that through the Forum there is almost sure to be an answer or someone who will try to help.

Good Forum – very helpful

Best of luck

Ian

Link to comment
Share on other sites

  • 2 weeks later...

Thank you for the correction.
I had the same problem, some orders had the amount transmitted to Paypal with miscalculation and it seems the now the amount is correctly SENT to Paypal.

HOWEVER
I am facing a different miscalculation.
Although it first calculated well the amount shown on the cart and then when it was sent to paypal there was a round error that led to a payment error, NOW (with your modify on cart.php) calculations on cart show an error, but the correct amount is sent to paypal

This means that I got no payment error but the customer can see a calculation error on cart

Just to clarify I am attaching images with the amounts in the two cases:

First image (before.jpg) is BEFORE modify on cart.php and the amount sent to Paypal is 20.95 €
Second image (after.jpg) is AFTER modify on cart.php cart is miscalculated but the amount sent to paypal is correct 20.93 €

Thank you in advance for any help
Enrico

20254_6Lt7jRdSEdxrRWkSp20j_t

20256_za0cxlK9KeIzvWwFk9jn_t

Link to comment
Share on other sites

Hello Eanghil,

We've taken a look at your images and yes we can see for sure the figures differ between the two.

We are not sure why this has happened on your PS shop. We can only surgest putting back the files as they were, doing another test. Then change the files back to the modification as above. Do make sure you have set the permissions (unless like us, your ISP can auto configure the permissions) to 777.

For us the changes we made are still working perfectly.

If any other PS users can shead some light on this, your input is welcome!!

Regards

Ian

Link to comment
Share on other sites

  • 1 month later...
Thank you for the correction.
I had the same problem, some orders had the amount transmitted to Paypal with miscalculation and it seems the now the amount is correctly SENT to Paypal.


First image (before.jpg) is BEFORE modify on cart.php and the amount sent to Paypal is 20.95 €
Second image (after.jpg) is AFTER modify on cart.php cart is miscalculated but the amount sent to paypal is correct 20.93 €

Thank you in advance for any help
Enrico


I have the same problem exactly - the shopping cart display: item X price is wrong, everything else OK, the invoice is correct. I am using PS.1.2.5. I Applied the code suggested by MDR but no success. Anybody knows anything?
Link to comment
Share on other sites

  • 3 months later...

Hi,

I wonder if there is a solution to this PayPal issue.

I'm using PS version 1.3.1.1 and mostly it seems to work OK with PayPal, but occasionally the rounding problem occurs. For instance:

2 items at 2.95 GBP each plus 1.00 GBP shipping charge plus VAT at the UK's rate of 17.5% will cause the problem. Prestashop comes up with the correct total amount of 8.11 GBP, but when transferred to PayPal the total becomes 8.12 GBP, which is wrong.

Prestashop correctly shows 2.95 x 2 = 5.90 plus VAT = 6.93 (6.9325 correctly rounded down) plus 1.00 plus VAT = 1.18 (1.175 correctly rounded up), making 8.11.

However, PayPal seems to be applying the VAT to each item, then multiplying by the quantity, then adding the shipping charge with the VAT added giving 3.47 x 2 + 1.18, making the total amount 8.12.

Although version 1.3.1.1 allows the order to be accepted (no missing orders as with older versions), the customer gets a payment error, which is still a problem.

Does anyone know if the problem occurs because Prestashop passes the values to PayPal as individual costs with VAT added (i.e. 2 x 3.47) or is it something to do with PayPal?

I've used a few other carts in the past and I am sure that they just sent the total amount as calculated by the cart to PayPal, rather than individual costs so that PayPal could make calculations. Is this not possible with Prestashop, or are there other drawbacks to this method?

It would be great to get this sorted as everything else about Prestashop is great (apart from being able to not charge VAT on EU intracommunity orders, but that's another matter!).

Link to comment
Share on other sites

  • 7 months later...

An Up date on the issue of wrong amount being sent to Paypal.

As previously mentioned we use the script fix for our UK site (www.mdrdirect.co.uk) when the vat had been changed.

We would like to point out that since we did the changes to our UK site all payments have been same value as cart / Paypal and we have not had the problem again.

We did not at that time undertake the change to our Polish web site (www.keay.pl) because there had not been any changes in VAT. However 1st January 2011 Poland increased its VAT from 22 to 23% this has had an adverse effect on the rouding up procedure the PS uses and as such the Paypal issue presented it self yet again.

We decided to leave the script change for 3 moths whilst we monitored the problem and looked at why this is being created. our findings were clear on that fact that PS using more than 2 decimal points which can be seen on each product page. Often by palcing a simple value of 10 units of your currency there will not be a problem, but as soon as you break into the issue of decimal points of your currency (same £10.25) when there is a VAT/TAX change the system creates a new sum/value (example £10.25 becomes 10.47454. It is the last few figures which actully triggers paypal to drop off a 0.01 and create an error showed to custome and operator alike.

We have now added the script fix we used on our UK site to that of our Polish site. WE have undertaken some purchase tests and all proved to go through successfully.


In regard to other posts on this thread, we think that unless the access levels on the file are set as required then the script change will and should work. If access rights are not set correctly then the script will not work and will give you more errors.

As a point to remember - always re-name the file held on your ISP working drive (example cart.php change to cart-original.php) if things do go wrong for you then its easy to change and revert back to where you first started.

In closing both our online site www.mdrdirect.co.uk and www.keay.biz no longer have Paypal issues.

Link to comment
Share on other sites

Hi Joyvil,

I see you are using 1.3 PS!!

We have not upgraded and decided to stay where we are with our PS Versions (well for the time being anyway).

Reson being is we have both sites working very well - with many 3rd Party Modules - which sadly many have not been further developed by their authors.

So by upgrading - we would vastly have to remove and find replacement modules (perhaps the module you have to buy from PS Store - hence the many upgrades)

So I can not help you with 1.3 and I can only surggest to perhap try the fix above.

Or try aks the question of how to get PS to only use 2 untits past the decimal point reather than several that it currently uses - this would also resolve your situation.


regards

Link to comment
Share on other sites

  • 3 months later...
  • 1 month later...
  • 2 years later...

We're having this same issue in PrestaShop 1.5.4.1.

 

We're showing the product prices without tax and using quantity discounts.

 

In this specific example we have a product that (when the discount is applied) is £7.17.

 

When our 20% tax is applied ( ((7.17/100)*20) + 7.17 ) this becomes £8.604. The PayPal module rounds this down to £8.60 before multiplying it by the quantity to get to total value but PrestaShop uses the £8.604 value as it is.

 

This means for a quantity of 30 we get the following problem:

 

PrestaShop shows: 8.604 * 30 = £258.12

PayPal shows: 8.6 * 30 = £258

 

This means the final 'Cart' page of PrestaShop shows the wrong total (£258.12) instead of £258.

 

How I can I get the Prestashop cart page to work out the total based on the rounded value, rather than the precise value?

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...