Vote up!
Vote down!

Customers using the browser back button duplicates payment / changes status

I'm finding that on a fairly regular basis customers are using the browser back after they have successfully made a payment. I'm using the commerce_sagepay module and the developer doesn't seem to respond to this issue.

The main problem is when they are taken to the 3d secure page and successfully complete then use back it changes the status back to checkout review. If they press back again or refresh it they allows them to make another payment for the same order.

Is there anything I can do to prevent this happening?

Asked by: dottodotdesign
on July 2, 2015

1 Answer

Vote up!
Vote down!

This is a problem with a lot of ecommerce sites which they normally let users know that they SHOULD NOT press back buttons after paying, or reload the page, as it could cause their payment to duplicate.

Since you can't modify the browser's behavior of the back button and disable it on certain pages, what you can do is use the following to setup an alert that is shown to warn people about what they are doing

window.onbeforeunload = function(){
return "Pressing the Back button may result in your payment being processed again and your order not being processed properly.";

Answer by: Travis
Posted: Aug 13, 2015