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:
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:
- API schemas as Pydantic models
- Webhook validation
- Operations on customers
- Operations on transactions
- Operations on saved payment methods
- Operations on subscriptions
- Operations on addresses
- Operations on businesses
Calling the API
To call the API, you need to initialize a client:
from paddle import Paddle
client = Paddle(token="...")
In case you're using the sandbox environment, pass production = False as an argument when
initializing the Paddle class.
client = Paddle(token="...", production=False)
Once you have the client, you can call any methods on it asynchronously. For example:
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:
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.
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. Thanks for your interest!
Metadata
Release files for python-paddle 0.3.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| python_paddle-0.3.6.tar.gz | 48.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| python_paddle-0.3.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 108.7 kB
Release files / python_paddle-0.3.6.tar.gz
| Download URL | python_paddle-0.3.6.tar.gz |
|---|---|
| Size | 48.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aae9f19d31deefbe96b70fc8e5e3c51995efa898129ccb4dedb90bf3dbd1201a
|
|
BLAKE2b-256 checksum How to use checksums |
3219ebd5831faa7f3a7539690ed2909b4860e75f9ad39e07230645133427e0b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / python_paddle-0.3.6-py3-none-any.whl
| Download URL | python_paddle-0.3.6-py3-none-any.whl |
|---|---|
| Size | 60.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
efc3084dff09e5191715f20a567679322316c62fa2c98578f58626abb6d82a50
|
|
BLAKE2b-256 checksum How to use checksums |
2c14cf9f82c76422ea822b5ff6f5a7a90a1353b9d18fa1d60941f589edd7c4a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|