https://github.com/koeinoue/square-go-sdk
Square Go SDK helps you call square API easily
https://github.com/koeinoue/square-go-sdk
go golang square
Last synced: 5 months ago
JSON representation
Square Go SDK helps you call square API easily
- Host: GitHub
- URL: https://github.com/koeinoue/square-go-sdk
- Owner: KoeInoue
- License: apache-2.0
- Created: 2023-01-20T11:37:19.000Z (over 3 years ago)
- Default Branch: develop
- Last Pushed: 2024-10-29T07:57:29.000Z (over 1 year ago)
- Last Synced: 2025-03-24T02:05:23.343Z (over 1 year ago)
- Topics: go, golang, square
- Language: Go
- Homepage: https://pkg.go.dev/github.com/KoeInoue/square-go-sdk
- Size: 63.5 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Square Go SDK



[](https://github.com/KoeInoue/square-go-sdk/actions/workflows/go-test.yml)
## Tags
`go` `square`
## Installation
```shell
go install github.com/KoeInoue/square-go-sdk
```
or
import the package in a file where you want to use the package
```go
import "github.com/KoeInoue/square-go-sdk"
```
then run
```go
go mod tidy
```
## Minimal Example
1. Set environment variables
```shell
export SQUARE_ACCESS_TOKEN=yourSandboxAccessToken
export ENV=dev
```
※ ENV is a variable that just identifies the environment
2. Write code
```go
package main
import (
"os"
"github.com/KoeInoue/square-go-sdk"
"github.com/KoeInoue/square-go-sdk/http"
"github.com/KoeInoue/square-go-sdk/models"
)
func main() {
client := getClient()
client.CustomerApi.CreateCustomer()
}
func getClient() *http.Client {
envType := os.Getenv("ENV")
accessToken := os.Getenv("SQUARE_ACCESS_TOKEN")
if envType != "production" {
return http.NewClient(square.Config[square.Sandbox]{
AccessToken: accessToken,
Environment: square.Environments.Sandbox,
})
} else {
return http.NewClient(square.Config[square.Production]{
AccessToken: accessToken,
Environment: square.Environments.Production,
})
}
}
```
## SDK Reference
### Payments
- [Cards](https://github.com/KoeInoue/square-go-sdk/blob/v0.1.3/doc/api/cards.md)
### Subscriptions
- [Subscriptions](https://github.com/KoeInoue/square-go-sdk/blob/v0.1.3/doc/api/subscriptions.md)
### Item
- [Catalog](https://github.com/KoeInoue/square-go-sdk/blob/v0.1.3/doc/api/catalog.md)
### Customers
- [Customers](https://github.com/KoeInoue/square-go-sdk/blob/v0.1.3/doc/api/customers.md#customers)
## Contributors
- [Koe Inoue](https://github.com/KoeInoue)