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.
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 |
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file creem-0.2.1.tar.gz.
File metadata
- Download URL: creem-0.2.1.tar.gz
- Upload date:
- Size: 38.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5292fc83ede1355536cdee687ee33b8e47aaf187360f8e8ae659f3167cffa4c8
|
|
| MD5 |
6e72c1fea4e925f10eaf26dda42ba6a5
|
|
| BLAKE2b-256 |
56747fc394f322734024f8e2109bfaded5cd3ca77c695e7ebca0945fafd15430
|
Provenance
The following attestation bundles were made for creem-0.2.1.tar.gz:
Publisher:
publish.yml on AJ-Gonzalez/creem-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
creem-0.2.1.tar.gz -
Subject digest:
5292fc83ede1355536cdee687ee33b8e47aaf187360f8e8ae659f3167cffa4c8 - Sigstore transparency entry: 2385253753
- Sigstore integration time:
-
Permalink:
AJ-Gonzalez/creem-python@cdabf7e265c3b2a8f92dd0c23b48b97c7a396061 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AJ-Gonzalez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cdabf7e265c3b2a8f92dd0c23b48b97c7a396061 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file creem-0.2.1-py3-none-any.whl.
File metadata
- Download URL: creem-0.2.1-py3-none-any.whl
- Upload date:
- Size: 33.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84ef034f381a269e453293528cd08fc25fcd7a34ccb2cedff00343ab7acfcef5
|
|
| MD5 |
dbba02a7c7f956d4882aa99250f0cc47
|
|
| BLAKE2b-256 |
6a6354b7fa7209920268a9376b413dc4a8a71689230290d8982363308372bf08
|
Provenance
The following attestation bundles were made for creem-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on AJ-Gonzalez/creem-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
creem-0.2.1-py3-none-any.whl -
Subject digest:
84ef034f381a269e453293528cd08fc25fcd7a34ccb2cedff00343ab7acfcef5 - Sigstore transparency entry: 2385254066
- Sigstore integration time:
-
Permalink:
AJ-Gonzalez/creem-python@cdabf7e265c3b2a8f92dd0c23b48b97c7a396061 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AJ-Gonzalez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cdabf7e265c3b2a8f92dd0c23b48b97c7a396061 -
Trigger Event:
workflow_dispatch
-
Statement type: