Langsung ke konten utama
The Kotlin SDK provides convenient access to the Dodo Payments REST API from applications written in Kotlin. It features nullable values, Sequence, suspend functions, and other Kotlin-specific features for ergonomic use.

Installation

Gradle (Kotlin DSL)

Add the dependency to your build.gradle.kts:
build.gradle.kts

Maven

Add the dependency to your pom.xml:
pom.xml
Always use the latest SDK version to access the newest Dodo Payments features. Check Maven Central for the latest version.
The SDK requires Java 8 or later and is compatible with both JVM and Android platforms.

Quick Start

Initialize the client and create a checkout session:
Always store your API keys securely using environment variables or encrypted configuration. Never commit them to version control.

Core Features

Coroutines

Full support for Kotlin coroutines for asynchronous operations

Null Safety

Leverage Kotlin’s null safety for robust error handling

Extension Functions

Idiomatic Kotlin extensions for enhanced functionality

Data Classes

Type-safe data classes with copy and destructuring support

Configuration

From Environment Variables

Initialize from environment variables or system properties:

Manual Configuration

Configure manually with all options:

Test Mode

Configure for test/sandbox environment:

Timeouts and Retries

Configure globally or per-request:

Common Operations

Create a Checkout Session

Generate a checkout session:

Create a Product

Create products with detailed configuration:

Activate License Key

Activate license keys for customers:

Handle Subscriptions

Create and manage recurring subscriptions:
billing requires at minimum a two-letter ISO country code. Use AttachExistingCustomer to attach an existing customer, or NewCustomer to create one. productPrice is expressed in the lowest currency denomination.

Usage-Based Billing

Record Usage Events

Track usage for meters:

Async Operations

Async Client

Use the async client for coroutine-based operations:

Error Handling

Handle errors with Kotlin’s exception handling:

Functional Error Handling

Use Result for functional error handling:
Use Kotlin’s runCatching for a more functional approach to error handling with Result types.

Android Integration

Use with Android applications:

Response Validation

Enable response validation:

Advanced Features

Proxy Configuration

Configure proxy settings:

Temporary Configuration

Modify client configuration temporarily:

Ktor Integration

Integrate with Ktor server 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 Kotlin SDK?

Contributing

We welcome contributions! Check the contributing guidelines to get started.
Terakhir diubah pada 26 Juni 2026