Enable Klarna in payment forms presented through hosted checkout pages or embedded elements using Klarna’s SDKs. This ensures a branded, compliant, and high-conversion checkout experience.
With this integration path, Partners are presenting a payment form generated by the Acquiring Partners:
The following diagram gives an overview of the customer journey and the Acquiring Partner workflow.
High level integration visualization of an Hosted Checkout experience from the Acquiring Partner
On a high level, building the payment form requires the following actions:
interoperability_token
in your checkout session API and JavaScript library.interoperability_data
in your checkout session API (server-side only).interoperability_token
is provided, exchange it server-side for an sdk_token
.clientId
, partnerAccountId
, sdkToken
, products
and locale
.Klarna.Payment.presentation()
SDK method to dynamically retrieve personalized assets to build the payment selectorinstruction
(e.g., show, preselect Klarna).Before calling Klarna’s Payment Authorization API, the Acquiring Partner must ensure their backend accept and forward Klarna specific parameters. These include interoperability parameters that preserve session context as well as supplementary purchase data which improves Klarna’s ability to assess risk, optimize approval rates, and deliver a more personalized checkout experience.
When Partners optimize their integration with Klarna, they are likely to have interoperability parameters to share with the Acquiring Partner.
Parameter | Purpose |
---|---|
| Encodes Klarna-specific session context (e.g., preselected payment option, pre-qualification results). |
| Submit supplementary purchase data directly to Klarna |
These ensure consistent customer and transaction context throughout the payment flow and must be forwarded unaltered to Klarna.
Implementation requirements
The Partner-facing field should be named either klarna_interoperability_token
/klarna_interoperability_data
or interoperability_token
/interoperability_data
in a Klarna-specific context, ensuring that it’s easy for any Partner to identify and use.
The Acquiring Partner can validate the input based on the provided guidelines but must not modify it. The input must always be forwarded as received, without any interference.
Sample request
Below are some examples of how Acquiring Partners can accept the interoperability parameters:
Supplementary purchase data improves Klarna’s ability to assess risk, optimize approval rates, and deliver a more personalized checkout experience. It includes structured information such as line items, L2/L3 data for Card Network optimization and other transaction context.
Acquiring Partners may receive this data from the Partner in two ways:
interoperability_data
supplementary_purchase_data
object when calling the Payment Authorize API.
Acquiring Partner must collect and forward data that aligns with Klarna’s Supplementary Purchase Data package by utilizing their existing schema.
Acquiring Partner should not add additional fields of the supplementary purchase data in their APIs to support Klarna. Instead, they must ensure that the interoperability_data
and its required structure are properly implemented.
In both cases, the Acquiring Partner is responsible for ensuring that the data provided by the Partner is accurately forwarded to Klarna. Partners should not be asked to resubmit the same information through multiple mechanisms.
Read more about Supplementary Purchase Data here.
To determine whether the payment should be fast-tracked, the Acquiring Partner should call our backend Payment Presentation API and verify the payment_status
. Basic checkout context parameters must be provided:
Parameter | Description |
---|---|
| The transaction amount in minor units (e.g., $118.00 = 11800 ). |
| Three-letter ISO 4217 currency code (e.g., USD , EUR ). |
| Locale code to localize texts and formats (e.g., en-US , de-DE ). |
| Optional. Specify the intent of the checkout flow: PAY , SUBSCRIBE , SIGNUP , SIGNIN , DONATE .Default value is PAY . |
Sample request payload:
{
"amount": 11800,
"currency": "USD",
"locale": "en-US",
"intents": ["SUBSCRIBE"], // optional, other values: "PAY" || "SIGNUP" || "SIGNIN" || "DONATE" || "ADD_TO_WALLET"
}
ADD_TO_WALLET
will be available in a future release.
The PaymentPresentation
interface provides the full Klarna branding package and instructions tailored to the customer's purchase. However, at this step, the only relevant information is payment_status
.
Payment status | Description |
---|---|
| Further customer interaction is required, the payment selector should be displayed. |
| The customer has approved the payment, the Acquiring Partner should proceed with payment authorization immediately – jump to the Authorize the payment section. |
Sample response payload:
{
...
"payment_status": "REQUIRES_CUSTOMER_ACTION",
...
}
To integrate Klarna as a payment method into their payment form, the Acquiring Partner must initialize Klarna’s Web SDK using specific credentials and tokens.
interoperability_token
for an sdk_token
This step is only applicable if the Partner has shared an interoperability_token
.
If a Partner provides an interoperability_token
, the Acquiring Partner must exchange it for a short-lived sdk_token
using the Generate SDK Token API endpoint.
The sdk_token
is a single-use, browser-bound credential that restores the customer’s checkout context when Klarna’s Web SDK is loaded. This token should be exchanged server-side before initializing the SDK and displaying the checkout page to the customer.
The Klarna Web SDK (klarna.mjs) follows the JavaScript module approach and should be included in places where you need to have a reference to the SDK such as while rendering any components or initiating a payment flow. Always load the Web SDK from https://js.klarna.com/web-sdk/v2/klarna.mjs to remain compliant. Don’t include the script in a bundle or host it yourself.
Parameter | Description |
---|---|
| A credential that identifies the Acquiring Partner (obtained via Klarna’s Credentials API). It is shared across all integrated Partners. |
| 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. |
| A unique identifier for the specific Partner onboarding under the Acquiring Partner. |
| The short-lived token exchanged from the interoperability_token . Enables restoring the customer's session state securely on the client. |
| Optional, language and region code (e.g., en-US ). If omitted, Klarna may default based on the customer’s browser settings. |
SDK initialization sample
const klarna = await KlarnaSDK({
clientId: "klarna_test_client_***",
products: ["PAYMENT"],
partnerAccountId: "krn:partner:global:account:***",
sdkToken: "rxvqGi07j...", // retrieved from server
locale: "en-US" // optional but recommended
});
// sdkToken can also be set after SDK initiation
// klarna.Config.setSdkToken("rxvqGi07j...")
After initialization, the Klarna SDK instance is ready to retrieve payment presentation data and manage the checkout flow. For the full API specifications, refer to Klarna Web SDK.
Important implementation details
m>Legal notice</em>
When using the Klarna Web SDK, you are responsible for informing your users about the tracking technologies it uses. Learn more about how to disclose this on your site.
<
This step describes how Klarna should be presented in the payment form initially as well as when it's selected by the customer. The expected outcomes are as followed:
![]() | ![]() |
Initial presentation | When Klarna is selected |
It's crucial that Klarna payment presentation is dynamic and not hardcoded on your server to deliver the best conversion outcome.
Depending on your architecture and the level of performance optimization, you can choose one of the following options:
Klarna payment presentation provides all the visual assets, localized texts, and instructions needed to correctly display Klarna in your checkout form.
Use the initialized SDK instance to call the Klarna.Payment.presentation() method.
Basic checkout context parameters must be provided:
Parameter | Presence | Description |
---|---|---|
| required | The transaction amount in minor units (e.g., $118.00 = 11800 ). |
| required | Three-letter ISO 4217 currency code (e.g., USD , EUR ). |
| optional | Locale code to localize texts and formats (e.g., en-US , de-DE ). If you don’t set this, it will automatically use the value chosen when you first set up the Web SDK. If that’s not available, it will use your browser’s settings instead. |
| optional | Specify the intent of the checkout flow: PAY , SUBSCRIBE , SIGNUP , SIGNIN , DONATE .Default value is PAY . |
Sample request payload:
ADD_TO_WALLET
, subscription_billing_interval
and subscription_billing_interval_frequency
will be available in a future release.
The PaymentPresentation
interface provides the full Klarna branding package and instructions tailored to the customer's purchase:
Attribute | Purpose |
---|---|
| Klarna’s directive on how to display Klarna (e.g., show, preselect or show-only). |
| Klarna badge/logo suitable for checkout forms. |
| The main descriptor to introduces Klarna in the payment form. The value will be dynamically adjusted based on the locale provided. |
| The descriptor subheader which must be loaded inline below the main descriptor header. Short and enriched descriptive texts. Provides transparency on available options like installments, pay later, etc. |
Performance optimization
It is important to ensure that Klarna is displayed at roughly the same time as other payment methods, with an acceptable delay of less than 100 ms. To achieve this, begin initializing the Klarna Web SDK and invoke the payment presentation method concurrently while loading the list of all enabled payment methods from your server.
Following Klarna payment presentation instruction ensure consistent customer experience when the Partner is integrating with Klarna Conversion Boost features. The instruction
attribute from the PaymentPresentation
instance informs how Klarna should be displayed in the payment form:
Instruction | Description |
---|---|
| This is the default value returned. When received, show Klarna alongside other payment methods. |
| This is returned when the customer has logged in using the Sign in with Klarna feature. In this scenario the customer has used Klarna to login, however this does not indicate a clear intention to pay with Klarna. Therefore Klarna should be pre-selected but still alongside others. |
| This is returned when the customer has finished the first step of Klarna Express Checkout multistep. Since the customer has already shown intention to pay with Klarna, this should be the only payment method displayed. |
| This value is returned when the Partner has been identified as fraudulent and subsequently terminated. As a result, the Partner is no longer able to use Klarna services—functionality is fully disabled, and Klarna should no longer be displayed in the checkout. |
The presentation instructions indicate Acquiring Partners how Klarna should be presented in the payment selector. Acquiring Partners are required to adhere to Klarna’s payment presentation instruction to achieve the best-in-class user experience.
![]() | ![]() | ![]() | ![]() |
Show Klarna | Preselect Klarna | Show only Klarna | Hide Klarna |
The presentation instructions are derived from possible customer purchase journeys described in the following article.
Sample code:
if (paymentPresentation) {
switch (paymentPresentation.instruction) {
case "SHOW_KLARNA":
console.log("Showing Klarna alongside other payment methods.");
renderKlarnaOption(paymentPresentation);
break;
case "PRESELECT_KLARNA":
console.log("Showing Klarna preselected alongside other payment methods.");
renderKlarnaOption(paymentPresentation);
break;
Once an instance of PaymentPresentation
is created, the Acquiring Partner must dynamically render Klarna payment option in the payment selector according to Klarna’s presentation guidelines.
The following attributes from PaymentPresentation
instance will be used when loading the payment selector initially:
Mount Klarna payment presentation icon, header and subheader to your Klarna payment method container to render the elements dynamically in your payment form.
function renderKlarnaOption(paymentPresentation) {
const klarnaContainer = document.getElementById("klarna-option");
if (!klarnaContainer) {
console.error("Klarna container missing.");
return;
}
// Clear the container first
klarnaContainer.innerHTML = `
After the customer selects Klarna in the payment selector (or if Klarna was pre-selected according to presentation instructions), the next step is to show:
This step finalizes the presentation of Klarna's payment method before the customer proceeds to payment authorization.
The remaining attributes from PaymentPresentation
instance will be used when loading the payment selector:
Attribute | Purpose |
---|---|
| Enriched tailored description with link |
| Payment button for the customer to start the Klarna purchase journey |
Display additional messaging
paymentPresentation
.message
.component()
.mount("#klarna-message-container");
Display Klarna payment button
The payment presentation instance allows you to either mount the prebuilt button component or retrieve the button text asset. The Klarna Payment Button is context-aware and dynamically adapts to your configuration.
This guide will focus on the Klarna payment button component, to learn more about creating your own button. Visit this section.
Klarna payment button variants
Choose the theme and shape of the payment button to best fit into your online store in a way that complements your brand and encourages user engagement. More details on the button styling can be found here.
Mount Klarna payment button
The paymentButton.component()
can be configured with the following set of parameters:
Parameter | Description |
---|---|
| Sets a custom DOM ID on the rendered button. Useful for testing or styling. |
| Defines the button’s shape. Possible values are:default , pill , rect |
| Sets the visual theme of the button. Possible values are: default , light , dark , outlined |
| Sets the language and region (e.g., en-US ). If you don’t set this, it will automatically use the value chosen when you first set up the Web SDK. If that’s not available, it will use your browser’s settings instead. |
| Disables the button when set to true . Useful during form validation or async operations. |
| Forces the button into a loading state. Useful when awaiting async setup or validation. |
| Sets the purpose of the payment. Used to personalize the button and flow if not set when creating the PaymentPresentation instance. |
| Function that returns a Promise resolving to either a PaymentRequestData , a paymentRequestId , or a returnUrl . This will be handled differently depending on the integration path. |
| Defines how Klarna launches the purchase journey. |
Sample code
paymentPresentation
.paymentButton
.component({
id: "klarna-payment-button", // unique button/component ID
shape: "pill", // "pill", "default", or "rect"
theme: "default", // "default", "dark", "light", or "outlined"
intents: ["PAY"], // defines payment intent, e.g., "PAY"
initiationMode: "DEVICE_BEST", // "DEVICE_BEST", "ON_PAGE", or "REDIRECT"
initiate: () => {
/**
The button will automatically handle customer interaction and trigger the Klarna purchase flow via the initiate
function.