Klarna Checkout error when using domain name prefix

We get some critical errors when using Klarna Checkout and have a few language channels with the same domain name but with different prefixes, like this:

example.com/se
example.com/en
example.com/dk

If you first visit the dk site and then add a few products to the cart; then go to the checkout page,
The order total on the Klarna plugin is 50 €. Language and address requirements are in Danish. So far its correct.

But if you then go to example.com/se and visit the checkout page, the order total in Klarna Checkout is:
50 kr (Correct would be 500 kr). The Klarna plugin language is now swedish, but the address requirement is still Danish.

How can we fix this issue?

Litium version: 7.4.3

I believe the issue occurs because the same OrderCarrier is used after switching channels, and it has a reference to the Klarna order that was initiated on your first visit to the checkout page. If a reference exists it will try to re-use the same Klarna order.

Maybe you could try clearing the payments and deliveries of the order carrier to force a refresh?

In ControllerBase.Initialize there’s a check if the channel on the order carrier doesn’t match the channel on the current request, try adding this before the call to `cart.SetChannel(…)´.

cart.OrderCarrier?.Deliveries?.Clear();
cart.OrderCarrier?.PaymentInfo?.Clear();
1 Like

It works great! Thanks!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.