Reply
Member
Posts: 3
Registered: ‎10-21-2015

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

Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Newbie - How to get declined results PHP SDK Hello World

Member
Posts: 3
Registered: ‎10-21-2015

Re: Newbie - How to get declined results PHP SDK Hello World

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