Skip to main content
The Ruby SDK provides a simple and intuitive way to integrate Dodo Payments into your Ruby applications. It follows Ruby conventions and best practices, offering comprehensive error handling, pagination, and middleware support.

Installation

Add the gem to your Gemfile:
Gemfile
Always use the latest SDK version to access the newest Dodo Payments features. Run bundle update dodopayments regularly to stay up to date.
Then run:
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:
Store your API keys securely using environment variables. Never commit them to version control or expose them in your code.

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:
Implement retry logic with exponential backoff for rate limit errors to ensure your application handles high-volume scenarios gracefully.

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

Create config/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?

Contributing

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