Klarna Docs - Important Release Information

Important Release Information

Some releases require sharing additional important information, documented below.

Release notes for every version are available for the Klarna extension here.

Version 3.0.0 was released July 2024.

Below are backward-incompatible changes that may have a major impact for some sites, particularly to ensure third-party modules continue working.

What ChangedHow It Changed
Klarna\Backend\Api\ApiInterface"Updated constructor signature", Public methods "Updated signature"
Klarna\Backend\Model\Api\FactoryPublic methods "Updated signature"
Klarna\Kco\Api\KasperInterfacePublic methods "Updated signature"
Klarna\Kco\Api\ApiInterfacePublic methods "Updated signature"
Klarna\Kco\Model\Api\Factory"Updated constructor signature"
Klarna\Kco\Model\Api\KasperPublic Methods "Updated signature"
Klarna\Kco\Model\Api\Builder\KasperPublic methods "Updated signature", "Update constructor signature"
Klarna\Kp\Api\Data\RequestInterfacePublic methods: "Added", "Removed", "Updated signature"
Klarna\Kp\Api\CreditApiInterfacePublic methods "Updated signature"
Klarna\Kp\Controller\Klarna\AuthorizeUpdated constructor signature"
Klarna\Kp\Controller\Klarna\Cookie"Updated constructor signature"
Klarna\Kp\Controller\Klarna\QuoteStatus"Updated constructor signature"
Klarna\Kp\Controller\Klarna\UpdateSession"Updated constructor signature"
Klarna\Kp\Model\PaymentMethods\PaymentMethodProvider"Updated constructor signature"
Klarna\Kp\Model\PaymentMethods\TitleProviderPublic methods: "Removed"
Klarna\KpGraphQl\Model\Resolver\CreateKlarnaPaymentsSession"Updated constructor signature"
Klarna\Logger\Cron\CleanLogs"Updated constructor signature"
Klarna\Orderlines\Model\Calculator\GiftWrapPublic methods "Updated signature", "Update constructor signature"
Klarna\Orderlines\Model\Calculator\ItemPublic methods "Updated signature", "Updated constructor signature"
Klarna\Orderlines\Model\Calculator\ItemShippingAttributesPublic methods "Updated signature", "Updated constructor signature"
Klarna\Orderlines\Model\Calculator\Shipping"Removed constructor signature"
Klarna\Orderlines\Model\Items\Items"Updated constructor signature"

Klarna\Backend\Api\ApiInterface

DIFF
      *
      * @param StoreInterface $store
      * @param string         $methodCode
+     * @param string         $currency
      * @return $this
      */
      public function resetForStore(
	      $store,
	      $methodCode,
+	      string $currency

Klarna\Backend\Model\Api\Factory

DIFF
     /**
-     * @param ObjectManagerInterface $objectManager
-     * @param KlarnaConfig           $klarnaConfig
+     * @param OrderManagement        $ordermanagement
      * @codeCoverageIgnore
      */
      public function __construct(
-		  ObjectManagerInterface $objectManager,
-		  KlarnaConfig $klarnaConfig
+		  OrderManagement $ordermanagement
DIFF
-     public function create($className)
DIFF
     /**
      * @param string         $methodCode
      * @param StoreInterface $store
+     * @param string         $currency
      * @return ApiInterface
      * @throws LocalizedException
      */
      public function createOmApi(
	      string $methodCode,
	      StoreInterface $store = null

Klarna\Kco\Api\KasperInterface

DIFF
     /**
      * Get Klarna order details
      *
      * @param string $id
+     * @param string $currency
      * @return array
      */
-     public function getOrder(string $id): array;
+     public function getOrder(string $id, string $currency): array;
DIFF
     /**
      * Create new order
      *
      * @param array $data
+     * @param string $currency
      * @return array
      */
-     public function createOrder(array $data): array;
+     public function createOrder(array $data, string $currency): array;
DIFF
     /**
      * Update Klarna order
      *
      * @param string $id
      * @param array $data
+     * @param string $currency
      * @return array
      * @throws KlarnaApiException
      */
-     public function updateOrder(string $id, array $data): array;

Klarna\Kco\Api\ApiInterface

DIFF
    /**
     * Retrieve order in the checkout API
     *
+    * @param string $currency
     * @param string|null $checkoutId
     * @return DataObject
     */
-    public function retrieveOrder($checkoutId = null);
+    public function retrieveOrder(string $currency, $checkoutId = null);

Klarna\Kco\Model\Api\Factory

DIFF
     /**
      * Construct
      *
-     * @param \Magento\Framework\ObjectManagerInterface $objectManager
-     * @param KlarnaConfig                              $klarnaConfig
+     * @param Kasper                                    $kasper
      * @codeCoverageIgnore
      */
      public function __construct(
-         \Magento\Framework\ObjectManagerInterface $objectManager,
DIFF
-    public function createModel($className)

Klarna\Kco\Model\Api\Kasper

DIFF
     /**
      * Get order from API
      *
+     * @param string $currency
      * @param string|null $checkoutId
      * @return array|DataObject
      * @throws KlarnaApiException
      * @throws KlarnaException
      */
-     public function retrieveOrder($checkoutId = null)

Klarna\Kco\Model\Api\Builder\Kasper

DIFF
     /**
-     * @param ConfigHelper                                $configHelper
-     * @param Klarna\Kco\Model\Configuration\Url         $urlConfiguration
+     * @param KcoUrl                                      $urlConfiguration
      */
      public function __construct(
	     ...
-        ConfigHelper $configHelper,
-        Checkout $checkoutConfiguration = null,
-        Prefill $prefillConfiguration = null,

Klarna\Kp\Api\Data\RequestInterface

DIFF
-   /**
-     * Setting the options
-     *
-     * @param OptionsInterface $options
-     */
-     public function setOptions(OptionsInterface $options
DIFF
+    /**
+     * Getting back the purchase currency
+     *
+     * @return string
+     */
+     public function getPurchaseCurrency(): string;

Klarna\Kp\Api\CreditApiInterface

DIFF
     /**
      * Creating the session
      *
-     * @param RequestInterface $request
+     * @param Container $container
      * @return ResponseInterface
      */
-     public function createSession(RequestInterface $request);
+     public function createSession(Container $container);
DIFF
     /**
      * Updating the session
      *
-     * @param string           $sessionId
-     * @param RequestInterface $request
+     * @param Container $container
      * @return ResponseInterface
      */
-     public function updateSession(string $sessionId, RequestInterface $request);
+     public function updateSession(Container $container);
DIFF
     /**
      * Reading the session
      *
-     * @param string           $sessionId
+     * @param Container $container
      * @return ResponseInterface
      */
-     public function readSession(string $sessionId);
+     public function readSession(Container $container);
DIFF
     /**
      * Placing the order
      *
-     * @param string           $authorizationToken
-     * @param RequestInterface $request
-     * @param null|string      $klarnaId
-     * @param null|string      $incrementId
+     * @param Container $container
      * @return ResponseInterface
      */
DIFF
     /**
      * Cancelling the order
      *
-     * @param string $authorizationToken
-     * @param null   $klarnaId
+     * @param Container $container
      * @return ResponseInterface
      */
-     public function cancelOrder(string $authorizationToken, $klarnaId = null);
+     public function cancelOrder(Container $container);

Klarna\Kp\Controller\Klarna\Authorize

DIFF
    /**
      * @param RequestInterface $request
      * @param LoggerInterface $logger
      * @param AuthorizeLogger $authorizeLogger
      * @param CartManagementInterface $cartManagement
-     * @param CartRepositoryInterface $magentoQuoteRepository
      * @param RequestValidator $requestValidator
+     * @param CartRepositoryInterface $magentoQuoteRepository
      * @codeCoverageIgnore
      */

Klarna\Kp\Controller\Klarna\Cookie

DIFF
    public function __construct(
        Session                  $session,
        UrlInterface             $urlBuilder,
        DefaultConfigProvider    $defaultConfigProvider,
        RedirectFactory          $redirectFactory,
-       QuoteRepositoryInterface $klarnaQuoteRepository = null,
-       Logger                   $logger = null,
-       RequestInterface         $request = null
+       QuoteRepositoryInterface $klarnaQuoteRepository,
+       Logger                   $logger,

Klarna\Kp\Controller\Klarna\QuoteStatus

DIFF
    public function __construct(
        RequestInterface $request,
        QuoteRepositoryInterface $klarnaQuoteRepository,
        CartRepositoryInterface $magentoQuoteRepository,
        Result $result,
-       LoggerInterface $logger = null
+       LoggerInterface $logger
     )

Klarna\Kp\Controller\Klarna\UpdateSession

DIFF
    public function __construct(
        RequestInterface $request,
        QuoteRepositoryInterface $klarnaQuoteRepository,
        Result $result,
        OrderRepositoryInterface $magentoOrderRepository,
        CheckoutSession $checkoutSession,
-       LoggerInterface $logger = null
+       LoggerInterface $logger
     )

Klarna\Kp\Model\PaymentMethods\PaymentMethodProvider

DIFF
     /**
      * @param PaymentFactory $methodFactory
-     * @param null|QuoteRepositoryInterface $klarnaQuoteRepository
+     * @param QuoteRepositoryInterface $klarnaQuoteRepository
      * @codeCoverageIgnore
      */
-     public function __construct(
		  ...
-         $klarnaQuoteRepository = null
+		  QuoteRepositoryInterface $klarnaQuoteRepository

Klarna\Kp\Model\PaymentMethods\TitleProvider

DIFF
-    public function isDefaultTitle(QuoteInterface $klarnaQuote, string $paymentMethod): bool

Klarna\KpGraphQl\Model\Resolver\CreateKlarnaPaymentsSession

DIFF
    public function __construct(
        GetCartForUser $getCartForUser,
        RequestInterface $request,
        Validation $validation,
        Action $action,
        MagentoSession $magentoSession,
        CustomerSession $customerSession,
-       ApiValidation $apiValidation = null
+       ApiValidation $apiValidation
     )

Klarna\Logger\Cron\CleanLogs

DIFF
     /**
-     * @param ScopeConfigInterface  $config
-     * @param StoreManagerInterface $storeManager
-     * @param LogCollection         $logCollection
-     * @param LogRepository         $logRepository
-     * @param LogCollectionFactory  $logCollectionFactory
-     * @param LoggerInterface       $logger
+     * @param LogCollectionFactory $logCollectionFactory
      * @codeCoverageIgnore
      */
DIFF
+    /**
+     * Its a public method so that it can be extended by other modules.
+     *
+     * @return int
+     */
+    public function getLogLifeTime(): int
+    {
+        return self::LIFT_TIME;
+    }

Klarna\Orderlines\Model\Calculator\GiftWrap

DIFF
    /**
-     * @param KlarnaConfig $klarnaConfig
      * @param DataConverter $dataConverter
      * @param Calculation $calculator
      * @param ScopeConfigInterface $scopeConfig
+     * @param Country $country
      * @codeCoverageIgnore
      */
     public function __construct(
-        KlarnaConfig $klarnaConfig,
DIFF
     /**
      * Processing the item
      *
-     * @param array          $itemToProcess
-     * @param int            $itemQty
-     * @param StoreInterface $store
-     * @param string         $itemType
+     * @param array $itemToProcess
+     * @param int $itemQty
+     * @param string $itemType
DIFF
      *
      * @param DataHolder $dataHolder
      * @param string $itemType
+     * @param ExtensibleDataInterface $object
      * @return array|null
      * @throws Klarna\Base\Exception
      */
	  public function getItem(
+	      ExtensibleDataInterface $object
	  )

Klarna\Orderlines\Model\Calculator\Item

DIFF
     /**
      * @param DataConverter   $helper
-     * @param KlarnaConfig    $klarnaConfig
      * @param Config          $taxConfig
      * @param LoggerInterface $logger
+     * @param Country         $country
      * @codeCoverageIgnore
      */
     public function __construct(
         DataConverter $helper,

Klarna\Orderlines\Model\Calculator\ItemShippingAttributes

DIFF
     /**
      * @param ScopeConfigInterface $scopeConfig
+     * @param ShippingOptions      $shippingOptions
      * @codeCoverageIgnore
      */
      public function __construct(
+          ShippingOptions $shippingOptions
      )
DIFF
      *
      * @param ProductInterface $product
      * @param float            $dimensionCalculator
-     * @param string           $stat
+     * @param string           $attributeCode
      * @return float
      */
      private function getProductStat(
-         string $stat
      ): float
DIFF
-    public function getMappedShippingAttribute(StoreInterface $store, string $dimensionCode): string

Klarna\Orderlines\Model\Calculator\Shipping

DIFF
-    /**
-     * @param Calculation          $calculator
-     * @param ScopeConfigInterface $scopeConfig
-     * @codeCoverageIgnore
-     */
-     public function __construct(Calculation $calculator, ScopeConfigInterface $scopeConfig)

Klarna\Orderlines\Model\Items\Items

DIFF
     /**
      * @param ItemCalculator $calculator
      * @param ItemShippingAttributes $attributes
      * @param CollectionFactory $collectionFactory
-     * @param ItemResolverInterface|null $itemResolver
+     * @param ItemResolverInterface $itemResolver
+     * @param ShippingOptions $shippingOptions
      * @codeCoverageIgnore
      */
     public function __construct(

The configuration structure was revised in this release, to better support merchants integrating Klarna Payments via a PSP sub partner, using Klarna's Conversion booster features, such as On-site messaging, Express checkout, or coming soon Sign in with Klarna, and also still support sites integrating Klarna Payments directly. API credentials for each region are newly available at the Default Config scope. Credentials are separate into a specific section, and apply equally across all the other Klarna product sections. With Adobe Commerce's inheritance architecture, credentials can still be configured in other scopes as desired, but the intention is to simply configurations for sites supporting multiple regions.