magento2: Payment Failed Email not working as intended

According to documentation, an email should be sent “if the payment method that is chosen during checkout fails to complete the transaction.”

Looking at the code, the sendPaymentFailedEmail() method is called only in Magento\Multishipping\Controller\Checkout\OverviewPost class and in Magento\Checkout\Controller\Onepage\SaveOrder class.

I made a couple of tests and in my environment, trying a couple of different payment methods, Magento never run those controllers. So, even if the payment fails, the email notification is not sent.

This behaviour is very different from Magento 1, where the merchant receives effective notifications and can monitor checkout/payment problems.

Preconditions

  1. Magento CE 2.1.8
  2. PHP 7.0.22-2+ubuntu16.04.1+deb.sury.org+4
  3. MySQL 5.7.19-0ubuntu0.16.04.1

Steps to reproduce

  1. Enable Cybersource payment method (or any other that require configuration) without configuring it
  2. Add a product to cart and proceed to checkout
  3. select Cybersource and input fake credit card information
  4. get the “An error occurred on the server. Please try to place the order again.” error message at checkout

Expected result

  1. the merchant should receive a failed payment email notification

Actual result

  1. no emails are sent

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 12
  • Comments: 31 (14 by maintainers)

Most upvoted comments

I’m working on this

This issue is still apparent in 2.3.3-p1. the latest PR, https://github.com/magento/magento2/pull/23106, was closed due to inactivity. Can we get it re-opened and fixed?