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