Troubleshooting the checkout flow

  1. Home
  2. /
  3. Klarna Payments for WooCommerce
  4. /
  5. Troubleshooting
  6. /
  7. Troubleshooting the checkout flow

Troubleshooting the checkout flow

The Checkout flow in Klarna Payments is constructed in a way that a WooCommerce order will be created first (in Pending status), then the Klarna order is placed, and finally the WooCommerce order is updated to Processing status. This flow is more compatible with other WooCommerce plugins.

This checkout flow also means that Pending orders can be visible in WooCommerce, where the payment has not been finalized in Klarna (for example card payment where there was not enough funds on the card). This is part of the general WooCommerce checkout flow, and it does not implicate that something is wrong. It is just a new scenario for the Klarna Payments payment gateway.


I see pending orders in WooCommerce, is something wrong?


As mentioned above – you can have pending orders in WooCommerce with Klarna Payments as the payment method without any errors in your store. These might just be orders not finalized by the customer.

However, if you want to troubleshoot this a bit closer, here’s how you do it.

  • Make sure that you have turned on Logging in the plugin settings.
  • The logs can be found by navigating to WooCommerce  Status  Logs.

Klarna Developer logs


The Klarna Developer logs allows you to inspect the technical communication (API calls) between your back office and Klarna.

Read more in the Klarna Developer logs section.


Order creation step by step


Order creation step by step and how to debug and follow it in the log

Some of these events happen one time in the order creation, while others can happen multiple times. We have added a note to each event on whether you should expect to find it in the log once or several times.

1. Create session (POST)

"type":"POST","title":"Create session"

When customers visit the checkout page, a new checkout session is initiated. This session includes data about which Klarna payment methods to display to the customer, and a session ID for identifying, and referring to this session.

This event should happen once.

2. Update session (POST)

"type":"POST","title":"Update session"

If a change happens on the checkout page that Klarna needs to know about (e.g., the selected shipping option is changed, the customer’s address is changed, or the cart items has been modified), we need to let Klarna know about this. This is referred to as a “session change”. To let Klarna know which session needs to be updated, we use the session ID that was created in step 1.

This event can happen multiple times.

3. Successfully placed order

"Frontend JS : Successfully placed order. Starting authorization with Klarna"

When the customer clicks on the “Place order” button, we issue a request to Woo to validate the checkout data. If something is wrong, we’ll display a generic “Internal Server Error” message to the customer, and log the actual reason. For security reasons, we don’t display the actual reason to the customer.

If the validation is successful, a pending payment order will be created by Woo, and we inform Klarna to proceed with authorizing the purchase. When this happens, you’ll see the above message in the log, and Klarna will display a modal on the checkout page to the customer. Since this modal is managed by Klarna, the Woo store (including our plugin) has no access to what it contains, and what will appear.

This event usually happens once. 

4. Place order (POST)

"type":"POST","title":"Place order"

When the customer has been authorized by Klarna, and the purchase is considered complete (as indicated by the modal disappearing), the Woo store will be informed so that it can take action. At this point, we’ll send the merchant reference number to Klarna and the URL to redirect the customer to (i.e., the confirmation URL), and save any metadata related to the Woo order. When this has happened, you’ll see the above message in the Woo logs.

This event should happen once, but if the “Place order” fails, the process may be repeated.


Other events that can appear in the log


Test credentials (POST)

{"type":"POST","title":"Test credentials"When you modify your API

When you modify your API credentials, we’ll verify if they’re valid, and display an error message otherwise. This will appear in the log as if we’re creating an order.


Errors that might happen


  1. Checkout error
    If the order creation didn’t go as expected you might see a Checkout error. This is caused by WooCommerce validation NOT being successful (e.g., coupon errors, subscription that require login, no stock, required fields not being filled, terms and conditions checkbox not being accepted). This should happen between steps 2 and 3.

    If the Woo checkout validation fails, a checkout error will occur. This means the Woo store (the server) successfully received the request, but the Woo validation logic considers the checkout data to be invalid. A pending payment Woo order will only be created if this validation has succeeded at least once.
  2. AJAX error
    If the order creation didn’t go as expected you might see a AJAX error in the log. If you see the AJAX error you need to talk to your developer or the support. This is most likely caused by a third party plugin, or other code. This should happen between steps 2 and 3.

    An AJAX error can occur if the request to validate the Woo checkout fails to be sent or received. That is, the request is never sent, or a reply is never received. Unlike a checkout error, no validation has occurred. As a result of this, no Woo order will be created.

Possible scenarios with errors


  1. Your customer claims that nothing happens after they have signed with BankID, instead they get a white screen or they get redirected back to the cart.
    If your last log entry (with a specific klarna order id) is Frontend JS your-klarna-order-id: Successfully placed order. Sending \"should_proceed: true\" to Klarna. then there is most likely something wrong in Klarnas system (or in the communication between Klarna and BankID/3DSecure/the acquiring bank). For more information in these cases you need to contact your regions Klarna Merchant Support as the KP plugin/Krokedil don’t have access to the log data after this step. This happens between step 3 and 4.
  2. Order note on WC order: “Customer aborted purchase with Klarna.”
    If the customer closes the modal without completing the purchase, we’ll add the following order note to the pending payment Woo order: “Customer aborted purchase with Klarna.” This happens in step 3.
  3. Order note on WC order: “Authorization rejected by Klarna.”
    If Klarna rejects the authorization for reasons unknown to us, or if it fails, as indicated by a missing authorization token (generated by Klarna), we’ll add the following order note: “Authorization rejected by Klarna.” This happens in step 3.
  4. Browser console error:  “No authorization_token in response”
    If the authorization token is missing, if you inspect the browser console, you’ll find the following entry: “No authorization_token in response”. This happens in step 3.