Get started
Customization
Checkout flow logic
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 checkout flow
- Customer navigates to the checkout page in WooCommerce. If Walley Checkout is the selected (or default) payment method, an Initialize Checkout Session request is sent to Walley.
- Walley responds with a publicToken that is used do display the embedded checkout (via JavaScript) on the WooCommerce checkout page and a privateId that is used to communicate with Walley throughout the purchase.
- When the customer identify herself in the Walley Checkout, a JS event is triggered. The Walley Checkout for WooCommerce 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 Walley.
- When the customer clicks the Pay button in Walley Checkout, a onBeforePayment JavaScript event is triggered by Walley.
- The standard WooCommerce checkout form is submitted by the Walley Checkout plugin, with customer data that we receive from Walley, 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.
- If the order creation went well, the Walley Checkout plugin responds with a Promise.resolve message in the JavaScript event (if something went wrong during the order creation process the plugin will respond with a Promise.reject message and Walley will not finalize the purchase. Instead an error notice will be displayed for the customer).
- Provided that the Walley Checkout plugin respond with a Promise.resolve message, Walley then finalizes the purchase in their system.
- When the purchase is completed by the customer, Walley redirects the customer to the confirmation URL.
- The Walley Checkout plugin confirms the WC order and trigger 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). - The WooCommerce order received page is rendered and displayed for the customer.