This quickstart sample creates a Square client instance with your Square access token and then lists the locations in your account. The sample is based on the Java SDK Quickstart guide.
Install Java Guide - If you don't have java already installed on your machine.
Maven Install Guide note: Gradle is also supported but the quickstart here demonstrates using Maven.
-
Change into the
quickstartdirectory -
Copy the example config file in
src/main/resources, and place yourSquare Access Tokeninside of the new file.$ cp src/main/resources/config.properties.example src/main/resources/config.properties -
Replace
PLACE_VERSION_HEREwith the latest SDK version from here -
Compile the program
$ mvn package -DskipTests -
Execute the code
$ mvn exec:java -Dexec.mainClass="com.square.examples.Quickstart" -
In your console, you should see output similar to this:
Location(s) for this account: LGJ1WWJ8PSV8Z: Default Test Account, 1600 Pennsylvania Ave NW, Washington
Square Java SDK Guide - details on how to use / configure the Square client.
Maven Repository for Square - Where the package files are hosted
Java SDK Source Code - Github repo with sdk source code