Get started
Customization
Troubleshooting
- Embedded checkouts in WooCommerce
- Checkout blocks in WooCommerce
- Error codes
- Compatible plugins
- Known compatibility issues
- Shipping Methods in iframe
- FAQ
- Optimizing your checkout when using an Iframe-based checkout
- Callbacks
- Troubleshooting the checkout flow
- Troubleshooting the Pay for order/Hosted Payment Page flow
- Troubleshooting WooCommerce Subscriptions and KCO
- Klarna Developer logs
- Pending payment orders and held stock
Klarna support information
Additional Klarna plugins
Troubleshooting the checkout flow
From version 2.0 of Klarna Checkout for WooCommerce the checkout flow has changed.
The WooCommerce order will now be created first (in Pending status), then the Klarna order is placed, and finally the WooCommerce order is updated to Processing status. This update is more compatible with other WooCommerce plugins.
The new 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 Checkout payment gateway.
I see pending orders in WooCommerce, is something wrong?
As mentioned above – you can have pending orders in WooCommerce with Klarna Checkout 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. KCO create order (POST)
"id”:”your-klarna-order-id","type":"POST","title":"KCO create order"
When customers visit the checkout page, a new checkout session is initiated. This action generates a fresh Klarna order ID that will be linked to the ongoing session.
This event should happen once.
2. KCO get order (GET)
"id":"your-klarna-order-id","type":"GET","title":"KCO get order"
This request is made whenever Klarna notifies us about a change that occurred in the embedded payment form. We need to retrieve the updated form data from them in such cases. It’s important to note that this type of request can occur multiple times.
For instance, when a customer enters the billing address in the embedded payment form and clicks on the “Continue” button can be a trigger for this event.
This event can happen more than once.
3. Set chosen shipping method
"Set chosen shipping method for your-klarna-order-id [\"flat_rate:1\”]”
This situation occurs when the shipping options are displayed within the embedded payment form (<iframe>). It is triggered when there is a change in the chosen shipping method within WooCommerce (WC). Typically, this change is initiated either by Klarna Shipping Assistant (KSA) defaulting to a standard WC shipping method or by a third-party plugin.
This event can happen more than once.
4. KCO update order (POST)
"id":"your-klarna-order-id","type":"POST","title":"KCO update order"
Whenever a change occurs in WC, we need to notify Klarna about it. We achieve this by issuing a POST request. It’s important to note that this type of request can occur multiple times, and the changes made may not always be immediately reflected in Klarna’s embedded payment form.
For instance, if a new item is added to the cart or if the quantity of an item is modified, a POST request is sent to inform Klarna about these changes.
This event can happen more than once.
5. Validation_callback from Klarna triggered
"Frontend JS your-klarna-order-id: validation_callback from Klarna triggered"
When the customer clicks the Place order button in the Klarna iframe, the above log entry will be added to the log file.
This event usually happens once, but can happen more times if there are any changes to the order.
6. Extra shipping debug
"Extra shipping debug: {\"kco_order_id\":\"your-klarna-order-id\",\"wc_order_shipping\":\"Flat rate\”
This debug data allows us to check for any discrepancies between WC and Klarna. It helps us compare the selected shipping option in WC with the saved Klarna shipping option.
This event usually happens once, but can happen more times if there are any changes to the shipping method.
7. KCO update confirmation (POST)
{"id":"your-klarna-order-id","type":"POST","title":"KCO update confirmation"
In this sequence the Klarna Checkout (KCO) plugin populates the address fields in the regular WooCommerce checkout form and submits the form. If the WooCommerce validation is successful (e.g., no coupon errors, the products are in stock), a new pending order is created in WooCommerce.
This event usually happens once, but can happen more times if the WC cart hash has been changed. Then you will also see that another WC order is created. More common is that it updates the existing WC order.
8. Order was successfully processed
"Order WC order ID (your-klarna-order-id) associated with [customer@email.com] was successfully processed."
WooCommerce has successfully validated the checkout form, and created a pending payment order.
This event usually happens once.
9. Successfully placed order
"Frontend JS your-klarna-order-id: Successfully placed order. Sending \"should_proceed: true\" to Klarna"
If the order creation went well you should now see this in the logs. The plugin now hands over the checkout process to Klarna, and the Klarna modal window opens.
This event usually happens once, but can happen more times if the customer for example cancels the purchase through Klarna’s modal window, returns to the store to add another product and then proceeds to the checkout again.
10. Confirm the Klarna order from the confirmation page.
"your-klarna-order-id: Confirm the klarna order from the confirmation page."
This indicates that the purchase process was completed, and the customer was successfully redirected to the confirmation (thank you) page.
This event should happen once.
11. KCO get order management order (POST)
{"id":"your-klarna-order-id","type":"POST","title":"KCO get order management order"
This is where the plugin gets the order from Klarna’s order management API.
This event should happen once.
12. KCO acknowledge order (POST)
{"id":"your-klarna-order-id","type":"POST","title":"KCO acknowledge order”
Klarna requires that we acknowledge that the order was completed successfully. This confirms that the acknowledgment was issued to Klarna.
This event should happen once.
13. KCO set merchant reference (PATCH)
{"id":"your-klarna-order-id","type":"PATCH","title":"KCO set merchant reference"
Updates the Klarna order to include the WC order ID and WC order number.
This event should happen once.
14. Fraud status accepted
"your-klarna-order-id: Fraud status accepted for order WC order ID. payment_complete triggered."
If the payment went well, you should now see this in the log (where WC order ID is replaced by your WooCommerce order number)
This event only applies to some regions and should in that case happen once.
15. KCO get order (GET)
"id":"your-klarna-order-id","type":"GET","title":"KCO get order"
This request is made when the customer has landed on the confirmation (thank you) page and Klarna has changed the order status from checkout_incomplete
to checkout_complete
(indicating the customer has been authorized successfully).
This event can happen more than once.
Errors that might happen
- Checkout error
If the order creation didn’t go as expected you might see aCheckout error
. This is caused by WooCommerce validation NOT being successful (e.g., coupon errors, subscription that require login, no stock). This should happen between step 5-7 in the order creation. - AJAX error
If the order creation didn’t go as expected you might see aAJAX error
. 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 step 5-7 in the order creation.
Possible scenarios with errors
- 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) isFrontend 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 KCO plugin/Krokedil don’t have access to the log data after this step. This happens between step 9-10. - Something went wrong in the confirmation step
If this happens we have a backup function (server-to-server call) running and then you will see aConfirm the klarna order from the thankyou page
in the logs. This happens in step 10 in the order creation. - When a customer has been sent back to the order confirmation page after BankID identification, they click the Pay order button again before they are redirected to the Thank you-page.
There is an issue with the Pay order button not being locked sometimes during the Klarna checkout process. This makes it possible for the customer to click the button again, if they think the order did not go through. The result is that a new order is created that has the same Order ID, but with the status Pending payment.
Klarna are aware of the issue and are currently working on a fix that will lock the button during this time. If you want to confirm that this is what has happened you can check in your logs for a"Frontend JS your-klarna-order-id: validation_callback from Klarna triggered"
call between step 9 – 13, which should not be there. The Pending payment order that has been created should only exist in WooCommerce and the customer has not been charged twice.