Installation
Install the SDK using Go modules:The SDK requires Go 1.22 or later versions, leveraging modern Go features for optimal performance.
Quick Start
Initialize the client and create your first checkout session:Core Features
Context Support
Full support for context.Context for cancellation and timeouts
Strong Typing
Strongly typed requests and responses for compile-time safety
Middleware
Extensible middleware support for logging, metrics, and custom logic
Goroutine Safe
Thread-safe client designed for concurrent operations
Configuration
Context and Timeouts
Leverage Go’s context for timeouts and cancellation:Retry Configuration
Configure automatic retry behavior:Common Operations
Create a Checkout Session
Generate a checkout session:Manage Customers
Create and retrieve customer information:Handle Subscriptions
Create and manage recurring subscriptions:Billing requires at minimum the two-letter ISO Country code. Customer is a CustomerRequestUnionParam — pass AttachExistingCustomerParam{CustomerID: ...} for an existing customer or NewCustomerParam{Email: ..., Name: ...} for a new one. ProductPrice is in the lowest currency denomination.Usage-Based Billing
Ingest Usage Events
Track custom events:List Usage Events
Error Handling
When the API returns a non-success status code, the SDK returns an error of type*dodopayments.Error. It exposes the StatusCode, the underlying *http.Request and
*http.Response, and the JSON of the error body. Use the errors.As pattern to
inspect it, and branch on StatusCode to handle specific cases:
Middleware
Add custom middleware for logging or metrics:Concurrency
The client is safe for concurrent use: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 Go SDK?- Discord: Join our community server for real-time support
- Email: Contact us at support@dodopayments.com
- GitHub: Open an issue on the repository