Download and use a SDK for simple integration with our API.



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: 2016-03-16

    Joakim.L & Christer.G
        Support for PHP 7.0 (#META-102)

Date: 2016-02-16

    Joakim L.
        Add function extendInvoiceDueDate (#META-113)

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