The Get Started exercise shows how to work with Square APIs interactively, without writing any code. However, when you're ready to build your own applications, you should take advantage of the Square SDKs.
If your application can send an HTTPS request and receive a reply, it should be able to call any Square API. However, it must also perform other work, such as choosing the correct endpoint, formatting request headers and payloads, constructing URLs, sending requests, and parsing response bodies.
Instead of calling APIs directly from your application, you can use one of the available Square SDKs. These SDKs insulate your code from the mechanics of API requests and replies and provide useful abstractions to help simplify your code. This helps you focus on writing business logic, rather than low-level details.
Square SDKs are available for several programming languages. For more information, including installation and getting started guides, see the following:
After you have installed a Square SDK, you can use Square API Explorer to generate code snippets in your programming language. To see how this works, do the following:
Open API Explorer.
In the SDKs section, choose one of the available languages.
The Request pane displays a code snippet to create an SDK client. You can copy this code and paste it into your application.
From the Select API and Select Endpoint drop-down lists, choose an API and endpoint that you want to work with.
For Access token, enter your Square Sandbox access token.
If the API requires input parameters, add them to the Body section.
The Request pane displays a code snippet to call the API. You can copy this code and paste it into your application.
You can use the generated code snippets as is or customize them as needed.