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 (models import from the top level: from creem import Checkout, Subscription, ...). 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. Release history: CHANGELOG.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.4.0.tar.gz (46.9 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.4.0-py3-none-any.whl (38.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for creem-0.4.0.tar.gz
Algorithm Hash digest
SHA256 4f3c9169a664db988e022ad664ba440e99feab960f9e6d51367705bb43d29429
MD5 3462f2c5171cd5997a46542a710465d4
BLAKE2b-256 89c832a738c06c115deb5756f8151ab313309aebd5f69bc6bdcc6f514768bf20

See more details on using hashes here.

Provenance

The following attestation bundles were made for creem-0.4.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.4.0-py3-none-any.whl.

File metadata

  • Download URL: creem-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 38.5 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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8e17f6ba5a1bc7d12b03c9e629b5d8ce9ebd86c5faa65a3d16892a4691217418
MD5 1289b3d7d14f7ccbf0182051d76a52af
BLAKE2b-256 b6119156ca9f7c4a5d50afce00b2225b73c91abaca8eb51a85960db7702437a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for creem-0.4.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