cancel
Showing results for 
Search instead for 
Did you mean: 

Newbie - How to get declined results PHP SDK Hello World

Got "Hello World" example up and running great. But pulling hair out with trying to display errorText for decline:

 

Here's an untouched snippet from Hello World. You can see if there is an error, we need more info on the reason.

 

  if (($tresponse != null) && ($tresponse->getResponseCode()=="1"))
  {
    echo "Charge Credit Card AUTH CODE : " . $tresponse->getAuthCode() . "\n";
    echo "Charge Credit Card TRANS ID  : " . $tresponse->getTransId() . "\n";
  }
  else
  {
    echo "Charge Credit Card ERROR :  Invalid response\n";
  }
}  

 

I can not for the life of me, figure out how to display the errorText and errorCode. I have tried:

 

echo "Card declined reason: " . $tresponse->getErrors[0]->errorText;

and every possible variation of this you can imagine and nothing works. None of the examples or samples go beyond the "Hello World" example if declined.

 

I realize this may be 101 coding, but I can't figure this one out.

 

Thanks

Tunnelboy
Member
2 REPLIES 2
RaynorC1emen7
Expert

Thanks. I did that well before I posted this message. No luck or mention or examples of retrieving the errortext.