0

Magento 2.2.3 Authorize.Net Direct Post

When a transaction is denied, for whatever reason, Magento shows a generic message

An error occurred on the server. Please try to place the order again.

at the top of the page.

Autorize.Net is returning an informative denial message in the x_response_reason_text return field.

Is there a reason that message is not displayed to the customer?

Is there a way to show that message to the customer?

As it stands, if the customer were to make a mistake typing in their credit card information and submit the transaction, Authorize.Net would return "The credit card number is invalid." in the x_response_reason_text field. If that message were to be displayed to the customer, they would be able to correct their card number and resubmit the transaction. As it stands, the customer would most likely assume there is an error on the server.

1 Answer 1

1

Is there a reason that message is not displayed to the customer?

For security reasons because of Authorize.net can return also sensitive error messages.

Is there a way to show that message to the customer?

Magento 2 Authorize.net Direct Post integration based on transparent redirect (uses iframe communication). And uses app/code/Magento/Payment/view/frontend/templates/transparent/iframe.phtml template, so you can override this template and show error messages from Authorize.net at your own risk.

Current iframe.phtml has a section to process errors - https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Payment/view/frontend/templates/transparent/iframe.phtml#L29-L46 and shows generic "An error occurred on the server. Please try to place the order again." error message.

1
  • Thanks, Joni. That's exactly what I needed to know. I would like to have a way to show selective messages to the customer. I may work on an extension for that. Commented Apr 5, 2018 at 12:10

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.