Ensure seamless Klarna integration across ecommerce platforms by forwarding interoperability data points and implementing compliant payment selectors for a smooth customer experience.
In case the plugin is simply leveraging the Acquiring Partner infrastructure to accept payments, then it will only need to retrieve the interoperability data points before starting the checkout process.
Retrieving interoperability data points will be specific to each e-commerce platform, but it is usually required to read the session storage of the platform for this customer before handing over to the Acquiring Partner’s payment infrastructure.
For Klarna's full product suite to function seamlessly across the customer journey on Platforms, it is required from the Acquiring Partner to retrieve the data points at the last touch point before moving to their own infrastructure. This is usually at the point where the consumer starts the checkout process.
When a partner utilizes a platform plugin maintained by Klarna, the plugin will handle the integration of Klarna’s product suite outside of payments and store interoperability data points inside the shared storage. The Acquiring Partner has to then forward them to their own platform.
When an Acquiring Partner distributes plugins for e-commerce platforms (e.g., Woo, Adobe Commerce) where they own the integration calls between the plugin and their own system, they are required to retrieve the interoperability_token
and use it, as this cannot be done by the partner themselves. When receiving it from their plugin, it should be used the same way as if they had received it from the partner directly.
Requirement | Description |
---|---|
Acquiring Partners’ Platform Plugins should retrieve interoperability data points stored by Klarna Plugins | If the integration is done through a plugin on an e-Commerce Platform (e.g. WooCommerce, Adobe Commerce etc.), the Acquiring Partner plugin must retrieve the interoperability data points from the Klarna Plugin via shared storage in the Platform. |
Acquiring Partners’ Platform Plugins should forward interoperability data points to their Payment Platform | Acquiring Partner needs to forward properly the interoperability data points when interacting with their Payment Platform as a Partner would do. |
Acquiring Partner's Plugin retrieves Payment Status and fast tracks payment finalization | Acquiring Partner needs to read Payment Status, if it’s pending confirmation then they should try to proceed to the payment with Klarna directly, if not, then proceed to regular checkout. |
Acquiring Partners’ Platform Plugins should build a compliant payment selector when applicable | When the payment selector is being built by the Acquiring Partner directly in their Platform Plugin, then the usual requirements apply for presentation Instructions and for sharing the interoperability_token with Klarna’s WebSDK. |
As each ecommerce platform is handling checkout sessions differently, here are specifics for each of the platforms.
The data points that will be stored:
Data point | Type | Availability |
---|---|---|
interoperability_data | String (nullable) | Checkout Sessions, Order data Server-side only. |
interoperability_token | String (nullable) | Checkout Sessions, Order data Server-side and client-side. |
interoperability_payment_status | Enum (nullable) | Checkout Sessions Server-side and client-side. |
Each data point may be independently non-present (null).
The interoperability data points will be stored in the session for the WooCommerce customer. This data can be retrieved by reading the WooCommerce session using the same key that we set them with, using the following code:
WC()->session->get( 'klarna_interoperability_data');
WC()->session->get( 'klarna_interoperability_token');
WC()->session->get( 'klarna_interoperability_payment_status');
The interoperability data points will be stored in the Adobe Commerce checkout session and can be retrieved in the following way:
public function getInteroperabilityData() {
return $this ->
checkoutSession->getKlarnaOfficialInteroperabilityData();
}
public function getInteroperabilityToken() {
return $this ->
checkoutSession->getKlarnaOfficialInteroperabilityToken();
}
The interoperability data points will be present in session storage and will be accessible (in JavaScript) in the following way:
sessionStorage.getItem('klarna_interoperability_data');
sessionStorage.getItem('klarna_interoperability_token');
sessionStorage.getItem('klarna_interoperability_payment_status');
The interoperability data points will be set in the session’s privacy object. The Acquiring Partner can use the below code to retrieve the interoperability data from the SFCC session:
var interoperability_data = session.privacy.klarna_interoperability_data
var interoperability_token = session.privacy.klarna_interoperability_token
var payment_status = session.privacy.klarna_interoperability_payment_status
A Partner is using Klarna Express Checkout with Klarna’s Plugin for a given platform, alongside with the Acquiring Partner’s own plugin to accept payments. The Partner enables the Klarna Express Checkout 1-step flow and expects payments to be automatically approved when reaching the payment step.
In a usual integration context, it is on the Partner to ask the Acquiring Partner to register a payment that is ready to be taken with Klarna. In an ecommerce Platform, it is on the Acquiring Partner plugin to trigger requests towards their payment platform, and it is also on them to share the interoperability data points.
When the payment process is initiated by the Acquiring Partner, it is required to retrieve the stored interoperability_token
and interoperability_data
from the session context and forward the data to the Acquiring Partner infrastructure when needed.
It is encouraged to store this data for later use – like for displaying Klarna properly in the payment selector:
function prepare_klarna_data_points($request) {
$requests -> payment_options -> set_klarna(
WC()->session-> get( 'klarna_interoperability_data' ),
WC()->session-> get( 'klarna_interoperability_token' )
);
}
This would result in the following call to the platform:
POST api.acquiring-partner.com/v1/payments
{
"currency": "USD",
"amount": 17800,
"payment_method_options": {
"klarna": {
"interoperability_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"interoperability_data": "..."
}
}
Data would then be handled as in this section.
A Partner is using Klarna Express Checkout with Klarna’s Plugin for a given platform, alongside the Acquiring Partner’s own plugin to accept payments. The Partner enables the Klarna Express Checkout 1-step flow and expects payments to be automatically approved when reaching the payment step.
For payments to be automatically accepted when already approved by Klarna through the Klarna Express Checkout 1-step flow, it is required to read and handle the payment_status to correctly define what is the intent of the Partner.
PENDING_PARTNER_CONFIRMATION
payment should be automatically processed with Klarna.REQUIRES_CUSTOMER_ACTION
the customer should go through the usual payment flow.function initiate_payment_flow() {
$klarna_payment_status = WC()->session->
get( 'klarna_interoperability_payment_status' );
// The payment is ready with Klarna
if("PENDING_PARTNER_CONFIRMATION" == $klarna_payment_status) {
this -> proceedToPaymentWithKlarna(WC()->session);
The plugin will then reconnect with this step of the integration.
A Partner is using Sign in with Klarna through Klarna’s Plugin for a given platform. They are also using the Acquiring Partner’s plugin, which builds directly the Payment selector from within the code running on the Platform.
The Platform plugin should follow these same guidelines.