I want to improve the error messaging on PayPal for customers who get an error when checking out. The problem is that many errors report the message An error occurred on the server. Please try to place the order again..

This is the message even if the response coming back from PayPal is "Transaction is declined.". That's a problem since the error is not accurate and doesn't give the customer the information they need. This message seems to pop up if my billing address doesn't match the card.

I'm seeing "Transaction is declined" when I output <?php echo $params['error_msg'];?>. I realize that in Magento_Payment/templates/transparent/iframe.phtml I can edit this text or echo that error_msg.

So, my question: is it safe to replace An error occurred on the server. Please try to place the order again. with <?php echo $params['error_msg'];?>? I don't want the output of error_msg to be sensitive info from PayPal that the customer shouldn't see (like account ID ### has not paid their bill...lol).

Or am I better off replacing the text with something hardcoded like "There was an error with your card. Please make sure your credit card details are correct and your billing address matches the address on your card."?


Magento team recommend that you do not replace high level errors with low level errors for security. But personally it's your choice. I find confused customer means confused client means busy developer.

If you want to be selective about the wording that comes through you could use the magento translation mechanism and translate some of the wording to more meaningful wording.


  • This is not helpful and does not answer the question. – Thomas Bennett May 23 at 20:23
  • I edited my answer to clarify. – Dominic Xigen May 24 at 23:02

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.