Installation
Install the SDK using your package manager of choice:Quick Start
Initialize the client with your API key and start processing payments:Core Features
TypeScript First
Full TypeScript support with comprehensive type definitions for all API endpoints
Auto-Pagination
Automatic pagination for list responses makes working with large datasets effortless
Error Handling
Built-in error types with detailed messages for different failure scenarios
Smart Retries
Configurable automatic retries with exponential backoff for transient errors
Configuration
Environment Variables
Set environment variables for secure configuration:.env
Timeout Configuration
Configure request timeouts globally or per-request:Retry Configuration
Configure automatic retry behavior:Common Operations
Create a Checkout Session
Generate a checkout session for collecting payment information: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 is a union of { customer_id } (to attach an existing customer) or { email, name? } (to create a new one). product_price is expressed in the lowest currency denomination.Usage-Based Billing
Ingest Usage Events
Track custom events for usage-based billing:Events must have unique
event_id values for idempotency. Duplicate IDs within the same request are rejected, and subsequent requests with existing IDs are ignored.Retrieve Usage Events
Fetch detailed information about usage events:Proxy Configuration
Configure proxy settings for different runtimes:Node.js (using undici)
Bun
Deno
Logging
Control log verbosity using environment variables or client options:'debug'- Show debug messages, info, warnings, and errors'info'- Show info messages, warnings, and errors'warn'- Show warnings and errors (default)'error'- Show only errors'off'- Disable all logging
Migration from Node.js SDK
If you’re upgrading from the legacy Node.js SDK, the TypeScript SDK offers improved type safety and features:View Migration Guide
Learn how to migrate from the Node.js SDK to the TypeScript SDK
Auto-Pagination
List methods in the DodoPayments API are paginated. You can use thefor await … of syntax to iterate through items across all pages:
Requirements
The following runtimes are supported:- Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more)
- Node.js 20 LTS or later (non-EOL) versions
- Deno v1.28.0 or higher
- Bun 1.0 or later
- Cloudflare Workers
- Vercel Edge Runtime
- Jest 28 or greater with the
"node"environment - Nitro v2.6 or greater
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 TypeScript SDK?- Discord: Join our community server for real-time support
- Email: Contact us at support@dodopayments.com
- GitHub: Open an issue on the repository