Installation
Install the SDK using Composer:The SDK requires PHP 8.1.0 or higher and Composer for dependency management.
Quick Start
Initialize the client and create a checkout session:Core Features
PSR-4 Compliant
Follows PHP Standards Recommendations for modern PHP development
Modern PHP
Built for PHP 8.1+ with type declarations and strict types
Extensive Testing
Comprehensive test coverage for reliability and stability
Exception Handling
Clear exception types for different error scenarios
Value Objects
The SDK uses named parameters to specify optional arguments. You can initialize value objects using the staticwith constructor:
Configuration
Retry Configuration
Certain errors are automatically retried 2 times by default with a short exponential backoff. The following errors trigger automatic retries:- Connection errors (network connectivity problems)
- 408 Request Timeout
- 409 Conflict
- 429 Rate Limit
- 500+ Internal errors
- Timeouts
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. Pass AttachExistingCustomer::with(customerID: '...') to attach an existing customer, or NewCustomer::with(email: '...', name: '...') to create one. productPrice is in the lowest currency denomination.Pagination
Work with paginated list responses:Error Handling
When the library cannot connect to the API or receives a non-success status code (4xx or 5xx), a subclass ofAPIException is thrown:
Error Types
Advanced Usage
Undocumented Endpoints
Make requests to undocumented endpoints:Undocumented Parameters
Send undocumented parameters to any endpoint or read undocumented response properties:The
extra* parameters with the same name override documented parameters.Framework Integration
Laravel
Create a service for Laravel applications:config/services.php:
Symfony
Create a service in Symfony:config/services.yaml:
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 PHP SDK?- Discord: Join our community server for real-time support
- Email: Contact us at support@dodopayments.com
- GitHub: Open an issue on the repository