This guide provides step-by-step instructions to install and configure the Klarna On-Site Messaging (KOSM) add-on for SAP Commerce.
Extract the archive and place the klarnaosmaddon
and klarnaosmbackoffice
folders into the custom
folder of the SAP Commerce Suite:
<HYBRIS_HOME>/bin/custom
localextensions.xml
<extension name="addonsupport" />
localextensions.xml
<extension name="klarnaosmaddon" />
<extension name="klarnaosmbackoffice" />
Stop the server by using one of the following methods based on your setup:
Ctrl+C
.hybrisserver.bat stop
../hybrisserver.sh stop
.Run the environment setup script; navigate to <HYBRIS_HOME>/bin/platform
and execute:
setantenv.bat
./setantenv.sh
Run the installation command:
ant addoninstall -Daddonnames="klarnaosmaddon" -DaddonStorefront.yacceleratorstorefront="yacceleratorstorefront"
Note: Replace yacceleratorstorefront
with your project-specific storefront name.
Set up script URLs and tags. In the SAP Commerce Backoffice, configure the following for both playground and production environments:
data-client-id
), you can find this in Merchant portal.Update the Master Tag: Modify the master tag to include:
<c:if test="${osmConfigData.active == true}">
<script async src="${scriptUrlKOSM}" data-client-id="${uci}"></script>
</c:if>
Update the PDP Page: Modify productPricePanel.tag
.
<%@ taglib prefix="osm" tagdir="/WEB-INF/tags/addons/klarnaosmaddon/responsive/osm/" %>
osmproduct
tag.<osm:osmproduct price="${product.price.value}"/>
<osm:osm/>
Modify the cart page: For the cart page, update cartTotals.tag
as follows:
<div class="col-xs-6 cart-totals-right text-right grand-total">
<ycommerce:testId code="cart_totalPrice_label">
<c:choose>
<c:when test="${showTax}">
<c:set var="finalPrice" value="${cartData.totalPriceWithTax}" />
<format:price priceData="${cartData.totalPriceWithTax}" />
</c:when>
<c:otherwise>
<c:set var="finalPrice" value="${cartData.totalPrice}" />
<format:price priceData="${cartData.totalPrice}" />
<osm:osmcart price="${finalPrice.value}" />
Rebuild the system by running the following command: ant clean all
klarnaosmaddon
klarnaosmbackoffice
Log in to Backoffice
Navigate to Klarna On-Site Messaging
In Backoffice, go to Klarna > Klarna On-Site Messaging.
Backoffice navigation to OSM in SAP
Create a new configuration
Click Create to add a new Klarna On-Site Messaging configuration.
Creating a new OSM configuration in SAP
Fill in configuration details
Enter the required values for configuring On-Site Messaging.
Save the configuration
Click Done to save your configuration.
Navigate to Klarna Common Configuration
Assign base store
Credentials settings in SAP
Assign credentials
Klarna Activation in SAP
Assign the Klarna On-Site Messaging configuration
In the Klarna On-Site Messaging Configuration section, select the newly created OSM configuration.
Klarna OSM configuration in SAP
Save changes
Click Save to apply your changes to the Klarna Common Configuration.
Attribute | Mandatory | Description |
---|---|---|
Code | Yes | Provide a unique name or code to identify this Klarna OSM configuration internally within SAP Commerce. |
Active | Yes | Check this option to activate the configuration. Leave unchecked to keep it inactive. |
Client Id | Yes | Enter the UCI value retrieved from the Klarna Merchant Portal (data-client-id). This can be configured under Klarna > Klarna Activation. |
Placements | Yes | Choose multiple placement options (e.g., Cart or PDP) where the Klarna On-Site Messaging should appear. |
Theme | Yes | Select a theme from the dropdown for the Cart Page or PDP. If custom styling is configured in the Klarna Merchant Portal, choose the custom option. |
Custom Style | No | Add custom styles to OSM elements using the ::part API. Use a <style> tag to define the custom style. Example:<style type='text/css'> #osm-product-strip::part(osm-container) { background-color: #d9b259; } #osm-product-strip::part(osm-cta) { font-size: 14px; } #osm-cart-strip::part(osm-container) { background-color: #d4d122; } </style> |