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."?

2 Answers 2


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. May 23, 2019 at 20:23
  • I edited my answer to clarify. May 24, 2019 at 23:02

We're having the same issue. The problem is that error message is misleading and ambiguous. There should be a way to soft update that message in Magento or maybe Magento should have provided a default message that made sense when a CC is declined...like..."please check your credit card info, for some reason it didn't go through" Anything but what it states now "an error occured on the server" wtf man that's nothing even close to CC is declined on any level.

I can't believe Magento/Adobe hasn't solve this yet. The clients experiencing this are using CE 2.4.1 and CE 2.3.6

Maybe Magento is silently punishing us for using CE? As i digress.

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.