메인 콘텐츠로 건너뛰기
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, automatic retries, and comprehensive error handling.

Installation

Install the package from NuGet:
The SDK requires .NET 8.0 or later. 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

Smart Retries

Automatic retries with exponential backoff for transient errors

Error Handling

Built-in exception hierarchy for precise error management

Configuration

Environment Variables

.env

Manual Configuration

Environments

Switch between live and test mode:

Retries

The SDK automatically retries 2 times by default with exponential backoff. It retries on connection errors and status codes 408, 409, 429, and 5xx.

Timeouts

Requests time out after 1 minute by default.

Per-Request Overrides

Temporarily modify configuration for a single request using WithOptions:

Common Operations

Create a Checkout Session

Manage Customers

Handle Subscriptions

Billing은 최소한 두 자리 ISO Country 코드를 요구합니다. 기존 고객을 첨부하려면 AttachExistingCustomer를 사용하거나, 새로 생성하려면 NewCustomer를 사용하세요. ProductPrice는 가장 낮은 화폐 단위입니다.

에러 처리

SDK는 HTTP 상태 코드에 따라 특정 예외를 던집니다. 모든 4xx 오류는 DodoPayments4xxException로부터 상속됩니다. 다른 예외 유형:
  • DodoPaymentsIOException: I/O 네트워킹 오류
  • DodoPaymentsInvalidDataException: 파싱된 데이터를 해석하는 데 실패함
  • DodoPaymentsException: 모든 예외의 기본 클래스

페이지 매기기

자동 페이지 매기기

모든 페이지의 모든 결과를 반복 처리하려면 Paginate 메서드를 사용하여 IAsyncEnumerable를 반환합니다:

수동 페이지 매기기

ASP.NET Core 통합

DI 컨테이너에 클라이언트를 등록하세요:
Program.cs
appsettings.json
개발 중에는 키를 appsettings.json에 저장하는 대신 사용자 비밀을 사용하세요:

리소스

NuGet Package

NuGet Gallery에서 패키지 보기

GitHub Repository

소스 코드 보기 및 기여

API Reference

완전한 API 문서

Discord Community

도움 받기 및 개발자와 연결

지원

C# SDK에 대한 도움이 필요하신가요?
마지막 수정일 2026년 5월 28일