Skip to main content

Python wrapper around the Paddle.com API

Project description

Paddle Python

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

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

Quick start

Installation

pip install paddle-python

Usage

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

from paddle import Paddle


paddle = Paddle(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 Paddle


paddle = Paddle()
paddle.list_products()

Documentation

Coming soon. Please see Working 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.

Working endpoints

paddle.get_order_details(checkout_id=checkout_id)
paddle.get_user_history(email=email)
paddle.get_prices(product_ids=[product_id])
paddle.list_coupons(product_id=product_id)
paddle.create_coupon(
    coupon_type='product',
    discount_type='percentage',
    discount_amount=50,
    allowed_uses=1,
    recurring=False,
    currency='USD',
    product_ids=product_ids,
    coupon_code='50%OFF',
    description='50% off coupon over $10',
    expires=expires,
    minimum_threshold=10,
    group='paddle-python',
)
paddle.delete_coupon(coupon_code=new_coupon_code, product_id=product_id)
paddle.update_coupon(
    coupon_code=coupon_code,
    new_coupon_code='40%OFF',
    new_group='paddle-python-test',
    product_ids=[product_id],
    expires=expires,
    allowed_uses=1,
    currency='USD',
    minimum_threshold=10,
    discount_amount=40,
    recurring=True
)
paddle.list_products()
paddle.list_transactions(entity='subscription', entity_id=subscription_id)
paddle.refund_payment(order_id=order_id, amount=amount, reason=reason)
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.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

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

paddle-python-0.4.3.tar.gz (14.6 kB view hashes)

Uploaded Source

Built Distribution

paddle_python-0.4.3-py3-none-any.whl (17.6 kB view hashes)

Uploaded Python 3

Supported by

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