Python client library for the Paylio API
Project description
Paylio Python SDK
The Paylio Python SDK provides convenient access to the Paylio API from applications written in Python.
Documentation
See the Paylio API docs.
Requirements
- Python 3.9+
Installation
pip install paylio
Usage
import paylio
client = paylio.PaylioClient("sk_live_xxx")
# Retrieve current subscription
sub = client.subscription.retrieve("user_123")
print(sub.status) # "active"
print(sub.plan.name) # "Pro Plan"
print(sub.plan.amount) # 999
List subscription history
history = client.subscription.list("user_123", page=1, page_size=10)
for item in history.items:
print(item.plan_name, item.status)
if history.has_more:
next_page = client.subscription.list("user_123", page=2)
Cancel a subscription
# Cancel at end of billing period (safe default)
result = client.subscription.cancel("subscription_uuid")
print(result.success) # True
# Cancel immediately
result = client.subscription.cancel("subscription_uuid", cancel_now=True)
Context manager
with paylio.PaylioClient("sk_live_xxx") as client:
sub = client.subscription.retrieve("user_123")
Configuration
client = paylio.PaylioClient(
"sk_live_xxx",
base_url="https://api.paylio.pro/flying/v1",
)
Error handling
import paylio
client = paylio.PaylioClient("sk_live_xxx")
try:
sub = client.subscription.retrieve("user_123")
except paylio.AuthenticationError:
print("Invalid API key")
except paylio.NotFoundError:
print("Subscription not found")
except paylio.RateLimitError:
print("Rate limited, try again later")
except paylio.InvalidRequestError as e:
print(f"Bad request: {e.message}")
except paylio.APIError as e:
print(f"API error: {e.message} (status {e.http_status})")
except paylio.APIConnectionError:
print("Network error")
Error types
| Error | HTTP Status | Description |
|---|---|---|
AuthenticationError |
401 | Invalid or missing API key |
InvalidRequestError |
400 | Bad request parameters |
NotFoundError |
404 | Resource not found |
RateLimitError |
429 | Rate limit exceeded |
APIError |
5xx | Server error |
APIConnectionError |
— | Network or connection failure |
All errors inherit from PaylioError.
Development
pip install -e ".[dev]"
pytest
ruff check .
mypy .
License
MIT
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file paylio-0.1.6.tar.gz.
File metadata
- Download URL: paylio-0.1.6.tar.gz
- Upload date:
- Size: 13.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0eaf7a56966990921be907ab049faffc09989b05c937c1feb6aa0021af0af1ab
|
|
| MD5 |
1f1dc6af1f6f5d33f162eb6099bf197e
|
|
| BLAKE2b-256 |
872d9f21848670b608416e33c16e2a1c968938caa834ec7e2912222dbe34e291
|
Provenance
The following attestation bundles were made for paylio-0.1.6.tar.gz:
Publisher:
publish.yml on paylio-org/paylio-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
paylio-0.1.6.tar.gz -
Subject digest:
0eaf7a56966990921be907ab049faffc09989b05c937c1feb6aa0021af0af1ab - Sigstore transparency entry: 976420222
- Sigstore integration time:
-
Permalink:
paylio-org/paylio-python@76b928b606c9175659052a5e4d2184208ee12a14 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/paylio-org
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@76b928b606c9175659052a5e4d2184208ee12a14 -
Trigger Event:
push
-
Statement type:
File details
Details for the file paylio-0.1.6-py3-none-any.whl.
File metadata
- Download URL: paylio-0.1.6-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6846689dcf1f2ad4e98518ee8e8d4a28b318113ff0a583799be6032e0b1fdddd
|
|
| MD5 |
6981d857035991ad121ac7c02ca07368
|
|
| BLAKE2b-256 |
833767de353d8017374d37f0a2da501e758662e0c17580117db14deec35aa08c
|
Provenance
The following attestation bundles were made for paylio-0.1.6-py3-none-any.whl:
Publisher:
publish.yml on paylio-org/paylio-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
paylio-0.1.6-py3-none-any.whl -
Subject digest:
6846689dcf1f2ad4e98518ee8e8d4a28b318113ff0a583799be6032e0b1fdddd - Sigstore transparency entry: 976420226
- Sigstore integration time:
-
Permalink:
paylio-org/paylio-python@76b928b606c9175659052a5e4d2184208ee12a14 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/paylio-org
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@76b928b606c9175659052a5e4d2184208ee12a14 -
Trigger Event:
push
-
Statement type: