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

Java SDKs

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 Maven.

Add the following to your pom.xml file:

<dependency> <groupid>com.klarna</groupid> <artifactid>java-checkout</artifactid> <version>3.0.0</version> </dependency>

If you project does not support Maven you can either clone the project on GitHub and compile the jars or download the package from this page.

Refer to your IDE of choice on how to do it or include the jar file somewhere in your classpath.


Klarna Checkout Java library

Date: 2015-06-02

    Klarna &lt;;
        Update resource constructors. Only allow creation with IDs instead of full URIs

Date: 2015-05-21

    Klarna &lt;;
        Adding support for recurring orders.

Date: 2014-11-28

    Klarna &lt;;
        Correcting User-Agent header issues

Date: 2013-12-06

    Klarna &lt;;
        Correcting version number in pom.xml

Date: 2013-09-12

    Klarna &lt;;
        Fixing compilation issues in jdk 1.5

Date: 2013-03-15

    Klarna &lt;;
        Increased default socket timeout value.

        Added a method to set socket timeout on the IConnector interface.

Date: 2012-12-21

    Klarna &lt;;
        Initial release.

clone on GitHub!

Order management



Downoad and compile source or use precompiled jars.

Include on your project library path.


    Klarna Java API	    

Date: 2015-05-22

Story (#2135) (Christer G.) - Add extend_expiry_date method.

Date: 2015-02-25

Bug (#2011) (David K.) - Patch rounding issue in APR caculation

Date: 2014-07-09

Story (#1680) (Joakim L.) - Remove updateNotes and reserveOCRemail functions.

Date: 2014-03-20

Story (#1529) (Rickard D.) - Deprecate usage of Candice.

Date: 2013-09-03

Story (#673) (Majid G.) - Add goods list to credit calls for restocking fees
Story (#822) (Rickard D.) - Update lowest_monthly_payment_for_account for Netherlands
Bug (#743) (Rickard D.) - Reduce input validation for update_qty
Bug (#96) (Christer G.) - Update function uses internal validation
Bug (#215) (Rickard D.) - Collect cheapest pclass per country

Date: 2013-04-05
    Rickard D. &lt;;
            Allow 0 to be sent in as amount in Reserve Amount.

Date: 2013-03-25
    Rickard D. &lt;;
            Add Server setter to configure xml-rpc target server.
            Change default host for BETA integrations to the new testdrive server.

Date: 2012-08-dd
    Christer G. &lt;;
        Examples/activate.jsp : new
            Created an example file for the new activate function
        Examples/reserveAmount.jsp : modified
            Modifed the example file to include the optional description parameter
        Examples/update.jsp : added
            Created a new example file the new update function

    Joakim L. &lt;; (get, toInt) : altered
            PRINT_10 flag had an incorrect integer value.

    Rickard D. &lt;; (update) : new method
            Added Update method to easily update a reservation with new
            information. () : added
            New internal class to hold the data used by Update. () : added
            New internal extension to XmlRpcCall class to assemble and perform
            the Update call. (activatePart) : altered
            Return type changed from String[] to HashMap&lt;String, String&gt; to
            match what Klarna Online responds with. (xmlrpc_call, sendStat) : refactored
            Refactored to new XmlRpcCall class. Methods remain but call the
            new class. (colon, pipe, createDigest) : refactored
            Refactored to new Digest class. Methods remain but call the new
            class. (activate) : new method
                    (setActivateInfo) : new method
                    (removeNullParams, clear) : altered
            Added Activate method with several overloads to activate or
            partially activate a reservation.
            Added method to attach an ActivateInfo object to the Klarna API
            Added ActivateInfo to the clear and removeNullParams methods. () : new class
            Added class to build and perform the Activate call to Klarna. () : new class
            Class to hold the optional information usable with the Activate
            call. () : new class
            Class to handle XmlRpc calls, to be extended by classes that
            assemble the needed data for their XmlRpc call. () : new class
            Utility Class to handle various Digest related functions. () :
            Add UNDEFINED enum to return instead of null. (checkILT) : method removed
            Removed the checkILT functionality. () : class removed
            Removed along with checkILT. () : removed
            Class was deprecated in version 2.0.2 of the API and has been
            removed. () :
            Several overloads that used the old KlarnaFlags have been removed. (config) :
            Several deprecated overloads using nullable objects instead of
            primitive types removed. (ie Integer and Boolean instead of int and
            Several member variables also changed from nullable objects to the
            primitive types. Most notably Klarna.BETA and Klarna.LIVE. (pRound) :
            Resolved an issue of a missing break causing an unwanted
            fallthrough in the switch statement. (config) : overload removed
            One redundant overload of config removed.
            The removed overload is:
                public void config(
                    int, String, KlarnaCountry, KlarnaLanguage,
                    KlarnaCurrency, int, String)
            that allowed you to only specify &#39;json&#39; as the last string for
            it to work. (checkCountryCurrency) : overload removed
            A deprecated overload taking Object args and returning a
            nullable Boolean object was removed. (addArticle) : overload removed
            A deprecated overload taking nullable Integer and Double args was
            removed. (activateInvoice) : overload removed
            A deprecated overload taking nullable Boolean was removed. (updateGoodsQty) : overload removed
            The deprecated updateGoodsQty was removed in favor of
            updateGoodsQuantity(). (store) : member variable removed
            An unused protected member variable (store) removed. (getRegexp) : deprecated
            Deprecated the function getRegexp

        All Files () :
            JavaDoc updated.
            Private variables renamed.
            Internal structures in methods tweaked for better readability.
            A lot of unneeded &quot;throws&quot;-declarations removed.

    Majid G. &lt;;
        * (_activateReservation) :
            Removing the condition for checking if PNO is empty or not.

        * (_activateReservation) :
            Removing getClientIP and also validating it

        * (Invoice enum) :
            Adding Deprecated to PRE_PAY
        * (Invoice enum) :
            Adding Deprecated to PRE_PAY
        * (addTransaction)
            Removing the PRE_PAY&#39;s comment from

        * (returnAmount) :
            Adding description to this function&#39;s parameters

        * (getPNOEncoding) :
            Adding Austria to the required places

        * (getLowestPaymentForAccount) :
            Adding Austria to the required places

        * (KlarnaCountry enum) : Adding Austria
                            (getCountry) : Adding Austria
                            (getCodeHelper) : Adding Austria
                            (getCurrency) : Adding Austria
                            (getLanguage) : Adding Austria

        * (KlarnaEncoding) : Adding Austria

        * (getLanguage) : Assigning Austria&#39;s language
                            (getLanguageForCountry) : Adding Austria

Date: 2012-01-16
            Changed return type from String to String[] to properly handle the response from Klarna Online.
        (addTransaction, reserveAmount, setAddress):
            Tweaked printDebug output to be more readable.

        Implemented toString method.

Date: 2011-12-07
    * (createDigest):
        Added forcing of ISO-8859-1 encoding to resolve a bug where platforms built in UTF-8 would not generate the same SHA2 hash as platforms built in ISO-8859-1 if using addTransaction with special characters in the product names (for example &Atilde;&yen;&Atilde;&curren;&Atilde;&para;).

Date: 2011-11-17
    * Resolved a bug that prevented purchases from German and Dutch customers using house numbers containing letters and not only digits.
    * checkILT:
        Updated to new specifications.
    * Refactoring and restructuring:
        Done everything possible to retain backwards compatibility.
    * setReference:
        If no first or lastname is set on the billing address, no longer set a lonely &quot;,&quot;.
    * validateIP:
        No longer crashes if the IP-address checked is null, instead a proper Exception is thrown.
    * addTransaction, reserveAmount, activateReservation:
        Added support for KlarnaMobile purchases.
    * MySQLStorage:
        New storage option for pclasses.
    * JsonStorage.load():
        No longer crashes if the file supplied is empty or non-existant.
    * KlarnaPClass:
        Added a default constructor to support deserialization.
    * addArticle:
        Properly check if either article number or title are set, no longer requires both.
    * fetchPClasses():
        Uses configured country to fetch if no arguments are supplied.
    * KlarnaCountry enum:
        Added getLanguage() and getCurrency() methods.
    * made some previously &quot;protected&quot; internal methods &quot;package private&quot;.
    * Added options to create a full klarna instance from the constructor. You are no longer required to use the config() function but it is still available if you want to.
    * Overload Objects with expected primitive types to reduce risk of NullPointerExceptions.
    * Updated Candice URL to it&#39;s new address.
    * Letting Klarna Online validate input in all address fields to minimize the risk for faulty validations.
    * Removed some JavaDocs from the Dependencies folder. They weren&#39;t needed and inflated the file size.

Date: 2011-08-15
    * fetchPClasses:
        Simplified some castings between int and double to prevent
        rare bug with pclass saving.
    * KlarnaPClass:
        removed CamelCase on fields to make JSON more consistent with PHP and Python APIs.

Date: 2011-07-28
    * Check ILT
    * SHA-2 hash instead of MD5
    * Bugfixes

Date: 2011-07-01
    * Added Enums where possible.

Date: 2011-06-22
    * Complete rewrite