SumUp API Client for Rust
A comprehensive, type-safe Rust client for the SumUp API. This library provides a complete interface to all SumUp API endpoints with full async/await support.
🚀 Development Status
✅ Production Ready: This library is fully implemented and production-ready for core payment operations. All critical APIs are working with comprehensive error handling and type safety.
✅ Fully Implemented & Tested
- Core Payment APIs: Checkouts, transactions, customers, merchants
- 3DS Support: Proper handling of 3DS authentication flows
- Error Handling: Comprehensive error management with structured error types
- Type Safety: Full Rust type definitions for all request/response models
- Testing: Complete test suite with wiremock integration
⚠️ Limited Functionality
- Team Management: Only memberships listing is implemented (other endpoints don't exist in SumUp API)
- Financial APIs: Payouts and receipts have limited endpoints (merchant-specific only)
- Hardware APIs: Reader management requires merchant codes
For detailed implementation status, see IMPLEMENTATION_STATUS.md.
Features
- Complete API Coverage: All SumUp API endpoints are supported, including payments, customers, transactions, and team management.
- Type Safety: Full Rust type definitions for all request/response models ensure correctness at compile time.
- Async/Await: Built on Tokio for high-performance, non-blocking I/O.
- Robust Error Handling: Comprehensive error types for handling API, network, and validation errors gracefully.
- 3DS Support: Correctly handles 3DS payment flows by differentiating between immediate success and required authentication steps.
- Ergonomic Queries: Type-safe query builders for endpoints with complex filtering and pagination.
- Sandbox Support: Easy switching between production and sandbox environments for safe development and testing.
Installation
Add this to your Cargo.toml:
[]
= "0.2.0"
Quick Start
use ;
async
API Coverage
This client supports all SumUp API endpoints:
Checkouts
- Create, retrieve, process, and deactivate checkouts.
- Correctly handles 3DS payment flows.
- List checkouts with advanced filtering.
- Get available payment methods.
Customers
- Full CRUD operations for customer management.
- Manage customer payment instruments.
Transactions
- List transaction history with powerful, type-safe query parameters.
- Retrieve full details for any transaction.
- Refund transactions.
Merchants
- Retrieve profiles for the authenticated user or specific merchants.
- List all merchants accessible to the authenticated user.
Team Management (Memberships, Roles, Members)
- Fully functional and corrected implementation.
- Full CRUD operations for memberships, custom roles, and team members.
- Assign roles and permissions to team members.
Payouts, Receipts & Readers
- List and retrieve financial payouts and transaction receipts.
- Manage physical card readers and initiate in-person payments.
Error Handling
The client uses a custom Error type that provides structured information about API errors:
use ;
// ... inside an async function
match client.create_checkout.await
Examples
Basic Usage
3DS Payment Testing
The library includes comprehensive examples for testing 3DS (3D Secure) authentication:
# Setup 3DS testing
# Basic 3DS demo (automated testing)
# Comprehensive 3DS demo with webhook monitoring
# Manual 3DS testing (recommended for sandbox)
3DS Test Cards
The examples use specific test cards designed to trigger 3DS authentication:
4000000000003220- Visa (3DS Authentication Required)4000000000009995- Visa (3DS with Insufficient Funds)4000000000000002- Visa (3DS Declined)4000000000009987- Visa (3DS Lost Card)4000000000009979- Visa (3DS Stolen Card)
3DS Testing Setup
- Get a webhook URL from webhook.site
- Update the
return_urlin the examples - Run the demo and follow the 3DS authentication flow
Note: Sandbox 3DS behavior may be limited. Real 3DS testing requires a production environment.
Manual 3DS Testing (Recommended)
For sandbox environments, manual testing is often more reliable:
- Run
cargo run --example 3ds_manual_test - Open the provided checkout URL in your browser
- Use test cards to trigger 3DS authentication
- Monitor payment status in real-time
Working Checkout Demo
🔧 Development & CI/CD
This project uses automated CI/CD to ensure code quality and reliability:
Continuous Integration
- Automated Testing: All tests run on every push and pull request
- Code Quality: Formatting and linting checks ensure consistent code style
- Security Audits: Automated vulnerability scanning with
cargo audit - Documentation: Automatic documentation generation and validation
Automated Deployment
- Release Publishing: Automatic publishing to Crates.io on GitHub releases
- Version Management: Tagged releases trigger the deployment pipeline
- Quality Gates: Only passes tests and security checks are deployed
Local Development
# Run all quality checks locally (recommended)
# Or run individual checks
📦 Publishing
This crate is automatically published to Crates.io when:
- A new GitHub release is created
- All CI/CD checks pass
- Security audit is clean
For detailed publishing information, see DEPLOYMENT.md.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Development Workflow
- Fork the repository
- Create a feature branch
- Make your changes
- Run the quality checks locally
- Submit a pull request
The CI/CD pipeline will automatically validate your changes.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Disclaimer
This is not an official SumUp product. This library is provided as-is without any warranty.