Frameworks
Go (Gin) — Scell.io integration
No Go SDK — standard net/http
Scell.io does NOT publish an official Go SDK. In Gin (or Echo, Chi, Fiber), use standard `net/http` with a shared `*http.Client` for keep-alive. Wrap in a `ScellClient` struct injected into handlers via context or DI. `SCELL_API_KEY` env var via `os.Getenv`. Compatible with Go 1.22+, ideal for high throughput.
Key facts
- No Go SDK — standard `net/http`
- `ScellClient` struct with shared `*http.Client`
- Inject via context or Gin middleware
- `SCELL_API_KEY` via `os.Getenv`
- Compatible with Go 1.22+ (and Gin v1.10+)
Code example
type ScellClient struct{ http *http.Client; apiKey string }
func (c *ScellClient) CreateInvoice(buyer string, amount float64) (map[string]any, error) {
payload := map[string]any{
"format": "factur-x",
"buyer": map[string]any{"name": buyer, "is_individual": true},
"lines": []map[string]any{{"description": "Service", "quantity": 1, "unit_price": amount, "vat_rate": 20.0}},
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://api.scell.io/api/v1/invoices", bytes.NewReader(body))
req.Header.Set("X-API-Key", c.apiKey)
req.Header.Set("Content-Type", "application/json")
resp, err := c.http.Do(req)
if err != nil { return nil, err }
defer resp.Body.Close()
var out map[string]any
return out, json.NewDecoder(resp.Body).Decode(&out)
}