Klarna Docs - Finalize an authorization

Finalize an authorization

Use the Klarna JavaScript SDK to finalize an authorization.

You need to finalize the authorization only if you have a multi-step checkout offering payment methods that pull funds directly from the customer, such as bank transfer or Sofort.

In a multi-step checkout, your customer can change any order details after the payment step (for example, on an order review page). If you have a multi-step checkout and your customer selects Pay now as the payment method, you need to finalize an authorization. With Pay now, the funds transfer happens after your customer clicks the Buy button at the end of the purchase.

To finalize a purchase, use the authorize() and finalize() JavaScript calls happening on the client side.

Authorize() call

During the authorization step, call authorize() with the auto_finalize parameter set to false. In this way, you indicate that there's an upcoming finalization step.

JAVASCRIPT
Klarna.Payments.authorize(
{ payment_method_category: ‘pay_now’, auto_finalize: false},
{},
function(res) {
// proceed to next checkout page. The finalize_required property in the response indicates
// if finalize is needed or not.
//
// res = {
//   show_form: true,
//   approved: false,

Sample of the authorize() for finalizing the authorization.

Finalize() call

Call finalize() when the consumer reaches the last page at checkout to finish the purchase. This call triggers the transfer of funds and returns the authorization_token.

JAVASCRIPT
Klarna.Payments.finalize(
{payment_method_category: ‘pay_now’},
{},
function(res) {
// res = {
//   show_form: true,
//   approved: true,
//   authorization_token: ...
// }
})

Sample of the finalize() for finalizing the authorization.

You can use finalize() with other payment methods and you get the authorization_token in return.

In a successful response, you get an authorization_token to create an order. For more details about the possible responses, see Get authorization section.