PHPackages                             tuxxx128/paddle-php-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. tuxxx128/paddle-php-api

ActiveLibrary[API Development](/categories/api)

tuxxx128/paddle-php-api
=======================

Paddle.com API PHP library

v1.1.1(9y ago)1591MITPHPPHP &gt;=5.3.0

Since Oct 3Pushed 8y ago1 watchersCompare

[ Source](https://github.com/tuxxx128/paddle-php)[ Packagist](https://packagist.org/packages/tuxxx128/paddle-php-api)[ Docs](https://github.com/PaddleHQ/paddle-php)[ RSS](/packages/tuxxx128-paddle-php-api/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

Paddle.com API PHP wrapper library
----------------------------------

[](#paddlecom-api-php-wrapper-library)

This library provides convinient way of querying Paddle API from php code.

Requirements
------------

[](#requirements)

PHP 5.3 or later.

Installation via Composer
-------------------------

[](#installation-via-composer)

You can install the library via Composer. Add this to your composer.json:

```
{
    "require": {
        "tuxxx128/paddle-php-api": "1.*"
    }
}
```

Getting Started
---------------

[](#getting-started)

To interact with Paddle API you need to create an API object, and authorize using vendor\_id / vendor\_api\_key:

```
$api = new \Paddle\Api;
$api->authorize_vendor($vendor_id, $vendor_auth_code);
```

Optionally you can set HTTP timeout (default is 30 seconds):

```
$api->set_timeout(60);
```

Both authorization and timeout can be set as well while creating new API object:

```
$api = new \Paddle\Api($vendor_id, $vendor_auth_code, 60);
```

Example usage of generate\_license() method:

```
// define $vendor_id and $vendor_auth_code first
$api = new \Paddle\Api($vendor_id, $vendor_auth_code, 60);
$product_id = 100;
$license_code = $api->generate_license($product_id);
```

Common exceptions
-----------------

[](#common-exceptions)

All methods can thrown the following exceptions of type \\Exception:

- 1XX - API response errors
- code: 100 message: 'Unable to find requested license'
- code: 101 message: 'Bad method call'
- code: 102 message: 'Bad api key'
- code: 103 message: 'Timestamp is too old or not valid'
- code: 104 message: 'License code has already been utilized'
- code: 105 message: 'License code is not active'
- code: 106 message: 'Unable to find requested activation'
- code: 107 message: 'You don't have permission to access this resource'
- code: 108 message: 'Unable to find requested product'
- code: 109 message: 'Provided currency is not valid'
- code: 110 message: 'Unable to find requested purchase'
- code: 111 message: 'Invalid authentication token'
- code: 112 message: 'Invalid verification token'
- code: 113 message: 'Invalid padding on decrypted string'
- code: 114 message: 'Invalid or duplicated affiliate'
- code: 115 message: 'Invalid or missing affiliate commision'
- code: 116 message: 'One or more required arguments are missing'
- code: 117 message: 'Provided expiration time is incorrect'
- 2XX - general errors
- code: 200 message: 'CURL error'
- code: 201 message: 'Incorrect HTTP response code'
- code: 202 message: 'Incorrect API response'
- code: 203 message: 'Timeout must be a positive integer'
- code: 204 message: 'Vendor credentials not provided'

Available methods
-----------------

[](#available-methods)

### Generate pay link for regular product

[](#generate-pay-link-for-regular-product)

```
string generate_product_pay_link (int $product_id, [array $optional_arguments = array()])
```

#### Parameters

[](#parameters)

- int $product\_id - the id of the product
- array $optional\_arguments - an associative array of optional parameters:
- string 'title' - override product title
- string 'image\_url' - override product image
- float 'price' - overrride product price
- string 'return\_url' - url to redirect to after transaction is complete
- bool 'discountable' - whether coupon can be apply to checkout by user
- string 'coupon\_code' - discount coupon code
- bool 'locker\_visible' - whether product is visible in user's locker
- bool 'quantity\_variable' - whether product quantity can be changed by user
- string 'paypal\_cancel\_url' - url to redirect to when paypal transaction was canceled
- int 'expires' - checkout expiration date, timestamp
- bool 'is\_popup' - whether checkout is being displayed as popup
- string 'parent\_url' - url to redirect to when close button on checkout popup is clicked
- array 'affiliates' - every element should contain affiliate\_id as key, and affiliate\_commission as value.
- Commission value should be float, so commission '0.1' equals 10%.
- array 'stylesheets' - every element should contain stylesheet type as key, and code as value

#### Validation exceptions of type \\InvalidArgumentException

[](#validation-exceptions-of-type-invalidargumentexception)

- code: 300 message: '$product\_id must be a positive integer'
- code: 301 message: '$title must be a string'
- code: 302 message: '$image\_url must be a valid url'
- code: 303 message: '$price must be a number'
- code: 304 message: '$price must not be negative'
- code: 305 message: '$return\_url must be a valid url'
- code: 306 message: '$paypal\_cancel\_url must be a valid url'
- code: 307 message: '$expires must be a valid timestamp'
- code: 308 message: '$expires must be in the future'
- code: 309 message: '$parent\_url must be a valid url'
- code: 310 message: '$affiliates must be an array'
- code: 311 message: 'provide $affiliates as key-&gt;value contained array with vendor\_id-&gt;vendor\_commission'
- code: 312 message: '$stylesheets must be an array'
- code: 313 message: 'provide $stylesheets as key-&gt;value contained array with stylesheet\_type-&gt;stylesheet\_code'
- code: 314 message: '$webhook\_url can only be set for custom product'

---

### Generate pay link for custom (not existing in Paddle database) product

[](#generate-pay-link-for-custom-not-existing-in-paddle-database-product)

```
string generate_custom_product_pay_link (string $title, float $price, string $image_url, string $webhook_url, array $optional_arguments)
```

#### Parameters

[](#parameters-1)

- string $title - title of custom product
- float $price - price of custom product
- string $image\_url - image of custom product
- string $webhook\_url - webhook\_url of custom product
- array $optional\_arguments - an associative array of optional parameters:
- string 'return\_url' - url to redirect to after transaction is complete
- bool 'locker\_visible' - whether product is visible in user's locker
- bool 'quantity\_variable' - whether product quantity can be changed by user
- string 'paypal\_cancel\_url' - url to redirect to when paypal transaction was canceled
- int 'expires' - checkout expiration date, timestamp
- bool 'is\_popup' - whether checkout is being displayed as popup
- string 'parent\_url' - url to redirect to when close button on checkout popup is clicked
- array 'affiliates' - every element should contain affiliate\_id as key, and affiliate\_commission as value.
- Commission value should be float, so commission '0.1' equals 10%.
- array 'stylesheets' - every element should contain stylesheet type as key, and code as value

#### Validation exceptions of type \\InvalidArgumentException

[](#validation-exceptions-of-type-invalidargumentexception-1)

- code: 301 message: '$title must be a string'
- code: 302 message: '$image\_url must be a valid url'
- code: 303 message: '$price must be a number'
- code: 304 message: '$price must not be negative'
- code: 305 message: '$return\_url must be a valid url'
- code: 306 message: '$paypal\_cancel\_url must be a valid url'
- code: 307 message: '$expires must be a valid timestamp'
- code: 308 message: '$expires must be in the future'
- code: 309 message: '$parent\_url must be a valid url'
- code: 310 message: '$affiliates must be an array'
- code: 311 message: 'provide $affiliates as key-&gt;value contained array with vendor\_id-&gt;vendor\_commission'
- code: 312 message: '$stylesheets must be an array'
- code: 313 message: 'provide $stylesheets as key-&gt;value contained array with stylesheet\_type-&gt;stylesheet\_code'
- code: 315 message: '$webhook\_url must be a valid url'
- code: 316 message: '$discountable is not allowed for custom product'
- code: 317 message: '$coupon\_code is not allowed for custom product'
- code: 318 message: '$product\_id is not allowed for custom product'

---

### Generate license code for framework product

[](#generate-license-code-for-framework-product)

```
string generate_license (int $product_id)
```

#### Parameters

[](#parameters-2)

- int $product\_id - the id of the product

#### Validation exceptions of type \\InvalidArgumentException

[](#validation-exceptions-of-type-invalidargumentexception-2)

- code: 300 message: '$product\_id must be a positive integer'

---

### Get paginated list of products including details of each product

[](#get-paginated-list-of-products-including-details-of-each-product)

```
array get_products ([int $limit = 1], [int $offset = 0])
```

#### Parameters

[](#parameters-3)

- int $limit - number of returned products
- int $offset - offset from first product

#### Return Values

[](#return-values)

Returned array contains:

- int 'total' - total number of products
- int 'count' - number of returned products
- array 'products' - returned products, each of whitch contains:
- int 'id' - id of the product
- string 'name' - name of the product
- string 'description' - description of the product
- float 'base\_price' - base price of the product
- float 'sale\_price' - sale price of the product
- array 'screenshots' - screenshots of the product
- string 'icon' - image of the product

#### Validation exceptions of type \\InvalidArgumentException

[](#validation-exceptions-of-type-invalidargumentexception-3)

- code: 319 message: '$limit must be a positive integer'
- code: 320 message: '$offset must be a non negative integer'

---

### Get an array of customers details

[](#get-an-array-of-customers-details)

```
array generate_customers_report ([int $product_id = null])
```

#### Parameters

[](#parameters-4)

- int $product\_id - the id of product for which report will be created, if not provided report will contain all products data

#### Return Values

[](#return-values-1)

Returned array contains:

- string 'full\_name' - full name of the customer
- string 'email' - email address of the customer

#### Validation exceptions of type \\InvalidArgumentException

[](#validation-exceptions-of-type-invalidargumentexception-4)

- code: 300 message: '$product\_id must be a positive integer'

---

### Get an array of license activations details

[](#get-an-array-of-license-activations-details)

Activations are reportable the day after they occur - so any activations from today will not be included

```
array generate_license_activations_report ([int $product_id = null], [int $start_timestamp = null], [int $end_timestamp = null])
```

#### Parameters

[](#parameters-5)

- int $product\_id - the id of product for which report will be created, if not provided report will contain all products data
- int $start\_timestamp - report start time
- int $end\_timestamp - report end date

#### Return Values

[](#return-values-2)

Returned array contains:

- string 'license\_code' - license code
- string 'activation\_date' - activation date
- string 'customer\_ip' - customer ip
- string 'customer\_email' - customer email

#### Validation exceptions of type \\InvalidArgumentException

[](#validation-exceptions-of-type-invalidargumentexception-5)

- code: 300 message: '$product\_id must be a positive integer'
- code: 321 message: '$start\_timestamp must be a timestamp'
- code: 322 message: '$end\_timestamp must be a timestamp'

---

### Get an array of orders details

[](#get-an-array-of-orders-details)

```
array generate_orders_report ([int $product_id = null], [int $start_timestamp = null], [int $end_timestamp = null])
```

#### Parameters

[](#parameters-6)

- int $product\_id - the id of product for which report will be created, if not provided report will contain all products data
- int $start\_timestamp - report start time
- int $end\_timestamp - report end date

#### Return Values

[](#return-values-3)

Returned array contains:

- int 'order\_id' - id of the order
- string 'product\_name' - name of the product
- float 'your\_earnings' - your earnings
- string 'earnings\_currency' - earnings currency
- string 'sale\_date' - sale date

#### Validation exceptions of type \\InvalidArgumentException

[](#validation-exceptions-of-type-invalidargumentexception-6)

- code: 300 message: '$product\_id must be a positive integer'
- code: 321 message: '$start\_timestamp must be a timestamp'
- code: 322 message: '$end\_timestamp must be a timestamp'

---

### Get an array of sent licenses details

[](#get-an-array-of-sent-licenses-details)

```
array generate_sent_licenses_report ([int $product_id = null])
```

#### Parameters

[](#parameters-7)

- int $product\_id - the id of product for which report will be created, if not provided report will contain all products data

#### Return Values

[](#return-values-4)

Returned array contains:

- string 'customer\_name' - full name of the customer
- string 'customer\_email' - email address of the customer
- string 'product\_name' - name of the product
- string 'license\_code' - license code

#### Validation exceptions of type \\InvalidArgumentException

[](#validation-exceptions-of-type-invalidargumentexception-7)

- code: 300 message: '$product\_id must be a positive integer'

---

### Generate credentials to be used to call other API methods

[](#generate-credentials-to-be-used-to-call-other-api-methods)

```
array generate_auth_code (string $vendor_email, string $vendor_password)
```

#### Parameters

[](#parameters-8)

- string $vendor\_email
- string $vendor\_password

#### Return Values

[](#return-values-5)

Returned array contains:

- int 'vendor\_id'
- string 'vendor\_auth\_code'

#### Validation exceptions of type \\InvalidArgumentException

[](#validation-exceptions-of-type-invalidargumentexception-8)

- code: 323 message: '$vendor\_email must be valid'

---

### Register external application and receive auth code, that application can use to call API methods

[](#register-external-application-and-receive-auth-code-that-application-can-use-to-call-api-methods)

```
string register_external_application (string $application_name, string $application_description, string $application_icon_url)
```

#### Validation exceptions of type \\InvalidArgumentException

[](#validation-exceptions-of-type-invalidargumentexception-9)

- code: 324 message: '$application\_icon\_url must be a valid url'

---

### Get vendor public key

[](#get-vendor-public-key)

```
string get_vendor_public_key ()
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~395 days

Total

3

Last Release

3452d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6b5e3b3642fdb383e7fe31a21645e60d2c00f81fd0287a8cfe253ebe2c3aa354?d=identicon)[tuxxx128](/maintainers/tuxxx128)

---

Top Contributors

[![rob-hunt-paddle](https://avatars.githubusercontent.com/u/36851168?v=4)](https://github.com/rob-hunt-paddle "rob-hunt-paddle (6 commits)")[![joshua-paddle](https://avatars.githubusercontent.com/u/6573798?v=4)](https://github.com/joshua-paddle "joshua-paddle (1 commits)")[![mpaddle](https://avatars.githubusercontent.com/u/13312125?v=4)](https://github.com/mpaddle "mpaddle (1 commits)")[![vifer](https://avatars.githubusercontent.com/u/17689985?v=4)](https://github.com/vifer "vifer (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tuxxx128-paddle-php-api/health.svg)

```
[![Health](https://phpackages.com/badges/tuxxx128-paddle-php-api/health.svg)](https://phpackages.com/packages/tuxxx128-paddle-php-api)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
