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?

  • Please add the error you see in your logs file in here – PassTeT Dec 9 '16 at 3:30
  • @Ankit Shah, I am facing this issue so if you found the solution for this kindly share here – Vigna S May 9 '17 at 9:59
  • @Vigna Since last few months not getting this error. If there is error due to your custom module. So need to check var/log & solves issue – Ankit Shah May 9 '17 at 10:01
  • ok, I will check!!! – Vigna S May 9 '17 at 10:54
  • Is it sorted out ? – Jai Sep 19 '17 at 11:58

10 Answers 10


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.

  • after vendor / theme/ what is the following folder? Magento_Payment / templates?? – styzzz May 19 '18 at 2:06
  • @styzzz it will be like app/design/frontend/[Vendor]/[theme]/Magento_Payment/templates/transparent/iframe.phtml – Abbas Jun 8 '18 at 1:37
  • it's working fine – Naveen Kumar Nov 28 at 5:49

the following link is not a solution but a way to debug your cause



The solution that worked for me, was to change the generic "An Error Occured on the Server", to "Credit Card Declined. Please check credit card details and billing address". . .

To do this, you need to edit


edit line:

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

You can find a copy of iframe.html in vendor/magento and move it to your theme to make this change.


This means that an exception was thrown somewhere in your application, execution was terminated and the exception was handled. I believe the exception is being thrown in vendor/magento/module-checkout/Model/PaymentInformationManagement.php.

If you inspect the response of the rest call in your network tab you will see that there was a json object returned that should have a stack trace of where the error was generated. If you want the actual error to display, you can update this exception handling to output $e->getMessage() instead of the generic display message or inject the Psr/logger and log it out to your log directory.

The best way for you to prevent this is to track down what is throwing an exception and resolve the exception.


We have also seen this same error when a person's credit card fails. A very generic error.

In our case since we sell overseas... it is usually the card holder needs to call their bank and just let them know it is a legitimate payment transaction they are trying to submit.


In my case enabling single-store mode then disabling it solved the problem.

  1. Go to Stores -> Configuration -> General Set 'Enable Single-Store Mode' to Yes.
  2. Go to System -> Cache Management and click 'Flush Magento Cache'.
  3. Go to Stores -> Configuration -> General Set 'Enable Single-Store Mode' to No.

This is occurs due your third party extension or your own custom module syntax error present in module files.

If you want to see the actual error in your code, you can run the command on terminal.

  sudo php bin/magento setup:di:compile 

enter image description here

enter image description here

In my case syntax error mention by red circle in above snapshot (semicolon is not use in array).

I have replaced semicolon to comma.

Note : After remove syntax error again run command.

    sudo php bin/magento setup:di:compile 

Now clear cache.

Note : If above solution is not working, the disable your custom or third party extension

        sudo php bin/magento --clear-static-content module:disable Module_Name

enter image description here

  • Sudo will probably wreck your installation file permissions – Pathfinder Dec 28 '18 at 3:31

I got same issue and it was a silly md5 hash code mistake. Please use shorter md5 code. I was using too long md5 string so it wasn't working after make it shorter it is working perfectly!


Please go to vendor/magento/module-checkout/Model/PaymentInformationManagement.php Functions: savePaymentInformationAndPlaceOrder() Change line 85 and 90 with follow code:

throw new CouldNotSaveException( __($e->getMessage()), $e );

After that, please try to checkout and you can see the error message.


In my case problem was in State/Province/Region field in address. After filling this field the order was placed correctly.


  • set required on Region field


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.