Klarna delivery options error dialog

I got this error




If I comment out shippingOptionUpdateUrl - the dialog/problem disappears.

But is it the correct way to do it?

Best regards,
Matilda

Litium version: [Version number]

This can happend if you’re not Https if i remember correctly

This is because Klarna can’t reach your server in its callbacks. Usually it’s enough to comment out the AddressUpdateUrlKey values, as you have in your IF-statement from your screenshot.

But when using KSS, Klarna has to be able to send back the delivery option the customer selected in the iframe so the order carrier can be updated. For that to be possible your local dev environment must be accessible from the outside.

One solution is described here:
https://docs.litium.com/documentation/add-ons/payments/klarna/develop/developing-and-testing-klarna-behind-firewalls

You can also use something like ngrok to create a temporary tunnel from a public host to your local environment. After setting it up run it like ngrok http https://dev.localtest.me:443

You will get a temporary host - like b49756c3a7c2.ngrok.io - that you can add as a binding in IIS and as a domain on the channel. The URL is different each time you start ngrok (in the free version at least), so you need to update it every time.

@NilsN Forgot to mention - The dialog appears in the staging environment as well.

Https or http does not seem to make a difference in my local environment.

What’s the logged request path in Klarna for the Shipping option update call with the ??? status? Is that URL accessible from outside?

The request path looks like this:
api/site.axd/KlarnaPayment/ShippingOptionUpdate?accountId=KCOV3_SE&transactionNumber=9480703e-070b-64ca-90ff-00bb4ec7c3e2

That’s not a valid URL. Is this from your local environment?

How should the request path look like?

Both local and staging environments :slight_smile:

The path should be a valid URL to the environment. I set something similar up in a local Litium 7.4.2 where I’m using a localtest.me domain that’s not accessible from outside.

I get the same error and in Klarna the path is: request_path: https://litium-742.localtest.me/site.axd/KlarnaPayment/ShippingOptionUpdate?accountId=SE&transactionNumber=59f2ea82-2742-6386-8603-f04614048cb0

In the log file (with trace mode on for Klarna) you can see the URLs sent to Klarna from Litium:

...
"merchant_urls": {
    "terms": "http://litium-742.localtest.me/checkout/terms-and-condition",
    "cancellation_terms": null,
    "checkout": "http://litium-742.localtest.me/checkout?accountId=SE&transactionNumber={checkout.order.id}",
    "confirmation": "https://litium-742.localtest.me/site.axd/KlarnaPayment/Confirmation?accountId=SE&transactionNumber={checkout.order.id}",
    "push": "https://litium-742.localtest.me/site.axd/KlarnaPayment/PushNotification?accountId=SE&transactionNumber={checkout.order.id}",
    "validation": "https://litium-742.localtest.me/site.axd/KlarnaPayment/Validate?accountId=SE&transactionNumber={checkout.order.id}",
    "shipping_option_update": "https://litium-742.localtest.me/site.axd/KlarnaPayment/ShippingOptionUpdate?accountId=SE&transactionNumber={checkout.order.id}",
    "address_update": "https://litium-742.localtest.me/site.axd/KlarnaPayment/AddressUpdate?accountId=SE&transactionNumber={checkout.order.id}",
    "notification": "http://litium-742.localtest.me/PaymentProviderResult.axd/StaticCallback/KlarnaV3?accountId=SE&transactionNumber={checkout.order.id}",
    "country_change": null
  },
...

So I got this error because the url is not accessible from outside? Even if the problem appear in the staging enviroment? How can I solve this?

It that is the case it sounds like a question you need to ask you hostingprovider.
Are your site browsable by anyone or only from specific IP or IP-ranges?

if you site is accessible by anyone the issue isn’t that your url isn’t accessible but rather something in you code.

Have you made sure that you are using absolute url with https:/… ?
Have you added ShippingOptionUpdate to you KlarnaCheckoutController? Doesn’t look like KSS support is added to 7.6.1 accelerator so you need to look at files included zipfile in KSS implementation intructions on docs. Install KSS

@NilsN @Spotonkastebo The path is correct.
And there’s a ShippingOptionUpdate method in the KlarnaPaymentController.
I followed those guides Install and Install KSS and haven’t change any code.
And everyone can visit the website.

And you have added https binding in the iis so the site is possible to browse in https?

1 Like

I can confirm that https in our staging enviroment solved the problem.

Thank you guys @NilsN @Spotonkastebo !

2 Likes

A thing we noticed today is that you can’t use preflight domain if you want to test this on klarna production account prior to going live unless you have a valid certificate for the preflight domain. Klarna doesnt accept invalid certificate in production environment.

It would have been really nice if Litium drift provided valid certificate for the preflight domain.

2 Likes

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