Skip to main content
The PHP SDK provides a robust and flexible way to integrate Dodo Payments into your PHP applications. Built following modern PHP standards with PSR-4 autoloading, it offers extensive test coverage and detailed documentation.

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:
Store your API keys securely using environment variables. Never expose them in your codebase or commit them to version control.

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 static with constructor:
Builders are also available as an alternative pattern:

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
Configure retry behavior globally or per-request:

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 of APIException is thrown:

Error Types

Always wrap API calls in try-catch blocks to handle potential errors gracefully and provide meaningful feedback to users.

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:
Add configuration in config/services.php:

Symfony

Create a service in Symfony:
Register in 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?

Contributing

We welcome contributions! Check the contributing guidelines to get started.
Last modified on May 28, 2026