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.Documentation Index
Fetch the complete documentation index at: https://docs.dodopayments.com/llms.txt
Use this file to discover all available pages before exploring further.
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: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
| Property | Environment variable | Required | Default value |
|---|---|---|---|
BearerToken | DODO_PAYMENTS_API_KEY | true | - |
WebhookKey | DODO_PAYMENTS_WEBHOOK_KEY | false | - |
BaseUrl | DODO_PAYMENTS_BASE_URL | true | "https://live.dodopayments.com" |
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 usingWithOptions:
Common Operations
Create a Checkout Session
Manage Customers
Handle Subscriptions
Billing erfordert mindestens den zwei Buchstaben ISO Country Code. Verwenden Sie AttachExistingCustomer, um einen bestehenden Kunden zu verknüpfen, oder NewCustomer, um einen neuen zu erstellen. ProductPrice ist in der kleinsten Währungseinheit.Fehlerbehandlung
Das SDK wirft spezifische Ausnahmen basierend auf dem HTTP-Statuscode. Alle 4xx-Fehler erben vonDodoPayments4xxException.
| Status | Ausnahme |
|---|---|
| 400 | DodoPaymentsBadRequestException |
| 401 | DodoPaymentsUnauthorizedException |
| 403 | DodoPaymentsForbiddenException |
| 404 | DodoPaymentsNotFoundException |
| 422 | DodoPaymentsUnprocessableEntityException |
| 429 | DodoPaymentsRateLimitException |
| 5xx | DodoPayments5xxException |
| andere | DodoPaymentsUnexpectedStatusCodeException |
DodoPaymentsIOException: I/O-NetzwerkfehlerDodoPaymentsInvalidDataException: Fehler bei der Interpretation der analysierten DatenDodoPaymentsException: Basisklasse für alle Ausnahmen
Paginierung
Automatische Paginierung
Durchlaufen Sie alle Ergebnisse über alle Seiten mit der MethodePaginate, die eine IAsyncEnumerable zurückgibt:
Manuelle Paginierung
ASP.NET Core-Integration
Registrieren Sie den Client in Ihrem DI-Container:Program.cs
appsettings.json
Ressourcen
NuGet Package
Sehen Sie sich das Paket in der NuGet Gallery an
GitHub Repository
Sehen Sie sich den Quellcode an und tragen Sie bei
API Reference
Komplette API-Dokumentation
Discord Community
Hilfe erhalten und Kontakt mit Entwicklern aufnehmen
Support
Brauchen Sie Hilfe mit dem C# SDK?- Discord: Treten Sie unserem Community-Server für Echtzeitunterstützung bei
- E-Mail: Kontaktieren Sie uns unter support@dodopayments.com
- GitHub: Eröffnen Sie ein Problem im Repository