Use the Klarna JavaScript SDK to finalize an authorization.
In a multistep checkout, your customer can change any order details after the payment selection step (for example, on an order review page). If you have a multistep checkout and you authorize
Klarna at the payment selection step, you might need to finalize
the purchase with Klarna when your customer has reviewed the order. The authorization of the purchase must always happen at the end of the purchase when the customer clicks the Buy button.
To finalize a purchase in a multistep checkout, use the authorize
call at the payment selection step and the finalize
call when the customer clicks the Buy button.
You need to finalize the authorization only if you have a multistep checkout.
If you're starting a new Klarna payments integration, we recommend that you authorize the purchase at the very last step in the checkout. For more information, refer to our best integration practices for multistep checkouts.
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 in your checkout.
If the response of the authorize call indicated that finalize_required
is true
you need to call finalize()
when the customer reaches the last page at checkout to finish the purchase. This call triggers the actual authorization and returns the authorization_token
.
In a successful response, you get an authorization_token
to create an order. For more details about the possible responses, see the Get authorization section of the documentation.