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
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 memerlukan setidaknya kode ISO dua huruf Country. Gunakan AttachExistingCustomer untuk mengaitkan customer yang sudah ada, atau NewCustomer untuk membuat customer baru. ProductPrice menggunakan denominasi mata uang terkecil.Penanganan Error
SDK melempar exception tertentu berdasarkan status code HTTP. Semua error 4xx mewarisiDodoPayments4xxException.
Jenis exception lainnya:
DodoPaymentsIOException: error jaringan I/ODodoPaymentsInvalidDataException: Kegagalan dalam menafsirkan data yang telah di-parseDodoPaymentsException: Class dasar untuk semua exception
Pagination
Auto-Pagination
Iterasikan semua hasil di seluruh halaman menggunakan metodePaginate, yang mengembalikan sebuah IAsyncEnumerable:
Manual Pagination
Integrasi ASP.NET Core
Daftarkan client di container DI Anda:Program.cs
appsettings.json
Resources
NuGet Package
Lihat package di NuGet Gallery
GitHub Repository
Lihat source code dan berkontribusi
API Reference
Dokumentasi API lengkap
Discord Community
Dapatkan bantuan dan terhubung dengan developer
Dukungan
Butuh bantuan dengan C# SDK?- Discord: Bergabunglah dengan server komunitas kami untuk mendapatkan dukungan secara real-time
- Email: Hubungi kami di support@dodopayments.com
- GitHub: Buka issue di repository