Checkout flow logic

Last modified:

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

The different flows

Nexi Checkout has four different checkout flows – Inline embedded, EmbeddedRedirect and Overlay. These flows can be changed in the plugin settings.

  • Inline embedded is when the address data is entered through the WooCommerce checkout form, with payment methods integrated inline, directly alongside the form fields.
  • Embedded flow is a solution where Nexi Checkout is embedded in the WooCommerce checkout page and partially replaces the standard checkout page.
  • Redirect flow is a traditional payment flow where the regular WooCommerce checkout page is used and the customer is redirected to a payment window hosted by Nexi to finalize the purchase.
  • Overlay flow has similar logic to redirect flow, but the hosted payment window is displayed in an overlay on desktop.

Inline embedded checkout flow

Inline embedded and Embedded have a very similar flow, with two differences: where the customer’s address information is entered, and how a switch to or from Nexi Checkout as the payment method is handled.

  1. The customer navigates to the checkout page in WooCommerce and enters their address information directly in the standard WooCommerce checkout form fields (unlike Embedded, address data is not entered in the Nexi Checkout widget). If Nexi Checkout is the selected (or default) payment method, an initialize session request is sent to Nexi.
  2. Nexi responds with a paymentId that is used to display the embedded checkout (via JavaScript) on the WooCommerce checkout page.
  3. If the customer switches between Nexi Checkout and another payment method, the plugin detects the change and updates the session with Nexi accordingly.
  4. When the customer clicks the Pay button in Nexi Checkout, a pay-initialized JavaScript event is triggered by Nexi.
  5. The standard WooCommerce checkout form is submitted by the Nexi Checkout plugin, with customer data received from Nexi, and a pending order is created in WooCommerce. This order has not yet been paid for and you should not change the status to Processing/Completed manually.
  6. If the order creation went well, the Nexi Checkout plugin responds with a true message in the JavaScript event (if something went wrong during the order creation process, the plugin will respond with a false message and Nexi will not finalize the purchase. Instead, an error notice will be displayed for the customer). 
  7. Provided that the Nexi Checkout plugin responds with a true message, Nexi then finalizes the purchase in its system.
  8. When the purchase is completed by the customer, a payment-completed JavaScript event is triggered by Nexi.
  9. The Nexi Checkout plugin redirects the customer to the confirmation URL.
  10. The Nexi Checkout plugin confirms the WooCommerce order and triggers the WooCommerce function $order->payment_complete(). WooCommerce then decides if the order status should be set to Processing or Completed (depending on the types of items in the order).
  11. The WooCommerce order received page is rendered and displayed for the customer.

Embedded checkout flow

Embedded and Inline embedded have a very similar flow, with two differences: where the customer’s address information is entered, and how a switch to or from Nexi Checkout as the payment method is handled.

  1. The customer navigates to the checkout page in WooCommerce. If Nexi Checkout is the selected (or default) payment method, an initialize session request is sent to Nexi.
  2. Nexi responds with a paymentId that is used to display the embedded checkout (via JavaScript) on the WooCommerce checkout page.
  3. When the customer identifies themselves in the Nexi Checkout, a JS event is triggered. The Nexi Checkout plugin is listening for this event, updates the customer in WooCommerce and recalculates the cart. If anything changes (like the selected shipping method), an update checkout request is sent to Nexi.
  4. When the customer clicks the Pay button in Nexi Checkout, a pay-initialized JavaScript event is triggered by Nexi.
  5. The standard WooCommerce checkout form is submitted by the Nexi Checkout plugin, with customer data received from Nexi, and a pending order is created in WooCommerce. This order has not yet been paid for and you should not change the status to Processing/Completed manually.
  6. If the order creation went well, the Nexi Checkout plugin responds with a true message in the JavaScript event (if something went wrong during the order creation process, the plugin will respond with a false message and Nexi will not finalize the purchase. Instead, an error notice will be displayed for the customer). 
  7. Provided that the Nexi Checkout plugin responds with a true message, Nexi then finalizes the purchase in its system.
  8. When the purchase is completed by the customer, a payment-completed JavaScript event is triggered by Nexi.
  9. The Nexi Checkout plugin redirects the customer to the confirmation URL.
  10. The Nexi Checkout plugin confirms the WooCommerce order and triggers the WooCommerce function $order->payment_complete(). WooCommerce then decides if the order status should be set to Processing or Completed (depending on the types of items in the order).
  11. The WooCommerce order received page is rendered and displayed for the customer.

Redirect checkout flow

  1. The customer navigates to the checkout page in WooCommerce and enters address information in the checkout form fields.
  2. The customer selects Nexi Checkout as payment method and clicks the Place order button.
  3. pending order is created in WooCommerce.
  4. The customer is redirected to the Nexi Checkout payment window.
  5. The customer completes the purchase and gets redirected back to the store.
  6. The Nexi Checkout plugin confirms the WooCommerce order and triggers the WooCommerce function $order->payment_complete(). WooCommerce then decides if the order status should be set to Processing or Completed (depending on the types of items in the order).
  7. The WooCommerce order received page is rendered and displayed for the customer.
  8. Two minutes after the steps above are all completed, a callback is sent from Nexi to verify that everything went well.

Overlay checkout flow

The Overlay flow has the same logic as the redirect flow.