vippsas/vipps-woocommerce

Vipps on same mobile device opens directly; leaves checkout page hanging

iverok opened this issue · 4 comments

Affects both Woo Checkout and Express Checkout. Probably won't affect Vipps Checkout.

The issue is that when using Vipps on the same device, the app opens directly without going through a Vipps Landing Page. As a result, the checkout page(s) will stay in a "spinning" state. If the user returns to the browser directly, or completes the payment or aborts it, a new tab will open for the result. Thus the old tab will stay spinning until it reloads.

For express checkout: just do a redirect to home-url or the waiting page for the order after the window.location.replace that starts the deeplink. This will only do anything if the system started the external app.

For new versions (5.2.0) of the Woo checkout, there is 'checkout_place_order_success' triggered on success. It does exist since version 4, but without access to the result. So one can augment the result with a method and a deeplink-thing with

  checkout_form.on( 'checkout_place_order_success', function(e, result) {
     if (result['method']) ..
  • but of course this doesn't work with the Gutenberg Checkout block.

For the Gutenberg block, it should suffice to check props.checkoutStatus.isComplete && props.paymentStatus.isSuccessful in the Vipps payment method node. But this at least knows what payment method was chosen. Normal checkout doesn't (though it can check the page itself); however it is safe to augment the result-object from the payment gateway to provide more metainfo.

So anyway, with these three hooks/places, add a setTimeout call that after ~10 seconds redirects to some other page, preferrably the waiting page incase the user uses the "return to app" thing.

Scheduled for 1.7.22

Much delayed, and absolutely not planned for 1.7.22 any more.