Installation
Install the SDK using pip:The SDK requires Python 3.9 or higher. We recommend using the latest stable version of Python for the best experience and security updates.
Quick Start
Synchronous Client
Asynchronous Client
Core Features
Pythonic Interface
Clean, idiomatic Python code that follows PEP 8 guidelines and Python conventions
Async/Await
Full support for asynchronous operations with asyncio and optional aiohttp integration
Type Hints
Complete type hints for better IDE support and type checking with mypy
Auto-Pagination
Automatic pagination for list responses with simple iteration
Configuration
Environment Variables
Configure using environment variables:.env
Timeouts
Configure request timeouts globally or per-request:Retries
Configure automatic retry behavior:Common Operations
Create a Checkout Session
Generate a checkout session:Manage Customers
Create and retrieve customer information:Handle Subscriptions
Create and manage recurring subscriptions:billing requires at minimum the two-letter ISO country code. customer accepts either {"customer_id": ...} to attach an existing customer or {"email": ..., "name": ...} to create a new one. product_price is in the lowest currency denomination.Usage-Based Billing
Ingest Usage Events
Track custom events for usage-based billing:List and Retrieve Events
Pagination
Auto-Pagination
Iterate through all items automatically:Async Pagination
Manual Pagination
For more control over pagination:HTTP Client Configuration
Customize the underlyinghttpx client:
Async with aiohttp
Use aiohttp for enhanced async performance:Logging
Enable logging by setting the environment variable:Framework Integration
FastAPI
Django
Resources
GitHub Repository
View source code and contribute
API Reference
Complete API documentation
Discord Community
Get help and connect with developers
Report Issues
Report bugs or request features
Support
Need help with the Python SDK?- Discord: Join our community server for real-time support
- Email: Contact us at support@dodopayments.com
- GitHub: Open an issue on the repository