Opening this issue, referencing #7983, as it still needs to be properly addressed.
Whenever there is a decline of any sort from Braintree, the message is not passed back to the user. Rather, the end user simply sees "An error occurred on the server. Please try to place the order again." This makes no sense, as it wasn't a server error... it was a processor decline of some sort.
We have seen this issue for "Invalid Credit Card Number", "Voice Authorization Required", and others. Pretty much any time Braintree doesn't approve the transaction, it will look like a server error to the end user. This needs to be fixed. I would do it myself, but I am having trouble figuring out exactly where in the code to override the response.
As @joni-jones mentioned, "Magento provides only high-level errors by design it allows to make an application more secure." This may be true, but telling the end user that the error is on the server, rather than an issue with the card they provided, is not acceptable. We're losing enough business over this that we're already looking at switching to another payment gateway.
Check out with Braintree payment option
Give any payment info that will cause a decline
Either:
We are also having the same issue. Which version of Magento are you using?
@cowley, from our experience this has been the case on both 2.0 and 2.1. We are currently running 2.1.4.
@cowley, from our experience this has been the case on both 2.0 and 2.1. We are currently running 2.1.4.
Do you still have this issue on 2.1.4? Have you come up with a fix?
Yes, we still have the issue on 2.1.4.
hi @sbrendtro, thank you for reporting the issue! Some of error messages have been fixed by MAGETWO-53457 for 2.2.0, some errors cannot be fixed from security perspective or they come from server side. I created additional ticket MAGETWO-66917 for messages to investigate what could be improved, and MAGETWO-66918 - to investigate possible approaches for successful order placement without payment.
We have seen the same error, and while we have not implemented it yet, the approach we have in mind is to create a "around" interceptor plugin for the savePaymentInformationAndPlaceOrder method on PaymentInformationManagementInterface and PaymentInformationManagementInterface.
This would:
CouldNotSaveException exception thrown by the core method$e->getPrevious()) is an instance of Braintree_Exception (or if we want to be more restrictive, the particular subclass), then rethrow that original exception, allowing its message to be passed to the front-end.CouldNotSaveException.This could be bundled into its own module and open sourced (we'll do if if we get a chance), which would be helpful in the the long term if Magento ultimately decides they don't want to reveal these messages in the core code.
Thank you for your submission.
We recently made some changes to the way we process GitHub submissions to more quickly identify and respond to core code issues.
Feature Requests and Improvements should now be submitted to the new Magento 2 Feature Requests and Improvements forum (see details here).
We are closing this GitHub ticket and have moved your request to the new forum.
@piotrekkaminski: this is categorically not a feature request. Telling users that there has been an error on the server just because they entered their credit card information wrong is a bug.
@piotrekkaminski , I completely agree with @scottsb. This is precisely why I created this as a bug, not a feature request. Please reopen.
Agree with @scottsb and @sbrendtro here. This is most def a bug, @piotrekkaminski
I agree with @scottsb and @sbrendtro and @JamesonNetworks . This is DEFINITELY a bug and not something that should ever be displayed to a end-users as it makes it look like there is a functional problem, not that their payment input is a problem. @piotrekkaminski - Better error handling is never a feature request.
how is this issue still not being addressed @piotrekkaminski
assuming you have not gotten satisfaction on this @sbrendtro @scottsb @cowley ?
@ikender, starting 2.2.4 release, Magento will provide possibility to customize errors from payment gateway. Braintree integration, also, will have such feature.
We already published the developer documentation, so please, wait upcoming release.
Starting in 2.2.4, you can map and customize error messages returned by payment gateways. Devdocs: https://devdocs.magento.com/guides/v2.2/payments-integrations/payment-gateway/error-code-mapper.html
While it is good that there is what I consider to be a workaround in 2.2.4, I think it is unacceptable that we need to do additional development work to provide proper error messages for a "Recommended Solution" in the Magento Admin. Now anyone using Braintree must duplicate this effort instead of this being done once by Magento and included in the code. It is like buying a car and the turn signals don't work. But don't worry - here is a kit that you can install. Not acceptable at all.
@clish1, Braintree integration in Magento has mapping for error messages (starting from 2.2.4). What kind of an additional work are you talking about?
@joni-jones We are on Magento 2.2.4 but we still need to do the configuration as shown in the devdocs link here - correct?
https://devdocs.magento.com/guides/v2.2/payments-integrations/payment-gateway/error-code-mapper.html
Why would we need to do this and not just have this as part of the standard Magento?
If you are using out of the box Magento Braintree - no, if you are using custom integration - yes.
Most helpful comment
@piotrekkaminski: this is categorically not a feature request. Telling users that there has been an error on the server just because they entered their credit card information wrong is a bug.