Skip to main content
The C# SDK provides convenient access to the Dodo Payments REST API from applications written in C#. It features an async Task-based API with strong typing and is currently in beta.
The C# SDK is currently in beta. We’re actively working on improvements and welcome your feedback.

Installation

Install the SDK using the .NET CLI:
The SDK requires .NET 8.0 or higher. It works with ASP.NET Core, Console applications, and other .NET project types.

Quick Start

Initialize the client and create a checkout session:
Always store your API keys securely using environment variables, user secrets, or Azure Key Vault. Never hardcode them in your source code or commit them to version control.

Core Features

Async/Await

Full async Task-based API for non-blocking operations

Strong Typing

Comprehensive type safety with nullable reference types

Dependency Injection

First-class support for .NET dependency injection

Configuration

Simple configuration via environment variables or appsettings.json

Configuration

Environment Variables

Configure using environment variables:
.env

Manual Configuration

Configure manually with bearer token:

Common Operations

Create a Checkout Session

Generate a checkout session:

Manage Customers

Create and retrieve customer information:

Handle Subscriptions

Create and manage recurring subscriptions:

ASP.NET Core Integration

Service Registration

Register the client in Program.cs:
Program.cs

Configuration

Add configuration in appsettings.json:
appsettings.json

API Controller

Create a controller using dependency injection:

Service Layer Pattern

Create a service for business logic:

User Secrets (Development)

For development, use user secrets to store API keys:

Testing

Example unit test using xUnit:

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 C# SDK?

Contributing

Since the SDK is in beta, your feedback and contributions are especially valuable! Check the contributing guidelines to get started.