3
votes

I am getting the following error message after I have uploaded my code on live server

[error_message] => Error connecting to AuthorizeNet

I am using AIM and same code is giving proper response on our development server. When I upload it on my live server then it is not working

2
Show your code including any config you may have - John Conde

2 Answers

3
votes

1st. Update your SDK library, there is a cert.pem file that, if outdated will generate that error.

2nd. You can disable ssl verify peer to avoid this error. However try 1st option always.

$yourIPNInstance->VERIFY_PEER = false
3
votes

Extending Arnold Roa's answer above, which was specifically referring to the Authorize.net IPN gateway.

Setting the VERIFY_PEER also works for Authorize.net AIM gateway.

Keep in mind that setting VERIFY_PEER = false is a TEMPORARY patch. Don't plan to leave it like that.

$transaction = new AuthorizeNetAIM()
$transaction->VERIFY_PEER = false;

It's a good idea to update the SDK on the regular. However, since updates often break more things than they fix, it's possible to update the cert.pem file without updating the entire SDK / code library.

If you're getting

Error connecting to AuthorizeNet

and you haven't updated the SDK code / directory in years then it's most likely because your SDK has an older, now deprecated, SHA1 certificate file. It uses that lib/ssl/cert.pem file to compare to the certificate sent back by secure.authorize.net and make sure they match. This is an added layer of security to protect.

If you replace the contents of lib/ssl/cert.pem with the full contents of the latest cert.pem from the PHP SDK repository https://github.com/AuthorizeNet/sdk-php/blob/master/lib/ssl/cert.pem then the error should go away.

After you've replace the cert.pem file remember to re-enable the peer verification, like

    $transaction->VERIFY_PEER = true;

That should fix it, at least until Authorize.net gets a new certificate (usually every 3-4 years), at which point you'd need to update the cert.pem file, or the full SDK, again.