1

when I canceled the order or payment fail the order has been canceled automatically, but actually when the payment fails the order status has not changed to canceled in magento2.

3
  • Which Payment method you are using? Commented Dec 12, 2018 at 9:53
  • I am using Payumoney Payment gateway
    – Meera
    Commented Dec 12, 2018 at 10:05
  • dose any one know how to change this code so it dosnt cancel order but retrieves the cart else { $this->_createVivaPaymentsComment($message); $this->_order->cancel()->save(); $this->_messageManager->addError("<strong>Error: </strong>" .__('Your transaction failed or has been cancelled! Please Try an alternative payment card.'). "<br/>"); $this->_redirect('checkout/cart'); } }
    – Alex Beck
    Commented Jul 10, 2019 at 13:06

1 Answer 1

0

Sorry for the late reply but this ay help. not so sure about it but for me it is working.

$this->_cancelPayment();
            $this->_checkoutSession->restoreQuote();
            $this->getResponse()->setRedirect(
                $this->getPaytmHelper()->getUrl('checkout')
            );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.