Magento – Magento 2: An error occurred on the server. Please try to place the order again

addresscheckoutmagento2ordersshipping

When user want to checkout sometimes i got below message.

enter image description here

After correction of Billing & Shipping Address Sometimes user able to place order some times not.

Due to this customer not able to order.

What will be the perfect solution for this?

Best Answer

You may echo the actual error message on this file: vendor/magento/module-payment/view/frontend/templates/transparent/iframe.phtml if you did not extend the file yet or if you did you may edit this on app/design/[vendor]/[theme]/ go to line 42 and replace this

   message: $t('An error occurred on the server. Please try to place the order again.')

with this

    message: $t('<?php echo $params['error_msg'];?>')

In my case, when the customer purchased using Credit card via Payapal Gateway I was able to trace the error message on this file vendor/magento/module-paypal/Model/Payflow/Service/Response/Validator/ResponseValidator.php

The payment was actualy declined with the response code ESPONSE_CODE_FRAUDSERVICE_FILTER but magento will display the default error message instead of showing Fraud Error message.

Related Topic