Skip to main content
The Java SDK provides convenient and ergonomic access to the Dodo Payments REST API for applications written in Java. It utilizes Java-specific features like Optional, Stream, and CompletableFuture for modern Java development.

Installation

Maven

Add the dependency to your pom.xml:
pom.xml

Gradle

Add the dependency to your build.gradle:
build.gradle.kts
Always use the latest SDK version to access the newest Dodo Payments features. Check Maven Central for the latest version.
The SDK supports Java 8 and all later versions, including Java 11, 17, and 21.

Quick Start

Initialize the client and create a checkout session:
Always store your API keys securely using environment variables, system properties, or a secure configuration management system. Never hardcode them in your source code.

Core Features

Type Safety

Strongly typed API with compile-time safety

Thread-Safe

Safe for concurrent use in multi-threaded applications

Builder Pattern

Intuitive builder pattern for constructing requests

Async Support

CompletableFuture support for asynchronous operations

Configuration

Environment Variables

Configure using environment variables or system properties:
.env

Manual Configuration

Configure manually with all options:

Test Mode

Configure for test/sandbox environment:

Common Operations

Create a Checkout Session

Generate a checkout session:

Manage Customers

Create and retrieve customer information:

Handle Subscriptions

Create and manage recurring subscriptions:
productPrice is expressed in the lowest currency denomination (e.g., cents for USD, paise for INR). To charge $25.00, pass 2500.
Charging via subscriptions().charge(...) is intended for on-demand subscriptions. Standard scheduled subscriptions are billed automatically based on the product’s pricing schedule.

Usage-Based Billing

Configure Meters

Create and manage meters for tracking usage:

Ingest Usage Events

Track custom events:

Batch Ingest Events

Ingest multiple events efficiently (max 1000 per request):

Error Handling

Comprehensive error handling for different scenarios:
The SDK automatically retries requests on connection errors, 408, 409, 429, and 5xx errors with exponential backoff.

Async Operations

Use CompletableFuture for asynchronous operations:

Spring Boot Integration

Configuration Class

Service Layer

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 Java SDK?

Contributing

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