Payment
Creem
Creem
This repo includes a Creem one-time payment integration aligned with the PayPal/Stripe flow. Use the steps below to configure credentials, create the product, and validate locally/production.
1) Environment variables
Add the following to .env and keep .env.example / .env.local.example in sync:
CREEM_API_KEY=your_api_key_here
CREEM_WEBHOOK_SECRET=your_webhook_secret_here
CREEM_MODE=test
CREEM_PRODUCT_LIFETIME_ID=your_creem_product_idCREEM_MODE supports test or production (default is production).
References:
2) Create the product in Creem
Create a one-time product (maps to the lifetime tier) and set its product_id as CREEM_PRODUCT_LIFETIME_ID.
3) Checkout and return
- The client calls
POST /api/orders/createwithprovider: "creem". - The server creates an order and calls
POST /v1/checkoutsto get thecheckout_url. - After payment, Creem redirects back to:
/dashboard/billing?provider=creem&request_id={orderId}.
4) Webhook setup
Webhook endpoint:
https://{your-domain.com}/api/webhooks/creemSignature validation: header creem-signature, HMAC-SHA256 with CREEM_WEBHOOK_SECRET over the raw body, compare hex.
Reference:
Recommended events:
checkout.completed
subscription.paid
subscription.update
subscription.trialing
subscription.active
subscription.paused
subscription.canceled
subscription.expired
refund.created
dispute.created5) Local validation
- Set
CREEM_MODE=testand a test API key. - Run
pnpm dev. - Complete a test payment and confirm webhook delivery.
- Check
/dashboard/billingfor order/payment updates.