ApiException occurred: SSL certificate problem: unable to get local issuer certificate

I am running into this error when trying to get the quickstart running in php (https://developer.squareup.com/docs/sdks/php/quick-start)

Has anyone experienced this? Is there any suggestions for debuging this problem? Currently trying to connect to the api and then i hope to connect to the loyalty api, I would like to get this running locally and eventually put on the production server

HTTPS is required for all API calls to Square endpoints. Make sure your website is served using HTTPS and that you are making HTTPS calls to Square APIs. Are you using localhost to test or is this a custom host? If its custom is it http or https? :slightly_smiling_face:

Following along with the quickstart guide, I am using localhost http://localhost:8000/quickstart.php

When i try using https://localhost:8000/quickstart.php “The page cannot be found”

Is the server running on the terminal in the correct directory? php -S localhost:8000 :slightly_smiling_face:

Yea…I believe the terminal is running in the correct directory. I used the gitbash terminal on my Vscode, and ran the code that starts the server in that directory. I am able to get this example working live on my server when i try. But not on localhost.

Also, can I test using the customers/loyalty APIs without using my credit card? I want to get all of this working before i commit my credit card. But on the Square Seller side it wants me to pay to add a customer into the database.

That sounds like it’s not running in the right directory if you’re able to get it to run in your production server.

Yeah, you can definitely use our Sandbox to test prior to going live. :slightly_smiling_face:

  1. download cacert.pem file (https://curl.haxx.se/ca/cacert.pem)
    2.Put the file in a path, example c:\wwwRoot\curlFile
    3.open the php.ini
    4.find curl.cainf= and change curl.cainfo =“C:\wwwRoot\curlFile\cacert.pem”
    5.reboot web service
    6.done
1 Like