SumUp Rust SDK
IMPORTANT: This SDK is under heavy development and subject to breaking changes.
The Rust SDK for the SumUp API.
Requirements
Rust 1.90.0 or higher. We follow Firefox MSRV policy.
Installation
Install with:
Quick Start
use Client;
async
Authentication
use ;
// Read SUMUP_API_KEY from the environment
let client = default;
// Or set an explicit API key
let client = default
.with_authorization;
Handling errors
API errors retain their HTTP status, headers, and original response bytes. Read typed Problem details directly when available:
if let Err = client.checkouts.get.await
Use status() and headers() to inspect the HTTP response, raw_body() for its
original bytes, and body() for other typed error details.
HTTP Configuration
The SDK uses reqwest as its HTTP transport. You can provide a configured
reqwest::Client for settings such as proxies, custom TLS roots, connection
pooling, redirect policy, or request timeouts.
Start from Client::http_client_builder() to keep the SDK's default headers:
use Client;
let http_client = http_client_builder
.pool_max_idle_per_host
.build
.expect;
let client = default.with_client;
Request Builders
Build requests and query parameters with builder():
use ;
let request = builder
.checkout_reference
.amount
.currency
.merchant_code
.description
.build;
Required fields must be set before build() compiles. Optional setters accept the value directly, without Some(...), nullable fields accept Nullable::Null or Nullable::Value(value). Struct literals and direct field updates are also supported.
Features
By default the SDK enables chrono datetime support and reqwest's default TLS
backend:
[]
= "0.5"
Use jiff for datetime types:
[]
= { = "0.5", = false, = ["jiff", "reqwest-default-tls"] }
Use rustls instead of reqwest's default TLS backend:
[]
= { = "0.5", = false, = ["chrono", "reqwest-rustls-tls"] }
Examples
You can find all examples under examples/. To run an example, use:
For development instructions, see Contributing.