Skip to main content
The Python SDK offers a Pythonic interface to the Dodo Payments API, providing both synchronous and asynchronous clients with type definitions for requests and responses. It supports Python 3.9+ and includes comprehensive test coverage.

Installation

Install the SDK using pip:
For enhanced async performance with aiohttp:
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

Always store your API keys securely using environment variables. Never commit them to version control.

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 underlying httpx client:

Async with aiohttp

Use aiohttp for enhanced async performance:

Logging

Enable logging by setting the environment variable:
Or for debug-level logging:

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?

Contributing

We welcome contributions! Check the contributing guidelines to get started.
Last modified on May 28, 2026