Corporate merch in other countries:AMArmeniaGEGeorgiaTRTürkiyeRSSerbiaAEUAECYCyprusPTPortugalPLPolandESSpain

Python SDK for Italy

corp-merch (PyPI) — sync and async clients, Python 3.10+, full type hints, Pydantic v2 models, FastAPI-friendly.

Install & init

pip install corp-merch. Sync: from corp_merch import CorpMerch; cm = CorpMerch(api_key=os.environ['CM_KEY'], country='Italy'). Async: from corp_merch import AsyncCorpMerch; same signature. Country auto-applies IVA 22% via SdI routed through the Milano hub.

Quickstart — submit an order

order = cm.orders.create(idempotency_key=str(uuid4()), buyer={'vat_id': 'EU…'}, lines=[{'sku': 'TSH-001', 'qty': 200}], promised_date=date(2026,7,1)). Returns a Pydantic Order model with full typing. Errors raised as ValidationError, RateLimitError etc. Async equivalent: await acm.orders.acreate(…).

Webhook verification (FastAPI)

@app.post('/wh') async def wh(req: Request): event = cm.webhooks.construct_event(await req.body(), req.headers['x-corp-signature'], os.environ['CM_WEBHOOK_SECRET']); … . Raises SignatureVerificationError on bad signature; FastAPI converts to 400 via exception handler we register on the app.

FAQ

Does it work with Django/Flask?

Yes — framework-agnostic. We ship middleware for Django (corp_merch.django) and Flask (corp_merch.flask) for webhook routes.

Sync and async both supported?

Yes — separate clients (CorpMerch / AsyncCorpMerch) share the same model types. Use httpx underneath; bring your own event loop.

How do I paginate catalog?

for item in cm.catalog.list(country='Italy'): … iterates all pages internally (cursor pagination handled). Async: async for item in acm.catalog.alist(country='Italy'): …

Type hints / mypy?

Full coverage. ./py.typed marker shipped. Tested against mypy --strict and pyright. Pydantic v2 models for all responses.

Source code?

MIT-licensed on GitHub: github.com/corp-merch/sdk-python. Issue tracker for bugs / RFCs.

Talk to a specialist