commerceforai (Python)
Products, inventory, Stripe checkout, orders, shipping, returns, subscriptions and gift cards, on the merchant's own Stripe account. No dependencies.
pip install commerceforai
from commerceforai import Commerce, CommerceError, create_test_store
store = create_test_store("My shop") # a free test store, no sign-up; keep store["api_key"]
commerce = Commerce(store["api_key"]) # or Commerce() with COMMERCEFORAI_API_KEY set
product = commerce.products.create(name="Trail Tee", price=3600, inventory=25)
variant = product["variants"][0]["id"]
checkout = commerce.checkouts.create(items=[{"variant_id": variant, "quantity": 1}], success_url="https://example.com/thanks")
print(checkout["url"]) # send the customer here
# Test stores can run the whole purchase without a browser:
order = commerce.store.simulate_order(items=[{"variant_id": variant, "quantity": 1}])["order"]
commerce.orders.fulfill(order["id"], carrier="USPS", tracking_number="9400100000000000000000")
try:
commerce.orders.refund(order["id"], amount=500)
except CommerceError as e:
print(e.type, e.message) # e.g. permission_error when the key has a refund cap
Responses are plain dicts and lists. Money is an integer in cents. Errors raise CommerceError with type, message and extra fields such as param or available.
Resources: products, variants, inventory, checkouts, orders, returns, collections, discounts, customers, draft_orders, gift_cards, subscriptions, store, events, webhooks, reports. Anything else: commerce.request("GET", "/v1/...") (OpenAPI).
Webhooks (Flask example):
from commerceforai import verify_webhook
event = verify_webhook(request.get_data(), request.headers, os.environ["COMMERCEFORAI_WEBHOOK_SECRET"])
if event["type"] == "order.paid": ...
Docs: https://commerceforai.com/docs · Agent guide: https://commerceforai.com/llms.txt · MIT licensed.
Metadata
Release files for commerceforai 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| commerceforai-0.1.1.tar.gz | 7.2 kB | Without provenance | Details for commerceforai-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| commerceforai-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for commerceforai-0.1.1-py3-none-any.whl |
Total release size: 14.5 kB
Release files / commerceforai-0.1.1.tar.gz
| Download URL | commerceforai-0.1.1.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1b165b8cb5f730dab790eb6a94301b1ac3e7867996f13b16ac749375b1d64280
|
|
BLAKE2b-256 checksum How to use checksums |
bb8fd28c959586aace9b23ff01a451633808716048b805e8edb8fd4ee35f7442
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / commerceforai-0.1.1-py3-none-any.whl
| Download URL | commerceforai-0.1.1-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d91738b2a869759c8ac4b8f11967a153dd778a43e91a9e05c1dffa8190129b2a
|
|
BLAKE2b-256 checksum How to use checksums |
366bb163118b4158ba6add638e8979cad77d204de319a564a77b3c3c3d9c1f44
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for commerceforai 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.