Search code examples
magentomagento-1.5

How to cancel an order when a payment gateway page timesout in magento


i have integrated a 3rd party payment gateway into magento. It handels a successful transaction or a failed transaction perfectly.

But what if when the user is at the payment gateway page and it times out or when at the payment gateway page the user closes the page and returns back to the site later or user simply hits the back button,

  • how do i cancel the order then?
  • Should i use some observer to do this?
  • If so could you suggest to which events do i need to fire the observer?

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, the order is still created, which ideally should have been canceled.

Thanks.


Solution

  • Your validation methods should not be session aware and should process any feedback (and validate before you process) in any case. You also need a monitoring service that times out orders without a response after some time if you need them to be disabled in timely fashion.

    However if user hits back button there is really nothing you can do as the feedback from payment gateway never gets sent on user action. I know some payment gateways issue automatic post from the server no matter what you have to investigate if this can be also possible with your payment gateway.