Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Klarna Error “Bad value: total_tax_amount” and "tax_rate" #13

Open
albirs opened this issue Jul 5, 2023 · 2 comments
Open

Klarna Error “Bad value: total_tax_amount” and "tax_rate" #13

albirs opened this issue Jul 5, 2023 · 2 comments

Comments

@albirs
Copy link

albirs commented Jul 5, 2023

it seems like this is the same calculation for different vars ??

$this->unit_price = (int) round($surcharge->total_price * 100);
$this->total_amount = (int) round($surcharge->total_price * 100);

i fixed this with
$this->tax_rate = (int) round(($surcharge->total_price / $surcharge->tax_free_total_price - 1 ) * 10000);
in line 37

@d0p3fish
Copy link

d0p3fish commented Aug 2, 2024

This should be pushed to the master branch. It took me hours to figure out.
I had a follow-up error in ShippingOption.php while calculating the tax_amount.
isotope-klarna-checkout/src/Dto/ShippingOption.php

Changed to
$this->tax_amount = (int) round($includes->calculateAmountIncludedInPrice($this->price));

@richardhj
Copy link
Owner

Can you open the PR? :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants