Skip to content

Python SDK

Official Autlantic Billing server client for Python. Part of the Autlantic Payments SDK · Languages.

USDC on Base · secrets server-only.

bash
pip install autlantic-billing

PyPI: autlantic-billing · source: sdks/python in payments-sdk

Quick start

python
from autlantic_billing import AutlanticBilling, verify_billing_webhook

billing = AutlanticBilling.from_env()  # AUTLANTIC_BILLING_API_KEY required

link = billing.create_payment_link({
    "amountUsdc": 42,
    "merchantRefPrefix": "invoice",
    "description": "Consulting",
    "successUrl": "myapp://billing/success",
    "cancelUrl": "myapp://billing/cancel",
})
# Share link["url"] or open it with the mobile Checkout SDK

Environment

Env varPurpose
AUTLANTIC_BILLING_API_KEYabk_test_… or abk_live_… (required)
AUTLANTIC_BILLING_API_URLDefault https://billing.autlantic.com
AUTLANTIC_BILLING_MERCHANT_IDOptional merchant id

Hosted mode only (no in-process sandbox). Pins Autlantic-Version: 2026-01-01. Sends Idempotency-Key on POSTs and retries on 429/5xx.

Client methods

MethodDescription
list_products()Catalog products and prices
create_subscription(body)Incomplete subscription + checkoutUrl
get_subscription(id)Fetch subscription
activate_subscription(id)Activate
cancel_subscription(id, body?)Cancel
create_payment(body)One-time payment + checkoutUrl
get_payment(id)Fetch payment
create_payment_link(body)Shareable link + url
list_payment_links()List links
get_payment_link(id)Fetch link
disable_payment_link(id)Disable link
list_invoices(subscription_id?)List invoices

successUrl / cancelUrl are supported on create subscription, payment, and payment link (app deep links).

Webhooks

python
from autlantic_billing import (
    verify_billing_webhook,
    parse_billing_webhook_event,
)

def handle(raw_body: str, signature: str | None, secret: str):
    if not verify_billing_webhook(secret, raw_body, signature):
        raise ValueError("bad signature")
    event = parse_billing_webhook_event(raw_body)
    # Unlock on invoice.paid / payment.paid / subscription.activated

Header: x-autlantic-signature. Same rules as Webhooks.

Errors

AutlanticBillingError exposes message, code, status_code, request_id, and body.

Sample merchant backend: examples/mobile-checkout/python (port 3056).