0

I am trying to embed square payment method to my site through its documentation given in the link below. https://docs.connect.squareup.com/articles/processing-payment-php/

After receiving nonce, I am trying to get the location id as defined in the documentation. In console it always returns the following error:

Fatal error: Uncaught exception 'SquareConnect\ApiException' with message 'API call to https://connect.squareup.com/v2/locations failed: SSL certificate problem: unable to get local issuer certificate' in C:\xampp\htdocs\my_project\vendor\square\connect\lib\ApiClient.php:245
Stack trace:
#0 C:\xampp\htdocs\my_project\vendor\square\connect\lib\Api\LocationApi.php(165): SquareConnect\ApiClient->callApi('/v2/locations', 'GET', Array, '', Array, '\\SquareConnect\\...')
#1 C:\xampp\htdocs\my_project\vendor\square\connect\lib\Api\LocationApi.php(105): SquareConnect\Api\LocationApi->listLocationsWithHttpInfo('sq0atb-a8CwQY9D...')
#2 C:\xampp\htdocs\my_project\locations-test.php(10): SquareConnect\Api\LocationApi->listLocations('sq0atb-a8CwQY9D...')
#3 {main}
  thrown in C:\xampp\htdocs\my_project\vendor\square\connect\lib\ApiClient.php on line 245
Daniel A. White
  • 187,200
  • 47
  • 362
  • 445

1 Answers1

0

You might not have the most up-to-date CA certificate bundle. Try the steps in this related StackOverflow answer and see if that works: https://stackoverflow.com/a/19149687

If that doesn't work, what operating system version and what version of PHP are you using? In an interactive PHP console (php -a), what is the output of echo OPENSSL_VERSION_TEXT;? Finally, what is the output of openssl s_client -connect connect.squareup.com:443 (in cmd, not the PHP console)?

Community
  • 1
  • 1
Daniel Ge
  • 61
  • 2