Skip to main content

Unofficial Creem.io Python SDK

A comfy python wrapper around the Creem REST API.

Will hopefully be official at some point.

Installing

Requires Python 3.11+.

pip install creem

For development, install from the repo with test tooling:

pip install -e ".[dev]"

Quickstart

Grab your API key from the dashboard, then:

from creem import Creem

creem = Creem()  # reads CREEM_API_KEY from the environment

Test keys (creem_test_...) automatically target the sandbox at test-api.creem.io — no config needed. Live keys (creem_...) hit production. Async backends use AsyncCreem — same API, everything awaited (await creem.checkouts.create(...)).

Sell something. Create a checkout session and send your customer to the hosted payment page:

checkout = creem.checkouts.create({
    "product_id": "prod_abc123",
    "success_url": "https://yourapp.com/success",
    "metadata": {"userId": "user_123"},  # flows through to webhooks
})

print(checkout["checkout_url"])  # redirect the customer here

Know when it's paid. Handle the checkout.completed (one-time) and subscription.paid (recurring) webhooks to grant access — the payloads carry your metadata back. Signatures are verified for you:

from creem import WebhookHandler

handler = WebhookHandler(secret="your webhook secret")
handler.on("subscription.paid", grant_access)
handler.on("subscription.canceled", revoke_access)

# FastAPI: handler.handle(await request.body(), request.headers.get("creem-signature"))
# Async callbacks: await handler.ahandle(...)

Keep customers happy. Cancel at period end, not instantly:

creem.subscriptions.cancel("sub_abc123", {"mode": "scheduled"})

Every response is a typed dict with full field hints. When the API complains, you get a CreemAPIError carrying the trace_id — include it when contacting support.

Retries are automatic: rate limits (429), server errors, and network failures are retried up to 3 times with exponential backoff and jitter — when it's safe to do so (GETs and requests carrying request_id, idempotency_key, or an Idempotency-Key header). Pass max_retries=0 to Creem(...) to disable.

Examples

Runnable scripts live in examples/ — set CREEM_API_KEY (test keys target the sandbox) and run them directly:

Example What it shows
checkout_flow.py Create a product, create a checkout, print the payment URL
subscription_management.py Search, scheduled cancel, pause, resume
webhook_server.py FastAPI endpoint with signature verification and grant/revoke dispatch
customer_credits.py Wallet: create account, credit, balance
browse_and_paginate.py Pagination iterators over products and transactions
async_checkout_flow.py The same flow with AsyncCreem — for async backends
CREEM_API_KEY=creem_test_... python examples/checkout_flow.py

API Reference

See the full reference in API_REFERENCE

Documentation for Agents

AI agents integrating or extending this SDK should read docs/for-agents.md — it covers the mental model, conventions, integration flows, and gotchas. For the complete API contract, see API_REFERENCE.md.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

creem-0.3.0.tar.gz (45.4 kB view details)

Uploaded Source

Built Distribution

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

creem-0.3.0-py3-none-any.whl (38.2 kB view details)

Uploaded Python 3

File details

Details for the file creem-0.3.0.tar.gz.

File metadata

  • Download URL: creem-0.3.0.tar.gz
  • Upload date:
  • Size: 45.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for creem-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b5467a67da08fb7e656693f18ffd17c4b33b5acdf5b7d10b897936e473938d92
MD5 51070a55ff75592fa674b0594e37e5e4
BLAKE2b-256 b90ab98586d9f404cd6791be347098de76927753b644f9c79534e491fd94825b

See more details on using hashes here.

Provenance

The following attestation bundles were made for creem-0.3.0.tar.gz:

Publisher: publish.yml on AJ-Gonzalez/creem-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file creem-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: creem-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 38.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for creem-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 34c9b3b9c5d198ef91debb31c4173a02a28938e205fd1f447e75bac10bfbd7d2
MD5 338989b6f5a2ea432910e531f76149f7
BLAKE2b-256 65658a40753cea6f0be23550ddbbdaeea0602893e5b4a2b37dd1de91eb941255

See more details on using hashes here.

Provenance

The following attestation bundles were made for creem-0.3.0-py3-none-any.whl:

Publisher: publish.yml on AJ-Gonzalez/creem-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page