This product, Klarna Checkout (v2) is deprecated. Go to the current version


Download and use a client library for a fully featured and simple integration with our API.

For Klarna Checkout, you have one Checkout SDK and one Order handling SDK, if you will integrate both the checkout and order handling in your backend, you will need both SDKs.




The recommended way to install the library is to use composer. To add the library as a composer dependency to your project, run the following command in your project directory:

    composer require "klarna/checkout 4.0"


If your project does not support composer, you can either clone the project on GitHub or download the package from here. You will then have to manually add the library to your project.


Klarna Checkout PHP library

Date: 2015-06-01

    Christer G. 
        Update resource constructors. Only allow creation with IDs instead of full URIs

v3.0.2, v3.0.1
Date: 2015-05-21

    Matthias F.
        Remove short hand array syntax for PHP 5.3.

Date: 2015-05-21

    Matthias F.
        Adding support for recurring orders.

Date: 2015-03-18

    David K.
        Add ability to set accept header.

Date: 2014-10-03

    Christer G. 
        Updating checkout and create examples to ensure a cart is always created

Date: 2014-09-05

    Christer G. 
        Updating code examples

Date: 2014-03-27

    Christer G. 
        Verify SSL host and peer
        Enable setting custom cURL options
        Show cURL error message in Klarna_Checkout_ConnectionErrorException

Date: 2013-09-12

    Christer G. 
        Adding CURLOPT_TIMEOUT with the same timeout as CURLOPT_CONNECTTIMEOUT

Date: 2013-03-15

    Majid G. 
        Increasing http timeout to 10 seconds
        Adding capability to change the timeout from connector

Date: 2012-11-21

        Initial release.

clone on GitHub!

Order management



The recommended way to install the SDK is to use composer. To add the SDK as a composer dependency to your project, run the following command in your project directory:

    composer require "klarna/php-xmlrpc 5.0"


If your project does not support composer, you can either clone the project on GitHub or download the package from here. You will then have to manually add the library to your project.


Klarna PHP API

Date: 2015-05-27

    Joakim L. 
        Make SDK available on composer
        Fix URI for BETA mode with checkoutService
        Remove checkoutHTML method
        Add function extendExpiryDate
        Fix static invocation

Date: 2014-11-11

    Christer G. 
        Klarna.php : Add setter for client IP

Date: 2014-11-06

    Christer G. 
        Klarna.php : Fix notice and warnings in PHP 5.3 & 5.4

Date: 2014-08-22

    Christer G. 
        CHANGELOG : reformat

Date: 2014-08-22

    Christer G. 
        Klarna.php (checkoutService) : new
            Introducing a new method for using the Checkout Service

Date: 2014-07-10

Story (#1682) (Christer G.) - Remove updateNotes and reserveOCRemail functions

Date: 2014-03-25

Story (#1528) (Christer G.) - Remove candice from PHP library

Date: 2013-11-04

Story (#824) (Christer G.) - Removing func_get_args as function parameter
Bug (#870) (Christer G.) - Fix to make example files 5.2 compatible

Date: 2013-07-15

Story (#816) (Rickard D.) - Update lowest_monthly_payment_for_account for Netherlands
Story (#751) (Christer G.) - Update call filters out falsy values for digest

Date: 2013-05-17

Story (#674) (Rickard D.) - Add goods list to credit calls for restocking fees
Story (#672) (Rickard D.) - Change BETA host from beta-test to testdrive

Date: 2013-03-28

    Rickard D. <>
        Klarna.php (reserveAmount) :
            No longer remove falsy values from the digest string.

Date: 2013-03-25

    Rickard D. <>
        Klarna.php (reserveAmount) :
            Allow reserveAmount calls with an amount of 0.

Date: 2012-12-07

    Christer G. <>
        Klarna.php (getClientIP) :
            Refactored to be more readable.

    Rickard D. <>
        Klarna.php (setConfig) :
            Configuration may now be an array, aswell as a and

    Majid G. <>
        Klarna.php (update) :
            Removed rno validation from the library

Date: 2012-09-17

    Rickard D. <>
        Klarna.php (activateReservation) :
            Change to allow NULL to be sent in as PNO when activating a
            reservation. Any other value than null will still trigger a
            verification that a string longer than 0 characters is sent
            as PNO.

        Klarna.php (activate) : new function
            New function to activate a reservation using minimal information.
            Optional information for the activate call should be set using
            To partially activate a reservation, use Klarna::addArtNo() function
            (replaces splitReservation).

        Klarna.php (update) : new function
            New function to update a reservation using minimal information.
            Use setAddress to update address, addArticle to update an article in
            the goodslist and setEstoreInfo to update order id:s.

        Klarna.php (checkCountryCurrency) : removed function
            As this function does not scale and does not belong in a library it has
            been removed.

        Country.php () :
            Added all available country constants.

        Language.php () :
            Added all available language constants.

        Klarna.php (getLanguageForCountry) : deprecated
                (getCurrencyForCountry) : deprecated
        Country.php (checkLanguage) : deprecated
                    (checkCurrency) : deprecated
                    (getLanguage) : deprecated
                    (getCurrency) : deprecated
            Deprecated functions that will not scale and will not be compatible for
            any potential future markets.

        Klarna.php (init, setCountry) :
            Removed the automatic setting of currency and language when setting
            the country. This functionality does not scale and was not consistent
            depending on how you set the country.

    Majid G. <>
        Klarna.php (addTransaction) :
            Removing the link comment for PRE_PAY flag

        Flags.php (KlarnaFlags) :
            Adding deprecated comment for Flag 8 (PRE_PAY)

Date: 2011-05-18

David K. <>
    Klarna.php (summarizeGoodsList)
        New method that can be used to get a aggregated price for the entire

    Klarna.php (reserveAmount)
        Replace the simple goodslist summary that did not take taxes and
        discounts into consideration with a call to summarizeGoodsList

Date: 2011-05-15

Rickard D. <>
    Klarna.php (assembleAddress) :
        Only validate that the proper object type is sent in to Klarna, no longer
        performs any validation of the content of the fields.

    klarnaaddr.php () :
        Removed validation of field contets. Now possible to set all fields to
        empty strings if you want.

    Klarna.php (addTransaction, reserveAmount, activateReservation) :
        If $gender is sent in as an empty string, treat it as null.

    klarnacalc.php (calc_apr) :
        Removed the ability to send in a FIXED or SPECIAL pclass to
        KlarnaCalc->calc_apr. If this function is called with a FIXED or SPECIAL
        pclass it will now throw an exception instead of causing a fatal error.

    Klarna.php (getAllPClasses) : added
    storage.intf.php (getAllPClasses) : added
        Added possibility to get all stored pclasses, regardless of eid or type.

    Klarna.php (setPCStorage) :
        Added possibility to set a PCStorage on the Klarna object.

    Klarna.php (getPCStorage) : made public (was protected)
        Added possibility to get the configured PCStorage object from the Klarna

    Country.php (getLanguageForCountry, getCurrencyForCountry) : added
        Added possibility to get the language or currency for a specific country.

    All Files () :
        Updated code to follow the PEAR standard.

        Refactored several classes into their own files.
            All refactored classes were previosly declared inside the Klarna.php
            file. The new files are now instead included in the Klarna.php file,
            so no functionality has changed in that regard.
                KlarnaCountry   => Country.php
                KlarnaCurrency  => Currency.php
                KlarnaEncoding  => Encoding.php
                KlarnaException => Exceptions.php
                KlarnaFlags     => Flags.php
                KlarnaLanguage  => Language.php

        Made almost all exceptions thrown more specific and meaningful than just
        KlarnaException, although they still extend KlarnaException so old
        try-catch blocks will still work.

Date: 2011-09-26

* Fixed a minor conversion issue.

Date: 2011-09-12

* Improved the MySQL and SQL storage modules

    Added so you can pass an associative array to pcURI with the database info

    Added support for dashes in the normal regexp handling

    Fixed a rounding bug which requires a DROP TABLE and re-update of all PClasses

* Fixed a minor issue regarding the debug and xmlrpcDebug settings

* Added support for the ISO 3166-1 alpha-3 country codes

Date: 2011-09-06

* Corrected a few issues in the phpDoc comments

* Improved fetchPClasses, it is now possible to specify only country (as code or constant)

* Changed the MySQL PClass storage's clear functionality to use DELETE FROM instead of DROP TABLE,
this is to prevent possible permission issues in the database

* Various improvements and bug fixes

Date: 2011-08-19

* Added support for stronger cryptographic hashes

    The default is now SHA-512 instead of MD5

* Experimental generic database storage using PDO

* Added work arounds for issues with the XML-RPC library

* Bug fix and additional sanity checks in getCheapestPClass

* Debug mode uses FirePHP if available

Date: 2011-07-01

* Initial release of 2.0 API

* A complete rewrite using object oriented practices

clone on GitHub!