Skip to main content

Python client library for the Paylio API

Project description

Paylio Python SDK

Python client library for the Paylio API.

Installation

pip install paylio

Usage

import paylio

client = paylio.PaylioClient("sk_live_xxx")

# Get 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 subscription (safe default: cancels at end of billing period)
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")

Custom Base URL

client = paylio.PaylioClient("sk_test_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.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")

Requirements

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

paylio-0.1.2.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

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

paylio-0.1.2-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file paylio-0.1.2.tar.gz.

File metadata

  • Download URL: paylio-0.1.2.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for paylio-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c08906bc340aa5b743543fe8609d0374d6a9015e078875c6f2453adce868eb5e
MD5 f0eefed21df032ef2f2c5bd0fb9b8e23
BLAKE2b-256 3dd21db39e76da3a5652cca61164ed76340e142493ed45ba143293cf0b0c5ac5

See more details on using hashes here.

File details

Details for the file paylio-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: paylio-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for paylio-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 335169611d6a292176eedb7bb81f9ae4c8dd69b35fdf711925e302d76c4d0a4c
MD5 41495681928642857031a3cfb81bec3d
BLAKE2b-256 47debd821167272c796d42f274e44bff5696b9e60415c9da94c4f45b7e5c7f44

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