sumup-go is the official Go module. It exposes typed clients for every endpoint, handles authentication headers, and surfaces helpers for common request payloads.
Installation
Section titled “Installation”Install the module with go get github.com/sumup/sumup-go (or go install for reproducible builds).
Configure authentication
Section titled “Configure authentication”Create a secret API key or OAuth access token in the developer dashboard. The SDK reads SUMUP_API_KEY by default, so setting SUMUP_API_KEY=sup_sk_MvxmLOl0... before running your binary is enough. You can also pass the key explicitly:
client := sumup.NewClient().WithAuth("sup_sk_MvxmLOl0...")Examples
Section titled “Examples”Online payment checkout
Section titled “Online payment checkout”package main
import ( "context" "fmt" "log" "os"
sumup "github.com/sumup/sumup-go" "github.com/sumup/sumup-go/shared")
func main() { ctx := context.Background() client := sumup.NewClient().WithAuth(os.Getenv("SUMUP_API_KEY"))
merchantCode := os.Getenv("SUMUP_MERCHANT_CODE") desc := "Online payment via card widget"
checkout, err := client.Checkouts.Create(ctx, sumup.CreateCheckoutBody{ Amount: 25.00, CheckoutReference: "ORDER-1001", Currency: shared.CurrencyEUR, Description: &desc, MerchantCode: merchantCode, }) if err != nil { log.Fatalf("create checkout: %v", err) }
fmt.Println(*checkout.ID) // Return checkout ID to your webpage so the SumUp card widget can complete the payment.}Solo Cloud API checkout
Section titled “Solo Cloud API checkout”package main
import ( "context" "fmt" "log" "os" "strings" "time"
sumup "github.com/sumup/sumup-go" "github.com/sumup/sumup-go/readers")
func main() { ctx := context.Background() client := sumup.NewClient().WithAuth(os.Getenv("SUMUP_API_KEY"))
merchantCode := os.Getenv("SUMUP_MERCHANT_CODE") affiliateKey := os.Getenv("SUMUP_AFFILIATE_KEY") appID := os.Getenv("SUMUP_APP_ID")
readerList, err := client.Readers.List(ctx, merchantCode) if err != nil { log.Fatalf("list readers: %v", err) }
var solo readers.Reader for _, rdr := range readerList.Items { if strings.EqualFold(string(rdr.Device.Model), "solo") { solo = rdr break } } if solo.ID == "" { log.Fatal("Pair a Solo reader before using the Cloud API.") }
description := "Solo Cloud API checkout" body := readers.CreateReaderCheckoutBody{ Affiliate: &readers.CreateReaderCheckoutBodyAffiliate{ AppId: appID, ForeignTransactionId: fmt.Sprintf("solo-%d", time.Now().Unix()), Key: affiliateKey, }, Description: &description, TotalAmount: readers.CreateReaderCheckoutBodyTotalAmount{ Currency: "EUR", MinorUnit: 2, Value: 1500, }, }
resp, err := client.Readers.CreateCheckout(ctx, merchantCode, string(solo.ID), body) if err != nil { log.Fatalf("create Solo checkout: %v", err) }
fmt.Println(resp.Data.ClientTransactionId)}