Vote count: 0
Can anyone please let me know how exactly to install Klarna on a php website. So far my step where to prepare a checkout page following their documentation instruction and then I downloaded the sdk and put it on my root folder. The error I am getting is "Fatal error: Class 'Klarna\Rest\Transport\Connector' not found in /public_html/testsite/checkout.php on line 45". I am assuming something's wrong with the paths or maybe I need to include something more in my file. My php code on the page is this
$orderData = array();
$orderData['order_lines'] = array(
array(
"type" => "physical",
"reference" => "123050",
"name" => "Tomatoes",
"quantity" => 10,
"quantity_unit" => "kg",
"unit_price" => 600,
"tax_rate" => 2500,
"total_amount" => 6000,
"total_tax_amount" => 1200
),
array(
"type" => "physical",
"reference" => "543670",
"name" => "Bananas",
"quantity" => 1,
"quantity_unit" => "bag",
"unit_price" => 5000,
"tax_rate" => 2500,
"total_amount" => 4000,
"total_discount_amount" => 1000,
"total_tax_amount" => 800
)
);
$merchantUrls = [
'terms' => 'http://ift.tt/2kpy8qr',
'checkout' => 'http://ift.tt/2kFyKGY}',
'confirmation' => 'http://ift.tt/2kprnVS}',
'push' => 'http://ift.tt/2kFtmDG}'
];
$orderData['purchase_country'] = 'gb';
$orderData['purchase_currency'] = 'gbp';
$orderData['locale'] = 'en-US';
$orderData['order_amount'] = 10000;
$orderData['order_tax_amount'] = 2000;
$orderData['merchant_urls'] = $merchantUrls;
$connector = \Klarna\Rest\Transport\Connector::create(
'merchantId',
'sharedSecret',
\Klarna\Rest\Transport\ConnectorInterface::EU_TEST_BASE_URL
);
$checkout = new \Klarna\Rest\Checkout\Order($connector);
$checkout->create($orderData);
And somewhere inside my html I have this
$checkout->fetch();
echo "<div>{$checkout['html_snippet']}</div>";
Thanks in advance.
asked 37 secs ago
How to manually install Klarna on a php website?
Aucun commentaire:
Enregistrer un commentaire