Error messages to string

Hi,

I’m trying to get a PHP string variable with the error message.

$api_response = $client->getPaymentsApi()->createPayment($body);
if ($api_response->isSuccess() 
 
      success!

}else{
   $error_message =   _____________ Here is code I need
}

I been trying to figure this out for hours but am not able to extract only the detailed error message :confused:

In our example we get the details with echo json_encode($response->getErrors());. :slightly_smiling_face:

1 Like