2

In Magento 2, I am using brain-tree credit card payment method on live site. Sometimes it shows error, unable to place an order, please try after sometimes but I want to know exact error on front end side about that transaction declined. I want error handling for Braintree credit card payment so that it makes easy to know the reason behind failed payment.

0

As far as I know, Magento 2 use Ajax to handle this task. enter image description here

We should take a look at file:

vendor/magento/module-checkout/view/frontend/web/js/model/place-order.js

      return storage.post(
            serviceUrl, JSON.stringify(payload)
        ).fail(
            function (response) {
                errorProcessor.process(response, messageContainer);
                fullScreenLoader.stopLoader();
            }
        );

So, we need to override this file or the errorProcessor.process() - vendor/magento/module-checkout/view/frontend/web/js/model/error-processor.js handler. We can alert the error message.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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