window.klarnaAsyncCallback = function () {
window.Klarna.Payments.Buttons.init({
client_id: "klarna_live_client_cChGKWtFRUJYaE9UMkxvN3o1IVBZWjRab21VRHFaJU0sN2JiM2Q2Y2ItMzllNi00NWFkLTg3ZDktYjIyZWZjYjNhM2U1LDEsR2Z3QTI1dTE1SEgyQW5FUURqQXNtYk1tbnlKTVNLTTA0dFpZdWRNUW5mcz0",
}).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
},
);
};