config( 123456, // Merchant ID 'sharedSecret', // Shared Secret KlarnaCountry::SE, // Country KlarnaLanguage::SV, // Language KlarnaCurrency::SEK, // Currency Klarna::BETA, // Server 'json', // PClass Storage '/srv/pclasses.json', // PClass Storage URI path true, // SSL true // Remote logging of response times of xmlrpc calls ); // OR you can set the config to loads from a file, for example /srv/klarna.json: // $k->setConfig(new KlarnaConfig('/srv/klarna.json')); /** * 2. Retrieve the PClasses from Klarna. */ try { $k->fetchPClasses(); // You can specify country (and language, currency if // you wish) if you don't want to use the configured // country. /* PClasses successfully fetched, now you can use getPClasses() to load them locally or getPClass to load a specific PClass locally. */ echo "Fetched " . count($k->getAllPClasses()) . " pclasses.\n"; } catch(Exception $e) { // Something went wrong, print the message: echo "{$e->getMessage()} (#{$e->getCode()})\n"; }