Skip to main content

An unofficial SDK for Paddle's billing API and webhooks.

Project description

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:

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

Calling the API

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

from paddle import Paddle

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

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_paddle-0.2.1.tar.gz (46.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_paddle-0.2.1-py3-none-any.whl (54.8 kB view details)

Uploaded Python 3

File details

Details for the file python_paddle-0.2.1.tar.gz.

File metadata

  • Download URL: python_paddle-0.2.1.tar.gz
  • Upload date:
  • Size: 46.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","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}

File hashes

Hashes for python_paddle-0.2.1.tar.gz
Algorithm Hash digest
SHA256 3c25a4a9a350033febf113a7f6584b9f0f1a85e58396e4cc3e314d5dd73b9d48
MD5 7188363b522bc498a612c65eea7f831b
BLAKE2b-256 b405f37f38f2ba05dc34a731f75e52256085a20aacc92603974bc9d1aabc78c0

See more details on using hashes here.

File details

Details for the file python_paddle-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: python_paddle-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 54.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","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}

File hashes

Hashes for python_paddle-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 680978c491d50c0f204c055d6895fab4014e52413cfb7aa72b2468d654bb96e0
MD5 4cf318c1a7a36cdffdf8e63fb52729dc
BLAKE2b-256 32a2537f8fd3ff2dbd9db88e5907da89fd82aeb836e4682a44a9f5cb2997e3a0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page