Пример #1
0
<?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');
$invNo = '31402485123226872';
try {
    $k->creditInvoice($invNo);
    echo "OK\n";
} catch (Exception $e) {
    echo "{$e->getMessage()} (#{$e->getCode()})\n";
}