News:

AbanteCart v1.4.2 is released.

Main Menu

Do you like AbanteCart? Please rate AbanteCart or share your experience with other eCommerce entrepreneurs. Go to Softaculous rating page to add your rating or write a review

paypal express error, amount not equal

Started by kolynet, October 07, 2016, 01:00:50 PM

Previous topic - Next topic

kolynet

dear developers,

github .com/abantecart/abantecart-src/issues/685

i have this issue. only when i add multiple items in euro for example and the cart vs paypal differ by 0,01.
sometimes it works sometimes its not ,depending on the rounding.
is there any manual workaround?

thank you !

digitalt


kolynet

latest 1.2.8 stock paypel express extension.

digitalt

If you charge shipping, Paypal charges VAT to sub-total and shipping separately and then adds the 2  together. This causes rounding errors like you experience.  If you google this problem, lots of examples.

Do you have to have Paypal calculate VAT?  VAT/Tax can be setup in A-cart for both sub-total and shipping and then only the total is passed to Paypal. Personally, I don't let Paypal calculate anything.


kolynet

I have free shipping on everything, and no TAX on the store.

digitalt

Okay, maybe try putting the tax in the store and take it off Paypal. That way a total is passed to Paypal and your not relying on Paypal for any calculations.

It seems though that the Euro rounding error is not limited to my previous post with sub-total and tax. 

The only other thing I can think of is currency conversion on Paypal side.  I don't know how they do that. As far as I know, Paypal is USD based and has to do conversions.  That could explain the randomness of the error.

If it was me, I would try taxing at store level and passing a total to Paypal. There is also a report for tax in Abantecart to help keep track of tax collected.

kolynet

thanks for ur help, however i dont think it has to do anything with the taxation. i have AbanteCart with 0 tax. so no tax zone. paypal dont put any added tax to the totals. I think its some rounding related thing, where it round up by 1 cents sometimes. maybe can you help me via skype? i pm'd you :)

kolynet

P.S: the big isssue:

SUB-TOTAL: $23.65
10% coupon: $2.37 (here come the problem, its actually counted with ($2.365 in the backend)
==============
TOTAL: $21.29.. (this is clearly $21.28) thats why it throw the error. Same happen in all currencies I guess.

I just simply cant find that function which calculateds the full total (like this: sub-total - discounts). If i find it, i can probably fix.

thanks.

digitalt

#8
Take a look at core/lib/cart.php but I don't think that's it.  Took a look at the DB and it looks like it's there. Take a look at xxx_orders for a start(screen shot attached)

Some of the values are carried out beyond 2 places and I bet that's where the error occurs.  AND it will do it in any currency.  There's no reason I can see to carry a price out to 4+ decimal places. Maybe one of the dev team can chime in and give us some insight as to why the decimal places are more than 2.  Maybe in some currencies there are more than 2 places.

BTW, it's a simple fix.  Just change the values in the db.  I've come across this elsewhere.

kolynet

ahha, yeah i found it to be 4 decimal in my db.. will change and see if it helps! thanks

digitalt

That's only one place I looked at quickly.  You need to check product prices and any other table that deals with currency and adjust them accordingly too. Otherwise, you will still get an error at some point.

kolynet

i modified my database, however the discount is still calculated by 3 decimal for some reason. somehow I should force it to use 2 decimal always.

kolynet

product price full: $23.65, when i apply 10% coupon, it shows $2.37. It would work if it calculated with 2.37, but however in the background it counts with -2.365, tahts why paypal throw error. i need to found the variable where it count the full total in the PHP. I guess.

digitalt

#13
Check core/lib/cart.php  You have to look at ALL tables that deal with currency.  Did you change the decimal places in xxx_coupon.

kolynet

i have this:

      //Need to round price after discounts and specials
      //round main price to currency decimal_place setting (most common 2, but still...)
      $currency = $this->registry->get('currency')->getCurrency();
      $decimal_place = (int)$currency['decimal_place'];
      $decimal_place = !$decimal_place ? 2 : $decimal_place;
      $price = round($price, $decimal_place);

however it does nothing if I remove the rounding of the price calc.

Forum Rules Code of conduct
AbanteCart.com 2010 -