<?php require_once dirname(dirname(__FILE__)) . '/Klarna.php'; // Dependencies from http://phpxmlrpc.sourceforge.net/ require_once dirname(dirname(__FILE__)) . '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc'; require_once dirname(dirname(__FILE__)) . '/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc'; $k = new Klarna(); $k->config(0, 'sharedSecret', KlarnaCountry::SE, KlarnaLanguage::SV, KlarnaCurrency::SEK, Klarna::BETA, 'json', './pclasses.json'); // Replace cart with new items $k->addArticle(4, "MG200MMS", "Matrox G200 MMS", 299.99, 25, 0, KlarnaFlags::INC_VAT); $k->addArticle(1, "", "Shipping fee", 14.5, 25, 0, KlarnaFlags::INC_VAT | KlarnaFlags::IS_SHIPMENT); $k->addArticle(1, "", "Handling fee", 11.5, 25, 0, KlarnaFlags::INC_VAT | KlarnaFlags::IS_HANDLING); // For information on what else you can update, refer to the documentation $rno = '123456'; try { $k->update($rno); echo "OK\n"; } catch (KlarnaException $e) { echo "{$e->getMessage()} (#{$e->getCode()})\n"; }