Get started
Customization
- Home
- /
- Avarda Checkout for WooCommerce
- /
- Troubleshooting
- /
- Troubleshooting the checkout flow
Troubleshooting the checkout flow
The Checkout flow in Avareda Checkout is constructed in a way that a WooCommerce order will be created first (in Pending status), then the Avarda 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 Avarda (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.
I see pending orders in WooCommerce, is something wrong?
As mentioned above – you can have pending orders in WooCommerce with Avarda 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. ACO initialize payment (POST)
"id":"","type":"POST","title":"ACO initialize payment"
When customers visit the checkout page, a new checkout session is initiated. This action generates a fresh Avarda order ID that will be linked to the ongoing session.
This event should happen once.
2. ACO get payment (GET)
"id":"avarda-order-id","type":"GET","title":"ACO get payment"
This request is made whenever Avarda 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.
State: Initialized
This event will happen more than once.
3. ACO update payment (PUT)
"id":"Avarad-order-id","type":"PUT","title":"ACO update payment"
Whenever a change occurs in WC, we need to notify Avarda 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 Avarda’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 PUT request is sent to inform Avarda about these changes.
This event can happen more than once.
4. ACO get payment (GET)
"id":"avarda-order-id","type":"GET","title":"ACO get payment"
Same as step 2 but with another state.
State: InProcess
This event can happen more than once.
5. Received “beforeSubmitCallback” from Avarda
"Frontend JS avarda-order-id: Received \"beforeSubmitCallback\" from Avarda"
When the customer submits the order, Avarda will inform us of this event. At this point, we’ll request from WooCommerce to create a new “pending payment” order, and if this is successful, we’ll inform Avarda to proceed with the order. Otherwise, we’ll inform Avarda to abort the order submissions, which results in a customer-facing error.
This event usually happens once, but can happen multiple times if the order creation described above is unsuccessful or if the WooCommerce cart is modified.
6. Get Avarda purchase ID from session
"Get Avarda purchase ID from session. Order ID wc-order-id. Avarda purchase ID: avarda-order-id"
We’ve successfully processed the order, and it is at this step where we save all the crucial metadata about the order.
This event should happen only once, but if the customer was not redirected, it may happen again.
7. Processing order
"Processing order wc-order-id|wc-order-xxx (Avarda ID: avarda-order-id) OK. Redirecting to confirmation page."
We’ve successfully processed the order, and it is at this step where we save all the crucial metadata about the order.
This event should happen only once, but if the customer was not redirected, it may happen again.
8. Successfully placed order
"Frontend JS avarda-order-id: Successfully placed order. Sending \"beforeSubmitContinue\" true to Avarda"
This indicates that the response to the beforeSubmitContinue event was successful, the WooCommerce order was created.
This event should happen only once, but if the customer was not redirected, it may happen again.
9. Confirm the Avarda order from the confirmation page (GET)
"avarda-order-id: Confirm the Avarda order from the confirmation page. Order ID: wc-order-id"
This event happens when we handle the redirect to the confirmation. It indicates that the WooCommerce order was successfully acknowledged, and that the customer will now be redirected to the confirmation page.
This event should happen only once.
10. ACO get payment (GET)
"id":"avarda-order-id","type":"GET","title":"ACO get payment"
Same as step 2 but with another state.
State: Completed
This event can happen more than once.
11. ACO update order reference (PUT)
"id":"avarda-order-id","type":"PUT","title":"ACO update order reference"
Throughout the order process, the Avarda order has been having a temporary order number. At this step, now that we have a successful order, we’ll send its order number to Avarda so that they can update the corresponding order in their system.
This event should happen only once.
12. Notification callback hit (Callback)
"Notification callback hit for Avarda purchase ID: avarda-order-id. WC order ID: wc-order-id"
A server-to-server call always happens after the order in the Avarda is completed. This is to ensure that an order is still created in case an unrecoverable error occurred during checkout or if the customer closed the store page abruptly after confirming their purchase. You’ll always see this callback hit regardless of the outcome: whether the order was successful or not.
This event should happen only once.
13. Aborting notification callback (Callback)
"Aborting notification callback. Order wc-order-id (order ID wc-order-id) already processed."
The order has already been processed, no further actions will be taken.
This event should happen only once.
14. Order Management – ACO get payment (GET)
"id":"avarda-order-id","type":"GET","title":"ACO get payment"
While managing an order, we need to verify its state. Accordingly, we issue a GET request to Avarda to retrieve its current state.
State: Completed
This event can happen more than once.
15. Order Management – ACO activate order (POST)
"id":"avarda-order-id","type":"POST","title":"ACO activate order"
An activate order request is sent to Avarda to request them to capture the order. The response of this request indicates whether the capture was successful.
This event will happen every time the order is set to “Completed” until it has been verified as captured. At that point, a lock will be set to prevent this request from being issued again.
Other Order Management logs
Cancel an order
1. ACO get payment (GET)
"id":"avarda-order-id","type":"GET","title":"ACO get payment"
While managing an order, we need to verify its state. Accordingly, we issue a GET request to Avarda to retrieve its current state.
State: Completed
This event can happen more than once.
2. ACO cancel order (POST)
"id":"avarda-order-id","type":"POST","title":"ACO cancel order"
A cancel order request is sent to Avarda to request them to cancel the order. The response of this request indicates whether the cancellation was successful.
Refund an order
1. ACO get payment (GET)
"id":"avarda-order-id","type":"GET","title":"ACO get payment"
While managing an order, we need to verify its state. Accordingly, we issue a GET request to Avarda to retrieve its current state.
State: Completed
This event can happen more than once.
2. ACO Return (POST)
"id":"avarda-order-id","type":"POST","title":"ACO Return"
A refund request is sent to Avarda to request them to refund the order in part or whole. The response of this request indicates whether the refund was successful.
Integrated Shipping enabled
1. ACO get payment (GET)
"id":"avarda-order-id","type":"GET","title":"ACO get payment"
Includes ShippingModule data in response body. This event only happens when integrated shipping is enabled.
State: InProcess
This event can happen more than once.
2. Notification callback hit (Callback)
"Notification callback hit for Avarda purchase ID: avarda-order-id. WC order ID: wc-order-id"
A server-to-server call always happens after the order in the Avarda is completed. This is to ensure that an order is still created in case an unrecoverable error occurred during checkout or if the customer closed the store page abruptly after confirming their purchase. You’ll always see this callback hit regardless of the outcome: whether the order was successful or not.
This step also happens between step 8 and 9 when integrated shipping is enabled.
This event should happen only once.
3. Aborting notification callback (Callback)
"Aborting notification callback. Order wc-order-id (order ID wc-order-id) already processed."
This step also happens between step 8 and 9 when integrated shipping is enabled.
This event should happen only once.
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, timeout).
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.
Other log messages you can see
Check if session TimedOut
'Avarda session TimedOut (in aco_wc_get_avarda_payment function). Clearing Avarda session and reloading the checkout page.'
The current Avarda session has expired, and a new session will be created.
Maybe initialize payment
'Error when initializing Avarda payment: '
Failed to create a new Avarda session.
Handles notification callbacks. Triggered by Avarda 0-10 minutes after finalized purchase.
'Aborting notification callback for Purchase ID ' . $purchase_id . '. No WooCommerce order found.'
404 Not Found error.
Handle execution of payment created cronjob.
'Order status not set correctly for order ' . $order->get_order_number() . ' during checkout process. Setting order status to Processing/Completed in API callback.'
The WooCommerce order was not processed correctly, most likely the customer didn’t reach the confirmation page. We’ll attempt to process the order.
Check if we have an Avarda purchase id.
‘Avarda purchase ID is missing in update Avarda order function. Clearing Avarda session.’
The purchase ID is missing in the session. This is an unrecoverable error, and the only solution is to create a new session.
Check if JWT token in checkout is the same as the one stored in session.
'JWT token used in checkout (%s) not the same as the one stored in WC session (%s). Clearing Avarda session.'
For security reasons, the JWT token is out of date or has been modified. A new session with a new token will be created.
'Avarda JWT token issue. Please reload the page and try again.'
For security reasons, the JWT token is defective. A new session with a new token will be created.
Check that the currency and locale is the same as earlier, otherwise create a new session.
'Currency or language changed in update Avarda function. Clearing Avarda session and reloading the checkout page.'
Avarda doesn’t support updating the currency or language of an existing session. If these values change, we have to create a new Avarda session.
Check that no subscription product has been added or removed, otherwise create a new session.
'Subscription product changed in update Avarda function. Clearing Avarda session and reloading the checkout page.'
Check if we got a wp_error.
'Avarda GET request failed in update Avarda function. Clearing Avarda session.'
The Avarda order could not be updated. As this will result in the Avarda order becoming out of sync with WC, we have to create a new session.
If the update failed – unset sessions and return error.
'Avarda update request failed in update Avarda function. Clearing Avarda session.'
If no order is found, bail.
No WC order found in confirmation page. Avarda Purchase ID: '
'Something went wrong in the checkout process. Please contact the store.'
The customer was redirected to the confirmation page, but the order could not be found. This can be because the query parameters are missing or incorrect.
Ensure that the Avarda Checkout gateway is enabled.
'Avarda Checkout payment gateway is not enabled.'
If we have an Avarda session, ensure the currency matches the current currency for the store.
'Currency mismatch. The Avarda Checkout payment gateway is not available.'
The WooCommerce and Avarda checkout are using different currencies.
Avarda doesn’t support 0 value subscriptions.
'Subscription total is 0. The Avarda Checkout payment gateway is not available.'
Subscription payment method change.
Redirect to the receipt page and process the payment by displaying the ACO iframe via woocommerce_receipt_aco
hook.
'Processing order %s|%s (Avarda ID: %s) OK. Changing payment method for subscription.'
'Processing order %s|%s (Avarda ID: %s) OK. Redirecting to order pay page.'
Order pay.
'Processing order %s|%s (Avarda ID: %s) failed for some reason. Clearing session.'
Something went wrong. Unset sessions and remove previous purchase id from order.
Something went wrong.
'Avarda general error in process payment handler. Clearing Avarda session and reloading the checkout page. Woo order ID ' . $order_id . '. Avarda purchase ID '
Receipt page. Used to display the ACO iframe during subscription payment method change.
"Loading change payment template for Avarda checkout:..”
"Loading order receipt template for Avarda checkout:..”
Avarda checkout page.
Makes the request recurring payment.
'ACO authorize recurring payment'
Attempting to renew a subscription.
Update extra identifiers
'ACO update order identifiers'
Refund items in order.
'ACO Return'
Remove old payment data if a WooCommerce order already exists.
'Delete _wc_avarda_purchase_id, _wc_avarda_jwt, _wc_avarda_expiredUtc & _transaction_id during aco_wc_initialize_payment. Order ID: ' . $order_id . '. Avarda purchase ID: '
The metadata mentioned has been removed from the order. This is so that the WooCommerce order can be re-used in an existing session.
Initialize or update the Avarda payment.
'Avarda GET request failed in aco_wc_initialize_or_update_order. Clearing Avarda session.'
While checking if we need to update or initialize a new session, the required GET request to retrieve the Avarda order failed.
'Aborting update in aco_wc_initialize_or_update_order function since Avarda payment session %s in step %s.'
Make sure that the payment session step is ok for an update.
'Avarda update request failed in aco_wc_initialize_or_update_order function. Clearing Avarda session.'
If the update failed – unset sessions and return error.
Creates or updates an Avarda order for the Pay for order feature.
Avarda GET request failed in aco_wc_initialize_or_update_order_from_wc_order. Clearing Avarda session & order meta data.'
Check for a WP_Error.
'Aborting update in aco_wc_initialize_or_update_order_from_wc_order function since Avarda payment session %s in step %s.'
Make sure that the payment session step is ok for an update.
'Update session for %s|%s (Avarda ID: %s). Avarda order failed to update, initializing new checkout session.'
Try to update the order.
'Checkout session initialization failed for %s|%s (Avarda ID: %s). Check for "ACO initialize payment" error.'
If update order failed try to create a new order.
Check order total and compare it with Woo.
'Order total mismatch in order number: %1$s. Woo order total: %2$s, Avarda order total: %3$s (converted to minor units).'
Confirming purchase via callback
'Order status not set correctly during checkout process. Confirming purchase via callback from Avarda.'
While executing the scheduled callback, we found that the order was not processed correctly. Attempting to process it again.