sumup

package module
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2026 License: Apache-2.0 Imports: 14 Imported by: 2

README

SumUp Go SDK

Stars Go Reference Documentation CI Status License

IMPORTANT: This SDK is under development. We might still introduce minor breaking changes before reaching v1.

The Go SDK for the SumUp API.

To learn more, check out our API Reference and Documentation.

Installation

sumup-go is compatible with projects using Go Modules.

Import the SDK using:

import (
	"github.com/sumup/sumup-go"
)

And run any of go build/go install/go test which will resolve the package automatically.

Alternatively, you can install the SDK using:

go get github.com/sumup/sumup-go

Documentation

For complete documentation of SumUp APIs visit developer.sumup.com. Alternatively, refer to this simple example to get started:

package main

import (
	"context"
	"log"

	"github.com/sumup/sumup-go"
	"github.com/sumup/sumup-go/merchant"
)

func main() {
	client := sumup.NewClient()

	merchant, err := client.Merchants.Get(context.Background(), "MCNPLE22", merchant.GetAccountParams{})
	if err != nil {
		log.Printf("[ERROR] get merchant account: %v", err)
		return
	}

	log.Printf("[INFO] merchant code: %s", merchant.MerchantCode)
}

Authentication

The easiest form of authenticating with SumUp APIs is using API keys. You can create API keys in the API key section of the developer portal. Store them securely. The SDK by default loads the API key from SUMUP_API_KEY environment variable. Alternatively, provide API key on your own:

client := sumup.NewClient(client.WithAPIKey("sup_sk_LZFWoLyd..."))

Examples

The repository includes several examples demonstrating different use cases:

simple - Basic merchant account information retrieval showing how to initialize the SDK and make a simple API call.

go run example/simple/main.go

checkout - Creating and processing a checkout programmatically using test card details.

go run example/checkout/main.go

full - Complete web application demonstrating the full checkout flow with the SumUp payment widget. Shows how to create checkouts and integrate the widget in a real application.

go run example/full/main.go

and visit http://localhost:8080

Support

Our APIs and their public offering is limited and under heavy development. If you have any questions or inquiries reach out to our support team via the Contact Form.

For question specifically related to this Golang SDK please Open an Issue.

sumup-go SDK will always support latest 3 version of golang following the Golang Release Policy.

Documentation

Index

Examples

Constants

This section is empty.

Variables

View Source
var OAuth2Endpoint = oauth2.Endpoint{
	AuthURL:  "https://api.sumup.com/authorize",
	TokenURL: "https://api.sumup.com/token",
}

OAuth2Endpoint is SumUp's OAuth 2.0 endpoint.

Functions

This section is empty.

Types

type Client

type Client struct {
	Checkouts    *checkouts.CheckoutsService
	Customers    *customers.CustomersService
	Members      *members.MembersService
	Memberships  *memberships.MembershipsService
	Merchant     *merchant.MerchantService
	Merchants    *merchants.MerchantsService
	Payouts      *payouts.PayoutsService
	Readers      *readers.ReadersService
	Receipts     *receipts.ReceiptsService
	Roles        *roles.RolesService
	Subaccounts  *subaccounts.SubaccountsService
	Transactions *transactions.TransactionsService
	// contains filtered or unexported fields
}
Example
client := sumup.NewClient()

account, err := client.Merchant.Get(context.Background(), merchant.GetParams{})
if err != nil {
	log.Printf("[ERROR] get merchant account: %v", err)
	return
}

log.Printf("[INFO] merchant profile: %+v", *account.MerchantProfile)

func NewClient

func NewClient(opts ...client.ClientOption) *Client

NewClient creates new SumUp API client. The client is by default configured environment variables (`SUMUP_API_KEY`). To override the default configuration use [ClientOption]s.

Directories

Path Synopsis
Package datetime provides custom date and time types with JSON marshaling support.
Package datetime provides custom date and time types with JSON marshaling support.
example module
checkout command
full command
This example demonstrates a complete checkout flow with the SumUp payment widget.
This example demonstrates a complete checkout flow with the SumUp payment widget.
oauth2 command
OAuth 2.0 Authorization Code flow with SumUp
OAuth 2.0 Authorization Code flow with SumUp
simple command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL