I want to start by saying I have searched extensively, including google, connect.squareup.com, and Stack Overflow and cannot find an answer to my question. I have posed this question to Square support, and (even though I mentioned I could not access command line and have already done the tutorial mentioned below, I was directed to said tutorial and told to use the command line that I can't use. Here's my problem...
I am trying to set up the square connect API on a webserver for a client. On the webserver, I do not have access to command line (or SSH without an additional cost to the client). The only ways I have found to get the location_id requires command line (as far as I can tell). Is there a way to not have to use command line? Or is there another way to put in the required command without command line access?
Here is what I have done so far:
I read somewhere (can't remember where now) that you can install composer locally, use command line on your machine to install the dependencies needed for square-connect, then move all the files to your server. I have done that to get the files on the server.
My file structure looks like this:
The locations-test.php contains:
$access_token = "ACCESS_TOKEN";
$location_api = new \SquareConnect\Api\LocationApi();
According the php-sdk you're using for connecting to the square API, the required format for
$access_token should be
"Bearer YOUR_ACCESS_TOKEN" no just your access token.
/** * @param string $authorization The value to provide in the Authorization header of * your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
Try using this instead and see if it works.
require 'vendor/autoload.php'; $access_token = "Bearer ACCESS_TOKEN"; $location_api = new \SquareConnect\Api\LocationApi(); echo $location_api->listLocations($access_token);
Of course, don't forget to replace the
ACCESS_TOKEN part with your own access token.