For AI agents and LLMs: a structured documentation index is available at /llms.txt. Every page has a Markdown sibling — append .md to any URL. To search these docs, send a GET request to https://paddle-docs-retrieval.kapa-paddle.workers.dev/?q=<question> with a URL-encoded question. No authentication needed.

Skip to content
Paddle Docs home

Get started with Paddle in PHP

Install the Paddle PHP SDK, initialize a client, make your first request, and verify webhook signatures.

AI summary

This quickstart shows you how to install the Paddle PHP SDK, initialize a client, make a read-only API call, and verify webhook signatures.

  • •Initialize the client with your sandbox API key and Environment::SANDBOX, then drop the options argument for production. Sandbox and live keys are not interchangeable; mixing them returns a forbidden error.
  • •Always verify the webhook signature with Verifier before acting on the payload. It accepts any PSR-7 RequestInterface, including Laravel requests converted with toPsrRequest().
  • •The SDK's list methods return an iterable that paginates automatically, so you can loop over results without manual paging. An empty sandbox returns zero results, so create a product first to see output.
Latest: v1.18.0 · 2026-09-10

This quickstart walks through installing the Paddle PHP SDK, initializing a client, making your first read-only API call, and verifying webhook signatures.

Using Laravel?

Use Laravel Cashier Paddle instead. It's maintained by the Laravel team and comes with framework-native conventions for payments, billing, and subscriptions.

Before you begin

You'll need:

Install the SDK

Install paddlehq/paddle-php-sdk with Composer:

Shell
composer require paddlehq/paddle-php-sdk

View the PHP SDK on GitHub

Initialize the client

Create a Client with your API key. Use the SANDBOX environment while you're building.

PHP
use Paddle\SDK\Client;
use Paddle\SDK\Environment;
use Paddle\SDK\Options;
$paddle = new Client(
apiKey: getenv('PADDLE_API_KEY'),
options: new Options(Environment::SANDBOX),
);

For production, drop the options argument:

PHP
$paddle = new Client(getenv('PADDLE_API_KEY'));

Sandbox API keys contain _sdbx. Sandbox and live keys are separate — using one against the other API returns a forbidden error.

Make your first request

List products to confirm the client is wired up. The SDK returns an iterable that paginates automatically.

PHP
use Paddle\SDK\Client;
use Paddle\SDK\Environment;
use Paddle\SDK\Options;
use Paddle\SDK\Exceptions\ApiError;
$paddle = new Client(
apiKey: getenv('PADDLE_API_KEY'),
options: new Options(Environment::SANDBOX),
);
try {
$products = $paddle->products->list();
foreach ($products as $product) {
echo $product->id . ' ' . $product->name . PHP_EOL;
}
} catch (ApiError $error) {
echo 'Paddle API error: ' . $error->getMessage();
}

If your sandbox account is empty, the loop runs zero times. Create a product in the dashboard or via $paddle->products->create() to see results.

4. Verify webhooks

You can use webhooks to keep your app in sync with Paddle. For example, you can provision access when a subscription is created, or revoke access when a subscription is canceled.

The SDK's Verifier accepts any PSR-7 RequestInterface, like Guzzle, Symfony, Laravel (Illuminate\Http\Request::toPsrRequest()), and most modern PHP HTTP frameworks all support this. Always verify the signature before acting on the payload.

PHP
use GuzzleHttp\Psr7\ServerRequest;
use Paddle\SDK\Entities\Event;
use Paddle\SDK\Notifications\Secret;
use Paddle\SDK\Notifications\Verifier;
$request = ServerRequest::fromGlobals();
$secret = new Secret(getenv('PADDLE_WEBHOOK_SECRET'));
if (!(new Verifier())->verify($request, $secret)) {
http_response_code(400);
exit('invalid signature');
}
$event = Event::fromRequest($request);
switch ($event->eventType) {
case 'transaction.completed':
// Provision access, send a receipt, etc.
break;
case 'subscription.updated':
// Sync the subscription to your database.
break;
}
http_response_code(200);
echo 'ok';

For the full webhook setup flow, including creating a notification destination and choosing events, see the webhooks quickstart. To learn how Paddle retries failed deliveries, see Handle webhook delivery.

Next steps

Was this page helpful?