setConfig($config); */ /** Configure the Klarna object using the config() method. (Alternative 2) **/ //Specify the values: /* $k->config( $eid = 0, $secret = 'sharedSecret', $country = KlarnaCountry::DE, $language = KlarnaLanguage::DE, $currency = KlarnaCurrency::EUR, $mode = Klarna::BETA, $pcStorage = 'json', $pcURI = '/srv/pclasses.json', $ssl = true, $candice = true ); Klarna::$xmlrpcDebug = false; Klarna::$debug = false; */ /** Configure the Klarna object using the setConfig() method. (Alternative 3) **/ //KlarnaConfig::$store = true; //This is default to true, so this is just to be more detailed. //Set the config which loads from file /srv/klarna.json: $k->setConfig(new KlarnaConfig('/srv/klarna.json')); /* The file would contain the following data to set the same information as the above alternatives: { "eid": 0, "secret":"sharedSecret", "country": 81, "language": 28, "currency": 2, "mode":0, "pcStorage":"json", "pcURI":"\/srv\/pclasses.json", "ssl": 1, "candice": 1, "xmlrpcDebug":0, "debug":0 } */ /** * 2. Load the PClasses from the local file or MySQL table. */ /* PClasses are loaded from the local storage, as defined by "pcStorage" and "pcURI". */ //Load all PClasses available. $pclasses = $k->getPClasses( $type = null //Here we can define a specific type of PClass we want to load (KlarnaPClass::CAMPAIGN, for instance). ); //Next we might want to display the description in a drop down menu: echo ""; //When the customer has confirmed the purchase and chosen a pclass, you can easily grab just that one by doing: $pclassId = $pclasses[0]->getId(); //Let's say the customer picked the first one $pclass = $k->getPClass($pclassId); // Next we can use $pclassId in the addTransaction call or in the reserveAmount call.