--- name: creem-api description: Integrate Creem payment infrastructure for checkouts, subscriptions, free products, licenses, and webhooks. Supports one-time payments, recurring billing, free products, and MoR compliance. Use when the user mentions Creem, or asks to add payments, billing, subscriptions, checkout, license keys, or a customer portal to their app. --- # Creem Payment API Skill Creem is a Merchant of Record (MoR) payment platform. Creem is the legal seller, so it owns tax compliance, payment processing, chargebacks, and refunds. ## Core Rules - **Production API**: `https://api.creem.io` - **Test API**: `https://test-api.creem.io` - **Authentication**: `x-api-key: ` header. - **Prices**: Integers in **cents** (`1000` = $10.00). Use `0` for free products. - **Currencies**: Uppercase three-letter ISO codes (`USD`, `EUR`). - **Access is granted by webhook, not by the success redirect.** ## Webhook Signature Verification The signature is sent in the `creem-signature` header as a HMAC-SHA256 hex digest of the raw request body. ```python import hmac import hashlib def verify_creem_signature(payload_bytes: bytes, signature: str, secret: str) -> bool: if not signature or not secret: return False computed = hmac.new(secret.encode("utf-8"), payload_bytes, hashlib.sha256).hexdigest() return hmac.compare_digest(computed.lower(), signature.lower()) ``` ## Creating Checkout Session `POST /v1/checkouts` ```json { "product_id": "prod_...", "request_id": "order_123_pay_456", "customer": { "email": "user@example.com" }, "success_url": "https://example.com/payment/success", "metadata": { "order_id": "123", "payment_id": "456", "user_id": "789" } } ``` Response returns `{ "id": "ch_...", "checkout_url": "https://checkout.creem.io/ch_..." }`.