Metadata-Version: 2.4
Name: python-paddle
Version: 0.2.2
Summary: An unofficial SDK for Paddle's billing API and webhooks.
Author: Nyeki
License: Business Source License 1.0
        
        Licensor: Rafael Bradley
        
        Software: Nekidev/paddle-py
        
        Use Limitation:
            The Software may not be used, directly or indirectly, to develop, provide, or distribute:
        
            - a billing platform, payment processing service, subscription management service, or merchant-of-record service;
            - an official or unofficial SDK, client library, or integration distributed by or on behalf of any billing or payment service provider;
            - a hosted, managed, or commercial service that exposes the functionality of the Software to third parties as a primary or standalone offering.
        
            This limitation does not apply to internal use, evaluation, personal projects, or applications where the Software is used solely as an internal dependency.
        
        Change Date: 10 years after the release of this version
        
        You are granted limited license to the Software under this Business Source License.  Please read this Business Source License carefully, particularly the Use Limitation set forth above.  
        
        Subject to the Use Limitation, Licensor grants you a non-exclusive, worldwide (subject to applicable laws) license to copy, modify, display, use, create derivative works, and redistribute the Software until the Change Date. If your use of the Software exceeds, or will exceed, the foregoing limitations you MUST obtain alternative licensing terms for the Software directly from Licensor, its affiliated entities, or authorized resellers.  For the avoidance of doubt, prior to the Change Date, there are no additional Use Limitations for non-production purposes.
        
        After the Change Date, this Business Source License will convert to the Change License and your use of the Software, including modified versions of the Software, will be governed by such Change License.
        
        All copies of original and modified Software, and derivative works of the Software, are subject to this Business Source License.   This Business Source License applies separately for each version of the Software and the Change Date will vary for each version of the Software released by Licensor.
        
        You must conspicuously display this Business Source License on each original or modified copy of the Software. If you receive the Software in original or modified form from a third party, the restrictions set forth in this Business Source License apply to your use of such Software.
        
        Any use of the Software in violation of this Business Source License will automatically terminate your rights under this Business Source License for the current and all future versions of the Software.
        
        You may not use the marks or logos of Licensor or its affiliates for commercial purposes without prior written consent from Licensor.
        
        TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE SOFTWARE AND ALL SERVICES PROVIDED BY LICENSOR OR ITS AFFILIATES UNDER OR IN CONNECTION WITH THIS BUSINESS SOURCE LICENSE ARE PROVIDED ON AN "AS IS" AND "AS AVAILABLE" BASIS. YOU EXPRESSLY WAIVE ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, TITLE, SYSTEM INTEGRATION, AND ACCURACY OF INFORMATIONAL CONTENT.
Requires-Python: >=3.13
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx>=0.28.1
Requires-Dist: pydantic>=2.12.5
Dynamic: license-file

# Unofficial Paddle Billing Python SDK

A small Paddle Billing SDK. It uses pydantic for schemas derived from the Paddle Billing OpenAPI
file.

## Installation

To install the package, install it from pypi:

```sh
uv add python-paddle
# or
pip install python-paddle
```

Or your favorite package manager.

## Usage

Currently, the SDK does not provide functions to call the API for all resources. It does provide
two things:

1. API schemas as Pydantic models
2. Webhook validation
3. Operations on customers
4. Operations on transactions

### Calling the API

To call the API, you need to initialize a client:

```py
from paddle import Paddle

client = Paddle(token="...")
```

Once you have the client, you can call any methods on it asynchronously. For example:

```py
transaction = await client.get_transaction(transaction_id)
```

### Schemas

The schemas can be found under `paddle.schemas`, like `paddle.schemas.Transaction`.

### Webhooks

Webhooks can be validated using `paddle.webhooks.verify`. For example:

```py
from paddle import webhooks

webhooks.verify(
    secret="YOUR_WEBHOOK_SECRET",
    signature="YOUR_WEBHOOK_SIGNATURE",  # Extract this value from the `Paddle-Signature` in the webhook request
    body="THE_REQUEST_BODY",
)
```

It'll raise a `paddle.webhooks.exceptions.ValidationError` if the webhook could not be verified,
otherwise it'll return `True`.

To instead get a `bool` returned from the function, without an error raised on failure, pass the
`error=False` argument.

```py
from paddle import webhooks

is_valid = webhooks.verify(
    secret="YOUR_WEBHOOK_SECRET",
    signature="YOUR_WEBHOOK_SIGNATURE",  # Extract this value from the `Paddle-Signature` in the webhook request
    body="THE_REQUEST_BODY",
    error=False,
)

if is_valid:
    print("Great!")

else:
    print("Damn")
```

### Exceptions

All exceptions raised by this library inherit from `paddle.exceptions.PaddleException`.

## Contributing

All contributions are welcome! Whether it's tests, bugs, documentation, or anything else, open an
issue in our [GitHub repository](https://github.com/Nekidev/paddle-py). Thanks for your interest!
