Klarna Docs - Multi-step checkout (redirect flow)

Multi-step checkout (redirect flow)

This section caters to those who require data validation or deal with intricate shipping and discount code logic after a consumer proceeds through the Klarna review screen.

1. Set auto_finalize to false

In order to initiate a multi-step checkout, you need to set the auto_finalize flag to false in the initial authorization call.

JAVASCRIPT
on_click: (authorize) => {
  // Here you should invoke authorize with the order payload.
  authorize({ auto_finalize: false }, payload, (result) => {
    // The result, if successful contains the authorization_token
  });
};

2. Add the finalization step

To finalize the purchase, implement the authorize() and finalize() calls.

During a multi-step checkout process, once the user obtains authorization, the response will no longer include the authorization_token. Instead, you will receive the flag finalize_required set to true. In order to obtain the authorization_token, you must call Klarna.Payments.finalize() during the final purchase step.

JAVASCRIPT
<!doctype html>
<html>
  <head>
    <script>
      window.klarnaAsyncCallback = function () {
        Klarna.Payments.init({
          client_token: "your-client-token",
        });
        Klarna.Payments.finalize({}, payload, function (res) {
          // res = {

3. Get the authorization token

After invoking finalize(), if all the necessary steps are completed successfully, you will receive the authorization_token in the response. This token allows you to proceed with placing the order.