Troubleshooting the Redirect, Pay for order and Blocks checkout flow

Last modified:

The checkout flow in Nexi Checkout is constructed in a way that a WooCommerce order will be created first (in Pending status), then the Nexi 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 Nexi (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 Nexi Checkout payment gateway.

I see pending orders in WooCommerce, is something wrong?

As mentioned above – you can have pending orders in WooCommerce with Nexi 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. Create order (POST)

"id":"nexi-order-id","type":"POST","title":"Create order"

When the customer first visits the checkout page, a new Nexi checkout session is created. This session will remain, and will be re-used until it has been cleared. Along with the session, a Nexi payment ID is created to identify this specific session.

This event should happen once.

2. Payment created webhook listener hit

"Payment created webhook listener hit {\"id\":\"nexi-order-id\",\"merchantId\":merchant-id

This will be logged once, as your store receives a callback from Nets regarding a payment being created. An action is then scheduled that will further process the order (see step 6).

This event should happen once.

3. Confirmation endpoint hit for order

“order-id: Confirmation endpoint hit for order."

This event is triggered once as the confirmation page is first hit, and the order is confirmed in WooCommerce. The Nexi checkout session is then cleared.

This event should happen once.

4. Confirm the Nexi order from the confirmation page

“order-id: Confirm the Nexi order from the confirmation page."

This event is triggered once as the confirmation page is first hit, and the order is confirmed in WooCommerce. The Nexi checkout session is then cleared.

This event should happen once.

5. Get order admin (GET)

"id":"nexi-order-id","type":"GET","title":"Get order ( admin )"

We retrieve the order from Nexi to get the data needed to confirm the order.

This event should happen once.

6. Execute Payment created API callback

"Execute Payment created API callback. Payment ID:nexi-order-id. Order number: wc-order-id. Amount: order-amount"

This is logged as the scheduled payment created follow-up action (scheduled in step 2) is executed. After this, we’ll check if the order is already processed, or needs to be set to confirmed/completed.

This event should happen once.

7. Aborting Payment created API callback

"Aborting Payment created API callback. Order wc-order-id(order-id) already processed."

This is logged if the order is already confirmed in WooCommerce.

This event should happen once.

Additional Order Management logs

Cancel an order

1. Order Management – Get order admin (GET)

"id":"nexi-order-id","type":"GET","title":"Get order ( admin )"

Logged as we attempt to get the order from Nexi to confirm this as an existing order that isn’t already cancelled, before cancelling the order.

This event should happen once.

2. Order Management – Cancel order (POST)

"id":"nexi-order-id","type":"POST","title":"Cancel order"

The order status in WC was set to “Cancelled”. We’ll issue a request to Nexi to update the order status to “Reversal” in their system.

This event should happen once.

Refund an order

1. Order Management – Refund order (POST)

"id":null,"type":"POST","title":"Refund order"

The order status in WC was set to “Refunded” (fully or partially). We’ll issue a request to Nexi to update the order status to “Refund” in their system.

This event should happen once.