AuthorizeNet / sample-code-php

This repository contains working code samples which demonstrate php integration with the Authorize.Net API
MIT License
175 stars 197 forks source link

Error getting valid response from api. #109

Closed daniloparrajr closed 5 years ago

daniloparrajr commented 6 years ago

Sample code doesn't seem to work. I have the sample code cloned and have composer update with no errors. But when I try to run the sample code it gives me 'Error getting valid response from api' api-error

ashtru commented 6 years ago

Thanks for raising the issue, @danyaneh and apologies for the inconvenience.

This issue was caused by change in the certificate used for verification by the API endpoint. You can replace the .../lib/ssl/cert.pem with the latest cert.pem manually.

The issue has been fixed in latest release of the SDK (version 1.9.6) . Upgrading to it will also resolve the issue.

Join the Authorize.Net developer forum to keep abreast with latest features and contribute ideas. Thanks Ashutosh

daniloparrajr commented 6 years ago

Thanks @ashtru, have the SDK updated to 1.9.6 and its working now.

prthatip123 commented 5 years ago

Hi ashtru i am getting the issue suddenly Uncaught exception 'Exception' with message 'Error getting valid response from api i am getting this issue from today morning i.e 17-dec-2018. can you please suggest what changes i have to do it in order to resolve the issue..

ashtru commented 5 years ago

Can you check your phplog file for this request? Are you able to confirm your network connectivity to the API endpoint?

prthatip123 commented 5 years ago

Hi ashtru CURL ERROR: Could not resolve host: apitest.authorize.net

gnongsie commented 5 years ago

Hi @prthatip123 ,

We have checked the SDK and we are not seeing any issues.

Can you give us the steps to reproduce this issue? Any particular API call which is failing?

prthatip123 commented 5 years ago

Hi Gabriel

Till yesterday it was working but from today morning my sdk-php is not responding

I have not done any changes.

kikmak42 commented 5 years ago

Hi ashtru CURL ERROR: Could not resolve host: apitest.authorize.net

Hi @prthatip123, can you check if https://apitest.authorize.net/xml/v1/request.api is accessible from you machine. It seems from your error you are having a network connection issue (which may happen if your firewall configuration changed or internet provider changed something, maybe different proxy server).

ashtru commented 5 years ago

Hi @prthatip123 , you can check the output of curl command in the shell/command prompt: $ curl "https://apitest.authorize.net/xml/v1/request.api"

Non-zero bytes should be returned and the output must be {"messages":{"resultCode":"Error","message":[{"code":"E00003","text":"Root element is missing."}]}}

As @kikmak42 stated, something related to your network might have changed. Or some times, even restarting the server could resolve your issue. Ref: https://stackoverflow.com/questions/1341644/curl-and-https-cannot-resolve-host

prthatip123 commented 5 years ago

https://apitest.authorize.net/xml/v1/request.api i run this url in my machine through browser. i am getting the below output. {"messages":{"resultCode":"Error","message":[{"code":"E00003","text":"Root element is missing."}]}}

As you have suggested to restart my machine so i have restarted my machine.

but still my issue did not get resolved. please can you help me to resolve the issue.

why my api suddenly not working.

kikmak42 commented 5 years ago

Can you please check in from terminal if you are able to resolve the host.

 $ curl "https://apitest.authorize.net/xml/v1/request.api"

Also can you please give us more details like which OS you are using and the version of PHP ?

prthatip123 commented 5 years ago

sdk-php is working fine. Thanks

gnongsie commented 5 years ago

Closing this issue based on the comment above.