Custom json error message returned by PHP SDK API PAGSEGURO

-2

original post link

error returned: {"error": true, "errors": {"11014": "senderPhone invalid value: 312321312"}}

I can not print in my view this damn error for having reported a wrong phone. I just need to get this error nothing more .. already tried using a json_decode but it seems that the return of this api is a stdClass of PHP and is not an array ... Does anyone have a solution for these json returns of this api?

attempts:

1 - foreach ($ e-> getMessage () -> errors as $ key = > $ value) {

2 - help_msg_alert_warning (json_decode ($ e-> getMessage ()));

If I do something like this

help_msg_alert_warning ($ e-> getMessage ()); - > this will work but

Imagine just showing an error message in json to your end user .. do not even think about it.

    
asked by anonymous 03.01.2019 / 16:22

0 answers