Skip to main content

SumUp Python SDK

pypi Documentation CI Status pypi download License

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

The Python SDK for the SumUp API.

Installation

Install the latest version of the SumUp SDK:

pip install sumup
# or
uv add sumup

Usage

Synchronous Client

import os

from sumup import Sumup

client = Sumup(api_key="sup_sk_MvxmLOl0...")
merchant = client.merchants.get(merchant_code=os.environ["SUMUP_MERCHANT_CODE"])
print(f"Merchant: {merchant.merchant_code}")

Async Client

import asyncio
import os

from sumup import AsyncSumup


async def main():
    client = AsyncSumup(api_key="sup_sk_MvxmLOl0...")
    merchant = await client.merchants.get(merchant_code=os.environ["SUMUP_MERCHANT_CODE"])
    print(f"Merchant: {merchant.merchant_code}")


asyncio.run(main())

Client Cleanup

Use clients directly as shown above, or use a context manager to close connections automatically when the block exits:

with Sumup(api_key="sup_sk_MvxmLOl0...") as client:
    merchant = client.merchants.get(merchant_code=os.environ["SUMUP_MERCHANT_CODE"])

For async code, use async with:

async def main():
    async with AsyncSumup(api_key="sup_sk_MvxmLOl0...") as client:
        merchant = await client.merchants.get(merchant_code=os.environ["SUMUP_MERCHANT_CODE"])

For long-running applications, reuse a client across requests and call client.close() or await client.aclose() during shutdown, after outstanding work finishes. A closed client cannot be reused.

Handling errors

Catch APIError to handle failed requests, or use a specific exception such as RateLimitError when your application needs to handle a failure differently.

When the API returns a Problem response, error.problem gives you typed fields such as type, title, and detail. It is None for other error responses.

from sumup import APIError, Sumup
from sumup.errors import APIStatusError, RateLimitError

with Sumup() as client:
    try:
        checkout = client.checkouts.get("your-checkout-id")
    except RateLimitError:
        print("Too many requests. Try again later.")
    except APIStatusError as error:
        if (problem := error.problem) is not None:
            print(problem.type, problem.detail)
        else:
            print(error)
    except APIError as error:
        print(error)

For errors returned by the API, error.status gives you the HTTP status, error.body holds the full error details, and error.response provides the original response, including its headers and text.

Use the same try/except pattern with AsyncSumup.

Creating a Checkout

import os
import uuid

from sumup import Sumup

client = Sumup(api_key="sup_sk_MvxmLOl0...")
merchant_code = os.environ["SUMUP_MERCHANT_CODE"]

# Create a checkout
checkout = client.checkouts.create(
    amount=10.00,
    currency="EUR",
    checkout_reference=str(uuid.uuid4()),
    merchant_code=merchant_code,
    description="Test payment",
    redirect_url="https://example.com/success",
    return_url="https://example.com/webhook",
)

print(f"Checkout ID: {checkout.id}")
print(f"Checkout Reference: {checkout.checkout_reference}")

Creating a Reader Checkout

from sumup import Sumup

client = Sumup(api_key="sup_sk_MvxmLOl0...")

# Create a reader checkout
reader_checkout = client.readers.create_checkout(
    reader_id="your-reader-id",
    merchant_code="your-merchant-code",
    total_amount={
        "value": 1000,  # 10.00 EUR (amount in cents)
        "currency": "EUR",
        "minor_unit": 2,
    },
    description="Coffee purchase",
    return_url="https://example.com/webhook",
)

print(f"Reader checkout created: {reader_checkout}")

Handling Events

Create a handler with your event signing secret and register typed callbacks:

import os

from sumup import Sumup
from sumup.events import EventNotification, ReaderCreatedEvent

client = Sumup(api_key=os.environ["SUMUP_API_KEY"])


def fallback(event: EventNotification) -> None:
    print(f"Received {event.type}")


events = client.events_handler(os.environ["SUMUP_EVENT_SECRET"], fallback)


@events.on_reader_created
def reader_created(event: ReaderCreatedEvent) -> None:
    reader = event.fetch_object()
    print(f"Reader paired: {reader.id}")


# In your HTTP route, pass the unchanged body and the complete
# X-SumUp-Webhook-Signature header value:
events.handle(raw_body, signature)

You can also register an existing function with events.on_reader_created(callback).

Send a 2xx response after handling succeeds. Reject EventSignatureError and EventPayloadError with 400; return 500 for EventCallbackError so processing can be retried. Make callbacks idempotent and configure body limits in your server.

Use AsyncSumup with async callbacks, await events.handle(...), and await event.fetch_object_async() for async servers. For parsing without callbacks, use client.parse_event_notification(body, signature, secret).

See the runnable Flask and FastAPI examples for complete HTTP routes and error handling.

Version Support Policy

sumup-py maintains compatibility with Python versions that have not passed end-of-life. As of June 8, 2026, that means Python 3.10 through 3.14. See Status of Python versions.

Metadata

Release files for sumup 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sumup 0.4.1
File Size Uploaded Provenance Actions
sumup-0.4.1.tar.gz 105.8 kB Without provenance Details for sumup-0.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sumup 0.4.1
File Interpreter ABI Platform Actions
sumup-0.4.1-py3-none-any.whl Python 3 none any Details for sumup-0.4.1-py3-none-any.whl

Total release size: 215.5 kB

Release files / sumup-0.4.1.tar.gz

Download URL sumup-0.4.1.tar.gz
Size 105.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5372630236fc3653f74348c8b8af633b87286e9d75bc519a02f3fb3e2e0de0e5
BLAKE2b-256 checksum
How to use checksums
6dfb347b987c541d95cbb5c7c7ef02ee7ec2a99cecd5fe0ee5aa362643483add
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / sumup-0.4.1-py3-none-any.whl

Download URL sumup-0.4.1-py3-none-any.whl
Size 109.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e8ce52f04b94861b5f1c7377313c6c175c539fb637cae7411db33fdcac70ee23
BLAKE2b-256 checksum
How to use checksums
502c0f2a9d1b5cacd173aa6cb134b19aa601b5e8b1960f6076526f5887208dfb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for sumup 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page