the issue i am facing is that when a user is redirected to a payment gateway and he/she hits the back button and comes back to the site or exit the browser , the order is still created, which ideally should have been canceled. I want to fire a observer when ever a order is created and if the order is not in processing state after about 15 min (say for a time out) i want to cancel the order. But not sure how to handle the scenario when the user hits the back button or exit from browser when at the payment gateway page.
Share
you have put a flag in your database (ie iscompleted). when starting a new transaction put the flag in false. if successful transaction change the flag value to true. For an unsuccessful transaction, wait till timeout and remove the order it has iscompleted flag is false.