Installation
Add the gem to your Gemfile:Gemfile
The SDK supports Ruby 3.2.0 and later versions, with comprehensive types, error handling, and retry mechanisms.
Quick Start
Initialize the client and create a checkout session:Core Features
Ruby Conventions
Follows Ruby naming conventions and idiomatic patterns
Elegant Syntax
Clean, readable API that feels natural to Ruby developers
Auto-Pagination
Built-in auto-paging iterators for list responses
Type Safety
Optional Sorbet types for enhanced type safety
Configuration
Timeout Configuration
Configure request timeouts:Retry Configuration
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.Pagination
Auto-Pagination
Automatically iterate through all pages:Manual Pagination
For more control over pagination:Error Handling
Handle various Dodo Payments API errors:Type Safety with Sorbet
Use Sorbet for type-safe request parameters:Advanced Usage
Undocumented Endpoints
Make requests to undocumented endpoints:Undocumented Parameters
Send undocumented parameters:Rails Integration
Create an Initializer
Createconfig/initializers/dodo_payments.rb:
Service Object Pattern
Create a payment service:Controller Integration
Use in your Rails controllers:Sinatra Integration
Use with Sinatra applications: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 Ruby SDK?- Discord: Join our community server for real-time support
- Email: Contact us at support@dodopayments.com
- GitHub: Open an issue on the repository