我尝试将klarna付款集成到opencart。
我从klarna得到一个client_token,因此显示了iframe。
下一步是对测试数据进行授权。
不幸的是我得到了 { “ show_form”:否, “已批准”:false }
返回。
我发送以下测试脚本:
<script>
try {
Klarna.Payments.init({
"client_token":"<?php echo $klarna_client_token ?>"
})
} catch (e) {
// Fehler anzeigen
alert(e);
}
Klarna.Payments.load({
container: '#klarna-payments-container',
payment_method_category: 'pay_later'
}, function (res) {
console.log(JSON.stringify(res, null, 4));
})
Klarna.Payments.authorize({
payment_method_category: "pay_later"
}, {
billing_address: {
given_name: "Omer",
family_name: "Heberstreit",
email: "omer@Heberstreit.com",
title: "Herr",
street_address: "Hermannstraße 64",
street_address2: "",
postal_code: "53225",
city: "Bonn",
phone: "+491522113356",
country: "DE"
},
order_amount: 10,
order_tax_amount: 0,
order_lines: [{
type: "physical",
reference: "19-402",
name: "Battery Power Pack",
quantity: 1,
unit_price: 10,
tax_rate: 0,
total_amount: 10,
total_discount_amount: 0,
total_tax_amount: 0,
product_url: "https://www.estore.com/products/f2a8d7e34",
image_url: "https://www.exampleobjects.com/logo.png"
}],
customer: {
date_of_birth: "1970-01-01",
}
}, function(res2) {
console.log(JSON.stringify(res2, null, 4));
})
</script>
<div id="klarna-payments-container"></div>
它应该工作,因为它来自klarna的官方测试数据。 有人知道,为什么它不起作用?
问候