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.
- API credentials
- Java => 1.5
- json-simple (Project Home)
- apache httpclient (Project Home)
- apache commons-codec (Project Home)
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 =========================== v3.0.0 ---------------- Date: 2015-06-02 Klarna <email@example.com> Update resource constructors. Only allow creation with IDs instead of full URIs v2.0.0 ---------------- Date: 2015-05-21 Klarna <firstname.lastname@example.org> Adding support for recurring orders. v1.1.3 ---------------- Date: 2014-11-28 Klarna <email@example.com> Correcting User-Agent header issues v1.1.2 ---------------- Date: 2013-12-06 Klarna <firstname.lastname@example.org> Correcting version number in pom.xml v1.1.1 ---------------- Date: 2013-09-12 Klarna <email@example.com> Fixing compilation issues in jdk 1.5 v1.1.0 ---------------- Date: 2013-03-15 Klarna <firstname.lastname@example.org> Increased default socket timeout value. Added a method to set socket timeout on the IConnector interface. v1.0.0 ---------------- Date: 2012-12-21 Klarna <email@example.com> Initial release.
- API credentials
- Java >= 1.6
- apache commons (codec, lang, logging) (Project Home)
- google-gson (Project Home)
- guava-libraries (Project Home)
- json_simple (Project Home)
- apache ws-commons-util (Project Home)
- apache ws-xmlrpc (client, common) (Project Home)
Downoad and compile source or use precompiled jars.
Include on your project library path.
================================================= Klarna Java API ================================================= 3.1.0 ---------------- Date: 2015-05-22 Story (#2135) (Christer G.) - Add extend_expiry_date method. 3.0.1 ---------------- Date: 2015-02-25 Bug (#2011) (David K.) - Patch rounding issue in APR caculation 3.0.0 ---------------- Date: 2014-07-09 Story (#1680) (Joakim L.) - Remove updateNotes and reserveOCRemail functions. 2.5.0 ---------------- Date: 2014-03-20 Story (#1529) (Rickard D.) - Deprecate usage of Candice. 2.4.1 ---------------- 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 2.3.1 ---------------- Date: 2013-04-05 Rickard D. <firstname.lastname@example.org> Klarna.java Allow 0 to be sent in as amount in Reserve Amount. 2.3.0 ---------------- Date: 2013-03-25 Rickard D. <email@example.com> KlarnaConfig.java Add Server setter to configure xml-rpc target server. Klarna.java Change default host for BETA integrations to the new testdrive server. 2.2.0 ---------------- Date: 2012-08-dd Christer G. <firstname.lastname@example.org> 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. <email@example.com> Goods.java (get, toInt) : altered PRINT_10 flag had an incorrect integer value. Rickard D. <firstname.lastname@example.org> Klarna.java (update) : new method Added Update method to easily update a reservation with new information. UpdateInfo.java () : added New internal class to hold the data used by Update. UpdateCall.java () : added New internal extension to XmlRpcCall class to assemble and perform the Update call. Klarna.java (activatePart) : altered Return type changed from String to HashMap<String, String> to match what Klarna Online responds with. Klarna.java (xmlrpc_call, sendStat) : refactored Refactored to new XmlRpcCall class. Methods remain but call the new class. Klarna.java (colon, pipe, createDigest) : refactored Refactored to new Digest class. Methods remain but call the new class. Klarna.java (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 instance. Added ActivateInfo to the clear and removeNullParams methods. ActivateCall.java () : new class Added class to build and perform the Activate call to Klarna. ActivateInfo.java () : new class Class to hold the optional information usable with the Activate call. XmlRpcCall.java () : new class Class to handle XmlRpc calls, to be extended by classes that assemble the needed data for their XmlRpc call. Digest.java () : new class Utility Class to handle various Digest related functions. KlarnaCountry.java () : Add UNDEFINED enum to return instead of null. Klarna.java (checkILT) : method removed Removed the checkILT functionality. ILTInfo.java () : class removed Removed along with checkILT. KlarnaFlags.java () : removed Class was deprecated in version 2.0.2 of the API and has been removed. Klarna.java () : Several overloads that used the old KlarnaFlags have been removed. Klarna.java (config) : Several deprecated overloads using nullable objects instead of primitive types removed. (ie Integer and Boolean instead of int and boolean.) Several member variables also changed from nullable objects to the primitive types. Most notably Klarna.BETA and Klarna.LIVE. KlarnaCalc.java (pRound) : Resolved an issue of a missing break causing an unwanted fallthrough in the switch statement. Klarna.java (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 'json' as the last string for it to work. Klarna.java (checkCountryCurrency) : overload removed A deprecated overload taking Object args and returning a nullable Boolean object was removed. Klarna.java (addArticle) : overload removed A deprecated overload taking nullable Integer and Double args was removed. Klarna.java (activateInvoice) : overload removed A deprecated overload taking nullable Boolean was removed. Klarna.java (updateGoodsQty) : overload removed The deprecated updateGoodsQty was removed in favor of updateGoodsQuantity(). KlarnaConfig.java (store) : member variable removed An unused protected member variable (store) removed. KlarnaEncoding.java (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 "throws"-declarations removed. Majid G. <email@example.com> * Klarna.java (_activateReservation) : Removing the condition for checking if PNO is empty or not. * Klarna.java (_activateReservation) : Removing getClientIP and also validating it * KlarnaFlags.java (Invoice enum) : Adding Deprecated to PRE_PAY * Invoice.java (Invoice enum) : Adding Deprecated to PRE_PAY * IAddTransaction.java (addTransaction) Removing the PRE_PAY's comment from * Klarna.java (returnAmount) : Adding description to this function's parameters * Klarna.java (getPNOEncoding) : Adding Austria to the required places * KlarnaCalc.java (getLowestPaymentForAccount) : Adding Austria to the required places * KlarnaCountry.java (KlarnaCountry enum) : Adding Austria (getCountry) : Adding Austria (getCodeHelper) : Adding Austria (getCurrency) : Adding Austria (getLanguage) : Adding Austria * KlarnaEncoding.java (KlarnaEncoding) : Adding Austria * KlarnaLanguage.java (getLanguage) : Assigning Austria's language (getLanguageForCountry) : Adding Austria 2.1.5 ---------------- Date: 2012-01-16 * Klarna.java: (splitReservation): 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. * KlarnaAddr.java: Implemented toString method. 2.1.4 ---------------- Date: 2011-12-07 * Klarna.java (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 Ã¥Ã¤Ã¶). 2.1.3 ---------------- 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 ",". * 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 "protected" internal methods "package private". * 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'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't needed and inflated the file size. 2.1.1 ---------------- 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. 2.1.0 ---------------- Date: 2011-07-28 * Check ILT * SHA-2 hash instead of MD5 * Bugfixes 2.0.1 ---------------- Date: 2011-07-01 * Added Enums where possible. 2.0.0 ---------------- Date: 2011-06-22 * Complete rewrite