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
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.
interoperability_token
in client side javascript library.interoperability_data
should NOT be exposed client-side.Sample request
Below some examples of how Acquiring Partners can accept the interoperability parameters:
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.
As those parameters can change over time and are versioned so that the third party integration continues to work, Acquiring Partners need to respect these guidelines if they wish to validate parameters:
Parameter | Type | Max length | Validation |
---|---|---|---|
| string (JWT) | 8192 chars | Optional: verify format only |
| string (stringified JSON object) | 10240 chars | Optional: check for valid JSON |
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.
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 not add specific fields of the supplementary purchase data to their APIs for supporting Klarna, but rather make sure interoperability_data
and its requirements are properly implemented
In both cases, the Acquiring Partner must ensure that data provided by the Partner is forwarded to Klarna. Do not require Partners to resubmit the same information through multiple mechanisms.
Read more about Supplementary Purchase Data here.
This step is only applicable if the Partner has shared an interoperability_token
.
When an interoperability_token
is present, there are cases where the Partner has integrated with Klarna Express Checkout and the customer has already approved the payment. In this scenario, displaying the payment selector again results in a suboptimal user experience. Therefore, if the context allows the payment selector to be skipped, the Acquiring Partner must expedite the Klarna payment process and proceed directly to authorization.
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": ["PAY"], // optional, other values: "SUBSCRIBE" ||"SIGNUP" || "SIGNIN" || "DONATE"
}
Read payment presentation response
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. |
Sample response payload:
{
"instruction": "SHOW_KLARNA",
"payment_status": "REQUIRES_CUSTOMER_ACTION",
"payment_button": {
"text": "Pay with Klarna"
},
"icon": {
"badge_image_url": "https://s3.int.klarna.net/pre-purchase/library/global/images/badges/klarna_v2.svg",
"rectangle_image_url": "https://s3.int.klarna.net/pre-purchase/library/global/images/badges/klarna_badge_rectangle.svg",
"square_image_url": "https://s3.int.klarna.net/pre-purchase/library/global/images/badges/klarna_badge_square.svg",
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.
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 if for a short-lived sdk_token
using the Generate SDK Token API endpoint.
sdk_token
is a single-use, browser-bound credential.The Klarna Web SDK (klarna.mjs) follows 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
vides 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 co
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 |
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 | 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 code
var paymentPresentation = await klarna.Payment.presentation({
amount: 11800,
currency: "USD",
locale: "en-US",
intents: ["PAY"], // optional, other values: "SUBSCRIBE" ||"SIGNUP" || "SIGNIN" || "DONATE"
});
Always use the correct locale and currency for the customer session to ensure Klarna assets and instructions are accurately localized.
Read payment presentation response
The PaymentPresentation
interface provides the full Klarna branding package and instructions tailored to the customer's purchase:
Attribute | Purpose |
---|---|
| 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. |
| Klarna badge/logo suitable for checkout forms. |
| Klarna’s directive on how to display Klarna (e.g., show, preselect or show-only). |
| Klarna button component to trigger the Klarna authorization flow when the user proceeds. |
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 |
---|---|
| Show Klarna alongside other payment methods. |
| Show Klarna pre-selected but still alongside others. This is returned when the customer has logged in using the Sign in with Klarna feature. |
| Display Klarna as the only payment method. This is returned when the customer has finished the first step of Klarna Express Checkout multistep. |
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 |
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 |
paymentPresentation
.subheader
.enriched
.component()
.mount("#klarna-subheader-enriched-container");
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.
Create a button configuration object
The paymentButton.component()
can be configured with the following set of parameters:
Parameter | Description |
---|---|
| 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 purpose of the payment. Used to personalize the button and flow if not set when creating the PaymentPresentation instance |
| Sets a custom DOM ID on the rendered button. Useful for testing or styling. |
| Sets the language and region (e.g., en-US ). Defaults to browser settings if omitted. |
| Disables the button when set to true . Useful during form validation or async operations. |
| If true , disables Klarna’s default loading overlay. Use with care. |
| Forces the button into a loading state. Useful when awaiting async setup or validation. |
| 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
const buttonConfig = {
shape: "pill", // Button shape ("pill", "rectangle", etc.)
theme: "dark", // Theme ("dark", "light", etc.)
initiate: async () => {
const response = await fetch('/your-api/create-payment');
return await response.json();
},
initiationMode: "DEVICE_BEST", // Device-optimized payment initiation
};
Render the payment button into the DOM
Finally, mount the button inside the appropriate container:
paymentPresentation
.paymentButton
.component(buttonConfig)
.mount("#klarna-button-container");
The button will automatically handle customer interaction and trigger the Klarna purchase flow via the initiate
function.
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).