![]() | ![]() | ![]() |
| Messaging on the homepage | Messaging on the product detail page | Messaging in the checkout |
https://js.klarna.com/web-sdk/v2/klarna.mjsclientId to initialize the SDK.<script type="module">
const { KlarnaSDK } = await import("https://js.klarna.com/web-sdk/v2/klarna.mjs")
const Klarna = await KlarnaSDK({
clientId: "[client-id]",
products: ["MESSAGING"],
locale: "en-US", // optional
})
// Klarna SDK ready to be utilized| Parameter | Presence | Description |
|---|---|---|
clientId | required | A credential that identifies the Acquiring Partner (obtained via Klarna’s Credentials API). It is shared across all integrated Partners. |
products | optional | Array to specify which products to load for optimal performance. This reduces the amount of data needed to download. For example, only loading PAYMENT will exclude the CUSTOMER product. |
locale | required | Language and region code (e.g., en-US). If omitted, Klarna may default based on the customer’s browser settings. |
placement method that allows to create and mount the messaging placement programmatically.klarna.Messaging.placement({
key: 'credit-promotion-badge',
amount: 20000,
currency: "USD",
locale: 'en-US',
theme: 'light'
}).mount('#osm-placement');
| Parameter | Presence | Description |
|---|---|---|
key | required | Placement type key. List of available keys |
currency | required | Currency in ISO 4217 format. Supported currencies: AUD, EUR, CAD, CZK, DKK, HUF, MXN, NZD, NOK, PLN, RON, SEK, CHF, GBP, USD. |
amount | required | Amount in minor units (e.g., $5.00 = 500) To populate amount:
|
locale | required | Locale for messaging ("en-AT", "de-AT", "nl-BE", "en-BE", "fr-BE", "en-CH", "de-CH", "it-CH", "fr-CH", "en-CZ", "cs-CZ", "de-DE", "en-DE", "da-DK", "en-DK", "es-ES", "en-ES", "fi-FI", "sv-FI", "en-FI", "fr-FR", "en-FR", "en-GB", "en-GR", "el-GR", "en-HU", "en-IE", "en-IT", "hu-HU", "it-IT", "nl-NL", "en-NL", "no-NO", "nb-NO", "en-NO", "en-PL", "pl-PL", "en-PT", "pt-PT", "en-RO", "ro-RO", "sv-SE", "en-SE", "sk-SK, "en-SK", en-CA", "fr-CA", "es-MX", "en-MX", "en-US", "es-US", "en-AU", "en-NZ") |
theme | optional | Defines what the theme of the placement would be, which are light or dark |
intent |
![]() | ![]() | ![]() |
| Interact with Product or Cart On-site Messaging placement | Go through Klarna Pre-qualification flow | Checkout page reflects prequalified status using interoperability token. |
interoperability_token to reflect the pre-qualification in the checkout.interoperability token and pass it to their Acquiring Partner for downstream processing or reporting.const interoperabilityToken = await Klarna.Messaging.getInteroperabilityToken();
curl https://api-global.test.klarna.com/v2/accounts/{partner_account_id}/payment/presentation \
-H 'Authorization: Basic <API key>' \
-H 'Content-Type: application/json' \
-H 'Klarna-Interoperability-Token: eyJhbGciOiJIU...' \
-d '{
"locale": "en-US",
"amount": 11836,
"currency": "USD",
"intents": ["PAY"]
}'