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
10-21-2015 12:10 PM
You can search the github
https://github.com/AuthorizeNet/sdk-php/search?utf8=%E2%9C%93&q=getAuthCode
10-21-2015 01:26 PM
Thanks. I did that well before I posted this message. No luck or mention or examples of retrieving the errortext.
10-22-2015 03:16 PM