Skip to main content

Paddle Client

A python (3.5+) wrapper around the Paddle.com API

If you are looking at intergrating Paddle with Django check out dj-paddle

Note: This is a work in progress, not all of the Paddle endpoints have been implemented yet

Quick start

Installation

pip install paddle-client

Usage

To use the Paddle API you will need a Paddle Vendor ID and API key which can be found on Paddle's authentication page

from paddle import PaddleClient


paddle = PaddleClient(vendor_id=12345, api_key='myapikey')
paddle.list_products()

If vendor_id and api_key are not passed through when initalising Paddle will fall back and try and use environmental variables called PADDLE_VENDOR_ID and PADDLE_API_KEY

export PADDLE_VENDOR_ID=12345
export PADDLE_API_KEY="myapikey"
from paddle import PaddleClient


paddle = PaddleClient()
paddle.list_products()

Documentation

Coming soon. Please see Endpoints below for basic usage.

Contributing

All contributions are welcome and appreciated. Please see CONTRIBUTING.md for more details including details on how to run tests etc.

Paddle Endpoints

Note: See Usage below for how to use each endpoint

Checkout API

Product API

Subscription API

Alert API

Usage

# Checkout API
paddle.get_order_details(checkout_id='aaaa-bbbb-cccc-1234')
paddle.get_user_history(email='test@example.com')
paddle.get_prices(product_ids=[1234])

# Product API
paddle.list_coupons(product_id=1234)
paddle.create_coupon(
    coupon_type='product',
    discount_type='percentage',
    discount_amount=50,
    allowed_uses=1,
    recurring=False,
    currency='USD',
    product_ids=[1234],
    coupon_code='50%OFF',
    description='50% off coupon over $10',
    expires='2030-01-01 10:00:00',
    minimum_threshold=10,
    group='paddle-python',
)
paddle.delete_coupon(coupon_code='mycoupon', product_id=1234)
paddle.update_coupon(
    coupon_code='mycoupon',
    new_coupon_code='40%OFF',
    new_group='paddle-python-test',
    product_ids=[1234],
    expires='2030-01-01 10:00:00',
    allowed_uses=1,
    currency='USD',
    minimum_threshold=10,
    discount_amount=40,
    recurring=True
)
paddle.list_products()
paddle.list_transactions(entity='subscription', entity_id=1234)
paddle.refund_product_payment(order_id=1234, amount=0.01, reason='reason')

# Subscription API
paddle.list_plans()
paddle.create_plan(
    plan_name='plan_name',
    plan_trial_days=14,
    plan_length=1,
    plan_type='month',
    main_currency_code='USD',
    initial_price_usd=50,
    recurring_price_usd=50,
)
paddle.list_subscription_users()
paddle.cancel_subscription(subscription_id=1234)
paddle.update_subscription(subscription_id=1234, pause=True)
paddle.preview_update_subscription(
    subscription_id=123,
    bill_immediately=True,
    quantity=101,
)
paddle.add_modifier(subscription_id=1234, modifier_amount=10.5)
paddle.delete_modifier(modifier_id=10)
paddle.list_modifiers()
paddle.list_subscription_payments()
paddle.reschedule_subscription_payment(payment_id=4567, date='2030-01-01')
paddle.create_one_off_charge(
    subscription_id=1234,
    amount=0.0,
    charge_name="Add X on top of subscription"
)

# Alert API
paddle.get_webhook_history()

Failing Endpoints

The below endpoints have been implimented but are not working correctly according to the tests. They have been commented out in paddle/paddle.py and the tests will skip is the methods do not exist

ToDo

  • Fix generate license, create pay link and reschedule payment endpoints
  • Work out if we want to include 'alias' methods like pause_subscription
  • Get test coverage to 100%
  • Docs (auto docs?)
  • Use pytest-mock Spy to check params, json, urls etc for test requests
    • Needed to any tests which skip due to missing data
  • How to deal with the manual cleanup?
  • Pull request template
  • TravisCI?
  • Dependabot
  • Remove double call for exception error message checking - How to get the exception str from pytest.raises()? pytest-mock Spy?
  • Add pytest warnings to provide direct links to Paddle for bits that need to be cleaned up

Metadata

Release files for paddle-client 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for paddle-client 0.7.0
File Size Uploaded
paddle-client-0.7.0.tar.gz 17.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for paddle-client 0.7.0
File Interpreter ABI Platform
paddle_client-0.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 38.0 kB

Release files / paddle-client-0.7.0.tar.gz

Download URL paddle-client-0.7.0.tar.gz
Size 17.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e27848681b8d5df232af3532a12248d7b7fe1fb46526612e2ef98e22f5dad219
BLAKE2b-256 checksum
How to use checksums
6e28f889b93f4b775599fc723a8d7d56ff0fb5d03648984356d2df0a585f05cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.5.9 Darwin/18.6.0

Release files / paddle_client-0.7.0-py3-none-any.whl

Download URL paddle_client-0.7.0-py3-none-any.whl
Size 20.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5d20bc94db9209e830d2be87308c079007fc307893d71aa874815d77f94ba3a0
BLAKE2b-256 checksum
How to use checksums
bb4ce9b2ea1e179ab11f20ede892c875c7e08db289ae9fdfec96a7ce6e25a8d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.5.9 Darwin/18.6.0

Release history Release notifications | RSS feed

1.0.0

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.1

2 release files

This release

0.7.0 This release

2 release files

0.6.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page