Skip to content

Latest commit

 

History

History
99 lines (71 loc) · 2.85 KB

File metadata and controls

99 lines (71 loc) · 2.85 KB

SumUp CLI

Command line tool for interacting with SumUp APIs.

Documentation License

SumUp CLI tool allows you to manage your SumUp account, create checkouts, and much more all from your terminal.

Getting started

go install github.com/sumup/sumup-cli/cmd/sumup

The CLI expects an API key via the SUMUP_API_KEY environment variable by default. You can also pass --api-key explicitly.

export SUMUP_API_KEY=your_api_key

Managing merchant context

To avoid repeating the --merchant-code flag in every command, you can set a merchant context:

# Set the merchant context interactively
sumup context set

# View the current merchant context
sumup context get

# Unset the merchant context
sumup context unset

Once set, all commands that accept --merchant-code will use the context value by default. You can still override it by providing the flag explicitly.

Create a checkout

sumup checkouts create \
  --reference order-123 \
  --amount 19.99 \
  --currency EUR \
  --merchant-code M123 \
  --description "Ticket purchase" \
  --return-url https://example.com/return \
  --redirect-url https://example.com/3ds \
  --customer-id cst_42 \
  --purpose "Event"

Manage readers

List readers for a merchant:

sumup readers list --merchant-code M123

Pair a new reader with a pairing code:

sumup readers add \
  --merchant-code M123 \
  --pairing-code ABCDEF \
  --name "Front counter"

Trigger a checkout on a reader (this example charges EUR 14.99 and offers tip rates):

sumup readers checkout \
  --merchant-code M123 \
  --reader-id reader_42 \
  --amount 14.99 \
  --currency EUR \
  --tip-rate 0.10 \
  --tip-rate 0.15 \
  --description "In-person order #123"

When using affiliate attribution, pass all affiliate flags: --affiliate-app-id, --affiliate-key, and --affiliate-foreign-transaction-id.

Check the last known status of a paired reader:

sumup readers status \
  --merchant-code M123 \
  reader_42