SDKGoPermalink
We have refactored the Go SDK into a flat package structure to simplify imports and make the public API easier to discover. This is a breaking change.
What Changed
- Types and services previously nested under subpackages are now exported directly from
github.com/sumup/sumup-go.
- Import paths that referenced nested modules need to be updated.
Migration
Update your imports and type references to use the root package. For example:
1
2import "github.com/sumup/sumup-go/checkouts"
3
4
5import "github.com/sumup/sumup-go"
If you run into issues, please open a ticket or let us know.
SDKGoPermalink
We are happy to announce the beta release of our Go(Opens in a new tab) SDK. The SDK is maintained under sumup/sumup-go(Opens in a new tab) with its acompanying documentation at pkg.go.dev(Opens in a new tab).
The Go SDK provides easy access to SumUp APIs:
1package main
2
3import (
4 "context"
5 "log"
6
7 "github.com/sumup/sumup-go"
8)
9
10func main() {
11 ctx := context.Background()
12 client := sumup.NewClient()
13
14 checkout, err := client.Checkouts.Create(ctx, sumup.CheckoutsCreateParams{
15 Amount: 123,
16 CheckoutReference: "TX000001",
17 Currency: sumup.CurrencyEUR,
18 MerchantCode: "MK0001",
19 })
20 if err != nil {
21 log.Printf("[ERROR] create checkout: %v", err)
22 return
23 }
24
25 log.Printf("[INFO] checkout created: id=%q, amount=%v, currency=%q", *checkout.ID, *checkout.Amount, string(*checkout.Currency))
26
27 checkoutSuccess, err := client.Checkouts.Process(ctx, *checkout.ID, sumup.CheckoutsProcessParams{
28 Card: &sumup.Card{
29 Cvv: "123",
30 ExpiryMonth: "12",
31 ExpiryYear: "2023",
32 Name: "Boaty McBoatface",
33 Number: "4200000000000042",
34 },
35 PaymentType: sumup.ProcessCheckoutPaymentTypeCard,
36 })
37 if err != nil {
38 log.Printf("[ERROR] process checkout: %v", err)
39 return
40 }
41
42 success, _ := checkoutSuccess.AsCheckoutSuccess()
43 log.Printf("[INFO] checkout processed: id=%q, transaction_id=%q", *success.ID, string((*success.Transactions)[0].ID))
44}
See the repository for more examples(Opens in a new tab) and don’t hesitate to let us know if you have any questions.