Skip to main content

PayDeck Python SDK

Official Python SDK for the PayDeck generic billing microservice. Zero third-party runtime dependencies (uses standard library urllib, json, hmac, hashlib).

Installation

pip install paydeck

Quickstart

from paydeck import PayDeckClient, PayDeckAPIError

# Initialize client with product API key
client = PayDeckClient(
    base_url="http://localhost:8787",
    api_key="pd_live_1234567890abcdef...",
    retries=3,
)

# 1. Create an order for a plan or custom amount
order = client.create_order(
    plan="pro",
    idempotency_key="unique_checkout_session_456"
)
print(f"Order Created: {order['order_id']}, PayDeck ID: {order['id']}")

# 2. Verify payment HMAC signature after gateway checkout
verified = client.verify(
    razorpay_order_id=order['order_id'],
    razorpay_payment_id="pay_999888777",
    razorpay_signature="signature_hash..."
)
print(f"Payment Status: {verified['payment']['status']}")

# 3. Create a Customer & Subscription
customer = client.create_customer(email="dev@example.com", name="Jane Developer", external_user_id="usr_42")
subscription = client.create_subscription(customer_id=customer["id"], plan_id="plan_pro_month")

# 4. Verify Downstream Webhook Signatures (Static Method)
is_valid = PayDeckClient.verify_webhook_signature(
    payload=raw_body_bytes_or_str,
    signature=request_headers.get("X-PayDeck-Signature"),
    secret="your_product_webhook_secret"
)

Admin Management

admin_client = PayDeckClient(
    base_url="http://localhost:8787",
    admin_token="admin_secret_token",
)

# Create Product
product = admin_client.create_product(slug="formrelay", name="FormRelay SaaS")

# Mint Product API Key
key = admin_client.mint_key(slug="formrelay", name="Production Worker Key", environment="live")
print(f"New Key: {key['key']}")

Metadata

Release files for paydeck 1.0.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 paydeck 1.0.0
File Size Uploaded
paydeck-1.0.0.tar.gz 6.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for paydeck 1.0.0
File Interpreter ABI Platform
paydeck-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.9 kB

Release files / paydeck-1.0.0.tar.gz

Download URL paydeck-1.0.0.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
404b9f1847d30e617e2cb9c40033f7f10fed4437a830c2949779052c73b775e8
BLAKE2b-256 checksum
How to use checksums
4db48285f6b578a0a80d5b965fcdd8a6975e773df9f5fd04bdc3ddd233959bbc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release files / paydeck-1.0.0-py3-none-any.whl

Download URL paydeck-1.0.0-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
948086c12c98d237c2e89caedb4d4a2eeeefa5d8162a6e656653711555c3b0c0
BLAKE2b-256 checksum
How to use checksums
3e3c008979bf1f117d3be13aedb85640238d8cdba3e072eba57bca3acb57d542
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release history Release notifications | RSS feed

1.0.1

2 release files

This release

1.0.0 This release

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