window.klarnaAsyncCallback = function () {
window.Klarna.Payments.Buttons.init({
client_id: "klarna_live_client_ZWx6bkphLS8tN1psaU5yWUVheGtpbE4lVmpRNHV0Y0QsN2Y5OGJiODMtZTZiZC00ZTQ2LTlmMjktNDhkZGRmMjNiZGFiLDEsaTFZODh1N2tGeEFGMHRYaEUyRDNUQXFCYUxYYWl2MVVTYmN5dGdpMzROaz0",
}).load(
{
container: "#container",
theme: "default",
shape: "default",
on_click: (authorize) => {
// Here you should invoke authorize with the order payload.
authorize(
{ collect_shipping_address: true },
payload, // order payload
(result) => {
// The result, if successful contains the authorization_token
},
);
},
},
function load_callback(loadResult) {
// Here you can handle the result of loading the button
},
);
};