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="myfakeapikey"
from paddle import Paddle
paddle = Paddle()
paddle.list_products()
Working endpoints
- Get Order Details
- Get User History
- Get Prices
- List Coupons
- Create Coupon
- Delete Coupon
- Update Coupon
- List Products
- List Plans
- Get Webhook History
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=coupon_type,
discount_type=discount_type,
discount_amount=discount_amount,
allowed_uses=allowed_uses,
recurring=recurring,
currency=currency,
product_ids=product_ids,
coupon_code=coupon_code,
description=description,
expires=expires,
minimum_threshold=minimum_threshold,
group=group,
)
paddle.delete_coupon(coupon_code=new_coupon_code, product_id=product_id)
paddle.update_coupon(
coupon_code=coupon_code,
new_coupon_code=new_coupon_code,
new_group='paddle-python-test',
product_ids=[product_id],
expires=expires,
allowed_uses=allowed_uses,
currency=currency,
minimum_threshold=9998,
discount_amount=discount_amount,
recurring=True
)
paddle.list_products()
paddle.list_plans()
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
- Generate License -
Paddle error 108 - Unable to find requested product
- Create pay link -
Paddle error 108 - Unable to find requested product
ToDo
- Fix generate license and create pay link endpoints
- Paddle API endpoints
- Get test coverage to 100%
- tox
- Do we want to have a set of tests which use mocks?
- Could use pytest-recording (vcrpy) to update Mock data
- Github actions to recreate mocks nightly?
- How to deal with different vendor_ids etc?
- Mock requests to check params, json, urls etc?
- How to deal with the manual cleanup
- Pull request template
- Travis?
- Test results in pull request
- Coverage info in pull request
- Dependabot
- Remove double call for exception error message checking. How to get the exception str from
pytest.raises()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for paddle_python-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5a3c58d941bdcb9cac263f6747715ac1a2365c19d4c8238203f5664e861643e |
|
MD5 | f33905ba07be770d0dd6e0130e49245b |
|
BLAKE2b-256 | 9a2aa553b0f872b9cccdf2dae3fbd3b23342f6a4ec757b0fcd316705f5520ca4 |