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.1

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.1
File Size Uploaded
paydeck-1.0.1.tar.gz 6.2 kB Details

Built distribution (wheel)

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

Total release size: 11.9 kB

Release files / paydeck-1.0.1.tar.gz

Download URL paydeck-1.0.1.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
81fc0e986131b39fd5ef1e51af8e8ad0abdcc5e0cf016b552a80fad67c39e966
BLAKE2b-256 checksum
How to use checksums
74f60a5645051577f35724577d538a530083f5bf57bef941c983ae5dacc7491c
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.1-py3-none-any.whl

Download URL paydeck-1.0.1-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5d32c8b1d23f4991fef84f5d9db9d33c23311e76b127c29fe8704b2bb9199b04
BLAKE2b-256 checksum
How to use checksums
024d3e1f39dfb52c72861d9ab3369acbf45c2e726ea91d783927f13963870c5e
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

This release

1.0.1 This release

2 release files

1.0.0

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