Metadata-Version: 2.4
Name: creem
Version: 0.1.1
Summary: Python SDK for the Creem.io REST API
Author-email: AJ Gonzalez <aj.gonzalez.dev@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/AJ-Gonzalez/creem-python
Project-URL: Source, https://github.com/AJ-Gonzalez/creem-python
Project-URL: Issues, https://github.com/AJ-Gonzalez/creem-python/issues
Project-URL: Documentation, https://docs.creem.io/api-reference
Keywords: creem,payments,merchant-of-record,subscriptions,sdk
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx>=0.27
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Requires-Dist: mypy>=1.10; extra == "dev"
Requires-Dist: build>=1.2; extra == "dev"
Dynamic: license-file

# 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+.

```bash
pip install creem
```

For development, install from the repo with test tooling:

```bash
pip install -e ".[dev]"
```

## Quickstart

Grab your API key from the [dashboard](https://creem.io/dashboard/developers), then:

```python
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:

```python
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.

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

```python
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.

## API Reference

See the full reference in [API_REFERENCE](API_REFERENCE.md)

## Documentation for Agents

Coming soon: a dedicated guide that explains the SDK for AI agents and automation workflows. Until then, agents should read [API_REFERENCE.md](API_REFERENCE.md) — it covers every endpoint, webhook, and error.
