1

In web app i'm redirecting my user to payment gateway's URL to complete the transaction. After successful payment user will be redirected back to my web app.

Problem is, if user hits browser back button he/she will again go back to payment gateway's URL which will redirect the user back to my web app with stale payment status.

Yes i can handle stale payment status in backend, but how do we handle browser history?

When user lands in the web app's payment status page can i somehow delete the browser history paths related to payment gateway's URLs?

sravis
  • 3,562
  • 6
  • 36
  • 73
  • facing the same problem in PayPal express checkout and spend the whole day to find some suitable solution but still no joys – Mobeen Sarwar Jul 01 '19 at 09:56

1 Answers1

0

Try this from preventing user to go back https://www.aspsnippets.com/Articles/Disable-Browser-Back-Button-Functionality-using-JavaScript.aspx

This is pretty dramatic behavior, and not a very friendly one for the user...

Another solution is to recognize when user is getting out of your page via onbeforeunload confirm() on window.onbeforeunload inform that he is getting out if the payment method, via prompt() https://www.w3schools.com/jsref/met_win_prompt.asp

Yonatan Ayalon
  • 1,959
  • 18
  • 19