Klarna Docs - Migration to the new Klarna WebSDK
Migration to the new Klarna WebSDK

Klarna is introducing a new WebSDK that aims to streamline the integration process and offer a more robust, fast and safe solution for partners. Although designed to be backward compatible, some changes might be necessary depending on your setup. Below are the steps to ensure a smooth transition.

Replace your existing <script> tag as follows:

Old:

HTML
<script async="" src="https://osm.klarnaservices.com/lib.js" data-client-id="<client_id>"></script>

New:

HTML
<script async="" src="https://js.klarna.com/web-sdk/v1/klarna.js" data-client-id="<client_id>"></script>

Make sure that you change only the src url and keep the rest the same as the old integration

If you're using the ::parts API for styling, update the selectors.

Old:

HTML
#placementID *::part(osm-container) {
  /* Your CSS rules here */
}

New:

HTML
#placementID::part(osm-container) {
  /* Your CSS rules here */
}

Follow these steps for a smooth transition to Klarna's new WebSDK. For issues, consult the documentation or contact support.

If you're using CSP (Content Security Policy), you will need to whitelist js.klarna.com.