Troubleshooting the checkout flow

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

Troubleshooting the checkout flow

The checkout flow used for this plugin can result in Pending orders existing in WooCommerce, where the payment has not been finalized in Walley. This is part of the general WooCommerce checkout flow, and it does not implicate that something is wrong.

The WooCommerce order is created first (in Pending status), then the Walley order is placed, and finally the WooCommerce order is updated to Processing status. This update is more compatible with other WooCommerce plugins.


I see pending orders in WooCommerce, is something wrong?


As mentioned above – you can have pending orders in WooCommerce with Walley 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.

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. Access token (POST)

"id":null,"type":"POST","title":"Access token"

The access token is used for authenticating the merchant, and is required in all API calls. It automatically expires at a known interval (5 minutes).

This event happens whenever the access token expires or when the merchant updates the plugin settings.

2. Initialize checkout (POST)

"id":"","type":"POST","title":"Initialize checkout"

When customers visit the checkout page, a new checkout session is initiated. This action generates a fresh Walley order ID that will be linked to the ongoing session.

This event should happen once.

Walley order status: “Initialized”

3. Get checkout (GET)

"id":"walley-order-id","type":"GET","title":"Get checkout"

This request is made whenever Walley 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, that a customer enters the billing address in the embedded payment form and clicks on the “Continue to delivery” button can be a trigger for this event. Also appears in the log when/if the customer is adding/changing billing details, or changing shipping details.

This event can happen more than once.

Walley order status: “Initialized” or “CustomerIdentified”

4. Update checkout (PUT)

"id":"walley-order-id","type":"PUT","title":"Update checkout"

Whenever a change occurs in WooCommerce, we need to notify Walley about it. We achieve this by issuing a PUT 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 the embedded Walley payment form.

For instance, if a new item is added to the cart or if the quantity of an item is modified, a PUT request is sent to inform Walley about these changes. 

This event usually happens more than once.

5. onBeforePayment from Walley triggered

"Frontend JS "walley-order-id": onBeforePayment from Walley triggered"

When the customer clicks on the place order button, we’ll need to run checks to verify that the customer and cart data is still valid (e.g., no coupon errors, the products are in stock). If the checks succeed, Successfully place order will be logged, and a pending payment order will be created. Otherwise, Before payment error | reason will be logged.

This event can happen more than once in case the cart is modified, or if/when the customer clicks on the place order button again after a previous check failed.

6. Set order reference (PUT)

"id":"walley-order-id","type":"PUT","title":"Set order reference"

After a WooCommerce order is created, and we now have an ID to refer to this order, we’ll send this ID (order reference) to Walley.

This event should happen once.

7. Successfully placed order

"Frontend JS "walley-order-id": Successfully placed order."

The customer data is valid, the cart data is valid, and a pending payment order was created successfully.

This event can happen more than once if the cart is modified or if/when the customer clicks on the place order button again after a previous check failed. In case the cart was modified, and a pending order has already been created, it will be re-used (i.e., no new order will be created).

8. Get checkout (GET)

"id":"walley-order-id","type":"GET","title":"Get checkout"

Between the time the customer is redirected from the checkout page to the thank-you page, we need to check if any changes have happened at Walley. For this reason, we issue a GET request to Walley. For example, whether the order has the expected order status, or if we need to take into account a different order status.

Walley order status: “PurchaseCompleted”

9. Order ID … confirmed on the confirmation page

"Order ID "your-order-number" confirmed on the confirmation page. Walley payment ID: "walley-payment-id"."

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.

10. Notification Listener hit

"Notification Listener hit. Private id: “walley-order-id”. Public token: “public-XX-token”. Customer type: b2c/b2b"

We’ve received a callback from Walley. This callback is for verifying that the order is in sync between Walley and the WooCommerce store. This callback will be scheduled for processing.

WooCommerce order info: Payment via Walley Checkout → Payment via Walley Checkout (walley-order-id)

This event should happen once.

11. Thankyou page rendered

"Thankyou page rendered for order ID - "walley-order-id""

This indicates that the thank you page was rendered correctly for the order.

This event should happen once, but will also happen every time the thank-you page is refreshed.

12. Check for order in API callback

"Check for order in API-callback. Private id: ”walley-private-id”. Public token: “your-public-token”

This event is triggered by the action scheduler, and will happen 2 minutes after the callback was received. At this point, the customer has completed the purchase. However, in case the order was not processed correctly by WooCommerce (e.g., the customer didn’t return to the store after being redirected to a different app for authentication or authorization), we’ll always receive this callback to verify that both Walley and the WooCommerce store are in sync.

This event should happen once.

13. Aborting API callback

"Aborting API callback. Order … Private ID “walley-private-id” …already processed."

If the order already has been processed in WooCommerce, the callback is aborted.

A server-to-server request was received (“callback”) from Walley about the order. Since a valid, already processed, corresponding WC order already exists, no further processing is required.

This request happens after the purchase has been finalized in the Walley checkout.


Errors that might happen


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). This should happen between steps 5 and 6 in the order creation.

AJAX error

If the order creation didn’t go as expected you might see a AJAX 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 steps 5 and 6 in the order creation.


Possible scenarios with errors


Timeout

"Frontend JS walley-order-id: Checkout error | Error message: Timeout"

The onBeforePayment event took too long to complete.

One example of when this occurs is when you try to finalize the order when the order total in WooCommerce and order total in the Walley iframe differs.
This leads to an Order total mismatch error which is visible in the log above the Timeout Checkout error explained above: "Order total mismatch in process_payment. Woo order total: …. Walley order total: … (cart:..., shipping: …, delivery module: ).". The reason for why the order sum differs might be that the merchant have enabled the Walley nShift delivery setting in the plugin settings in WooCommerce but are not using the Walley Shipping Module as shipping method in the WooCommerce setting shipping Zones → Shipping methods.

This should happen between steps 5 and 6 in the order creation.

Temporary error

This error message comes from Walley and is visible in the Walley iframe, this is usually visible when you are trying to finalize the purchase but something goes wrong in Walley. One scenario is that the payment option that the customer chooses is not working at the moment or that Walley is having temporary server issues.

It could also be due to timeout, the order taking too long to process in the Finalize Checkout process. Walley has a timeout set to 30 seconds and when the order takes more than 30 seconds this error will appear. This issue can be hard to find since the plugin is not logging any specific log regarding this more than the Temporary error being visible in the checkout. But one way to check if the issue is regarding timeout is to count how many seconds is between the first Get checkout and Set order reference after the onBeforePayment from Walley triggered in the log.

This should happen between steps 5 and 6 in the order creation.

When this error appears most often the log ends with a validation from the plugin that the order is Successfully placed order but no Notification Listener hit /confirmation from Walley is logged since the order was not completed in the checkout.


Other log messages you can see


[LOG] Order status not set correctly for order (Processing/Completed)

Order status not set correctly for order … during checkout process. Setting order status to Processing/Completed in API callback.

A server-to-server request was received (“callback”) from Walley about the order. The corresponding Walley and WooCommerce order status don’t match. Depending on the status, further actions will be taken. In this case, the Walley order has been completed, but the WC order has not. The WC “payment_complete” flow will be triggered, which amongst other things sets the order status to “Processing” (or “Completed” depending on the order content).

When? This request is issued after the purchase has been finalized in the Walley checkout.

[ORDER NOTE] Order status not set correctly for order (On Hold)

Order status not set correctly for order your-order-number' during checkout process. Setting order status to On hold.

A server-to-server request was received (“callback”) from Walley about the order. The corresponding Walley and WooCommerce order status don’t match. The order is either (1) awaiting electronic signing by the customer or (2) pending approval by Walley. Accordingly, the WC order will be set to on-hold.

When? This request is issued after the purchase has been finalized in the Walley checkout.

[LOG] API-callback executed.

API-callback executed. We could NOT find Private id … '(with public token … & customer type …. Aborting process.

A server-to-server request was received (“callback”) from Walley about the order, but no WC order associated with the corresponding Walley order could be found. This is an unrecoverable error, so we’ll abort further processing.

When? This request is issued after the purchase has been finalized in the Walley checkout.

[LOG] Update Collector order reference for order

Update Collector order reference for order - …

Update the Collector Order with the WooCommerce Order number, old API.

Set the merchant reference in the Walley order. This merchant reference is the corresponding WC order number.

When? This usually happens when the purchase is about to be finalized in the Walley checkout, but may also happen after it has been finalized.

Notification Listener hit.

'Notification Listener hit. Private id: … Public token: … Customer type: … ‘

Schedule order status check on notificationUri callback from Collector
A server-to-server request was received from Walley about the order with the associated private ID. This request has been scheduled for processing within 120 seconds.

When? After the order has been finalized in the Walley checkout.

[LOG] HTTP/1.1 400 Bad Request

'collector_check_for_order callback already scheduled. '

Schedule order status check on notificationUri callback from Collector.

A server-to-server request was received from Walley about the order with the associated private ID. The order has already been scheduled for processing in WC. No further actions will be taken. We’ll respond with 400 to indicate that no further callbacks should be sent.

When? After the order has been finalized in the Walley checkout.

[LOG] Order total mismatch in process_payment.

'Order total mismatch in process_payment. Woo order total: … . Walley order total: … (cart: …, shipping: … , delivery module: …'

Message: ‘It seems like the WooCommerce and Walley total amount differs. Please, try again.’, ‘collector-checkout-for-woocommerce’

Check that order totals match between WC and Walley

When? While processing the checkout, when the order is about to be finalized, but it fails. This is part of the onBeforePayment event.

[LOG] Thankyou page rendered for order ID – …

This indicates that the Walley order was successfully placed, and the confirmation snippet from Walley should now have been rendered to the customer.

When? After the order has been finalized, and the customer has been redirected to the confirmation page.

[LOG] Trying to display checkout … exist in order id.

'Trying to display checkout but status is PurchaseCompleted. Private id ' . $private_id . ', exist in order id ' . $order_id . '. Redirecting customer to thankyou page.' )

The Walley order has already been finalized (completed), but the customer either was not redirected to the confirmation page or returned to the checkout page. Attempting to redirect to the confirmation page again.

When? While on the checkout page, but this should not happen.

[LOG] Trying to display checkout … no correlating order id.

Trying to display checkout but status is PurchaseCompleted. Private id ' . $private_id . '. No correlating order id can be found.

The Walley order has already been finalized (completed), but the customer either was not redirected to the confirmation page or returned to the checkout page. We could not identify a WC order associated with the private ID. No further actions will be taken.

When? While on the checkout page, but this should not happen.