SDKs overview
Paddle offers a suite of official SDKs designed to streamline the integration of its payment and subscription management services into various applications. These SDKs simplify common development tasks by abstracting direct API calls, managing authentication, and facilitating data handling. Developers can utilize these tools to implement features such as secure checkout flows, subscription creation and management, customer data handling, and webhook processing. The goal of these SDKs is to reduce development time and potential errors when interacting with the Paddle API reference.
In addition to the officially supported libraries, a growing ecosystem of community-contributed SDKs and wrappers extends Paddle's reach to a broader range of programming languages and frameworks. These community efforts often provide additional flexibility or cater to specific development preferences, though they may not carry the same level of official support or guarantees as the first-party offerings. Both official and community libraries aim to provide a more idiomatic approach to integrating Paddle's services than direct HTTP requests.
Official SDKs by language
Paddle officially maintains SDKs for several popular programming languages, providing core functionalities for interacting with the Paddle platform. These SDKs are actively developed and supported by Paddle, ensuring compatibility with the latest API versions and features. They are designed to encapsulate the complexities of the RESTful API, offering language-specific objects and methods that map directly to Paddle's resources like customers, subscriptions, and transactions. Below is a summary of the key official SDKs:
| Language | Package / Repository | Install Command Example | Maturity |
|---|---|---|---|
| JavaScript | @paddle/paddle-js |
npm install @paddle/paddle-js |
Stable |
| PHP | paddle/paddle-php-sdk |
composer require paddle/paddle-php-sdk |
Stable |
| Python | paddle-python-sdk |
pip install paddle-python-sdk |
Stable |
| Ruby | paddle-ruby |
gem install paddle-ruby |
Stable |
| Go | paddle/paddle-go-sdk |
go get github.com/paddle/paddle-go-sdk |
Stable |
Each official SDK typically provides methods for making API requests, handling responses, and managing authentication securely using API keys. Developers seeking detailed usage instructions and examples for each specific language can refer to the Paddle developer SDK documentation.
Installation
Installing Paddle's official SDKs typically follows the standard package management practices for each respective programming language. The process generally involves using a command-line tool to add the SDK to your project's dependencies. After installation, the SDK can be imported and initialized within your application code, usually requiring your Paddle API key for authentication. The Paddle API functions as a merchant of record, handling compliance, taxes, and payment processing, which is abstracted by these SDKs. For example, the Stripe API documentation also shows how their SDKs simplify payment processing.
JavaScript (Node.js/Browser)
For JavaScript projects, the official SDK can be installed via npm or yarn:
npm install @paddle/paddle-js
# or
yarn add @paddle/paddle-js
This package is suitable for both client-side browser applications and server-side Node.js environments. For browser use, it provides client-side checkout and UI components.
PHP
PHP projects commonly use Composer for dependency management:
composer require paddle/paddle-php-sdk
After installation, you can include Composer's autoloader in your PHP script to make the Paddle SDK classes available.
Python
Python developers can install the SDK using pip:
pip install paddle-python-sdk
This command adds the Paddle Python SDK to your project's Python environment, allowing you to import it and interact with the API.
Ruby
For Ruby applications, the SDK is available as a Gem:
gem install paddle-ruby
You can then require the 'paddle' gem in your Ruby code to start using it.
Go
Go modules are used to manage dependencies for the Go SDK:
go get github.com/paddle/paddle-go-sdk
This command fetches the Go SDK and adds it to your project's dependencies, making its packages available for import.
Quickstart example
While specific implementation details vary by language and the exact Paddle feature being used, a common quickstart typically involves initializing the SDK with your API key and then making a call to create a resource, such as a customer or a subscription. Here's a simplified conceptual example using Python to create a customer, illustrating the basic interaction pattern:
Python Example: Creating a Customer
This example demonstrates how to set up the Paddle Python SDK and create a new customer. Before running this, ensure you have your Paddle API key and a client ID from your Paddle dashboard for authentication.
import paddle
# Configure Paddle with your API Key and Client ID
paddle.api_key = "YOUR_PADDLE_API_KEY"
paddle.client_id = "YOUR_PADDLE_CLIENT_ID"
try:
# Create a new customer
customer = paddle.Customer.create(
email="[email protected]",
name="Test Customer"
)
print(f"Customer created successfully: {customer.id}")
print(f"Customer email: {customer.email}")
except paddle.exceptions.PaddleApiException as e:
print(f"Error creating customer: {e.code} - {e.detail}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
This snippet initializes the SDK with credentials and then calls the Customer.create method with the required customer details. Error handling is included to catch potential issues during the API call. Similar patterns apply for creating subscriptions, processing payments, or managing other Paddle resources across different SDKs. For comprehensive examples and more advanced use cases, consulting the official Paddle SDK documentation is recommended.
Community libraries
Beyond the officially supported SDKs, the Paddle developer community has contributed various libraries and wrappers for languages not directly covered by Paddle's first-party offerings, or to provide alternative approaches for existing languages. These community-driven projects can be valuable for developers working in specific ecosystems or with particular preferences. While these libraries may not receive direct support from Paddle, they often fill gaps and demonstrate the flexibility of Paddle's API. Examples of languages for which community libraries exist include Node.js (beyond the official @paddle/paddle-js client for server-side operations), C#, Rust, and Java.
Developers interested in leveraging community libraries should explore resources like GitHub or package managers specific to their language to discover available options. It's important to review the project's documentation, community activity, and licensing terms before incorporating a third-party library into a production application. Engaging with the broader developer community through forums or issue trackers can also provide insights into the stability and ongoing maintenance of these unofficial integrations.
For instance, while Paddle offers an official JavaScript SDK that can be used in Node.js environments, specific community wrappers might exist that offer different architectural patterns or additional convenience methods for Node.js server applications. Similarly, for languages like C# or Java, where no official SDK is provided, community-developed clients become the primary method for integrating with Paddle's REST API using language-native constructs. Developers should always verify the compatibility of community libraries with the latest HTTP API specifications to ensure reliable integration.