Requirements
The Square Go SDK requires:- Go version 1.18 or higher
- A Square account with API credentials
The SDK is built with Go 1.21 but maintains compatibility with Go 1.18+. If you’re using Go modules (recommended), the toolchain will handle version requirements automatically.
Install the SDK
Add the SDK to your project
Run the following command in your project directory to install the Square Go SDK:This will download the latest version of the SDK and add it to your
go.mod file.Verify the installation
After installation, your The SDK uses semantic versioning, and the
go.mod file should include an entry similar to:/v3 path indicates you’re using version 3 of the SDK.Package Structure
The Square Go SDK is organized into several packages:github.com/square/square-go-sdk- Core types and modelsgithub.com/square/square-go-sdk/client- Main client for API accessgithub.com/square/square-go-sdk/option- Request configuration optionsgithub.com/square/square-go-sdk/payments- Payments API clientgithub.com/square/square-go-sdk/customers- Customers API clientgithub.com/square/square-go-sdk/orders- Orders API client- And many more for each Square API resource…
Most use cases only require importing the main
square, squareclient, and option packages. Resource-specific packages are automatically available through the main client.Version Management
Installing a Specific Version
To install a specific version of the SDK:Updating to the Latest Version
To update to the latest version:Checking Your Current Version
View your installed version in thego.mod file or run:
Dependencies
The SDK has minimal external dependencies:github.com/google/uuid- For generating unique identifiers- Standard Go libraries
Next Steps
Quickstart
Create your first payment in under 5 minutes
Authentication
Learn how to configure API credentials
