Creem Integration
Complete guide to set up and configure Creem payments in NEXTDEVKIT
🚀 Creem Setup
Creem is a developer-focused payment platform that provides simple and straightforward APIs for handling payments and subscriptions.
1. Create Creem Account
- Create a Creem account at creem.io
2. Get API Keys
- Go to Developers → API Keys
- Copy your API Key (starts with
ck_test_
for test mode) - Create a new webhook with the following URL:
https://your-domain.com/api/webhooks/creem
- Copy your Webhook Secret for webhook verification
Add to your .env
file:
CREEM_API_KEY="ck_test_your_api_key"
CREEM_WEBHOOK_SECRET="your_webhook_secret"
3. Create Products
Pro Subscription Product
- Go to Products → Add product
- Name: "Pro Plan"
- Type: "Subscription"
- Add Monthly product:
- Price: your monthly price
- Billing interval: Monthly
- Copy the Product ID
- Add Yearly product:
- Price: your yearly price
- Billing interval: Yearly
- Copy the Product ID
Lifetime Product
- Go to Products → Add product
- Name: "Lifetime Plan"
- Type: "Single payment"
- Price: your lifetime price
- Copy the Product ID
5. Configure Environment Variables
# Creem Configuration
CREEM_API_KEY="ck_test_your_api_key"
CREEM_WEBHOOK_SECRET="your_webhook_secret"
# Product IDs (in Creem, these are product IDs, not price IDs)
NEXT_PUBLIC_PRICE_ID_PRO_MONTHLY="prod_your_monthly_product_id"
NEXT_PUBLIC_PRICE_ID_PRO_YEARLY="prod_your_yearly_product_id"
NEXT_PUBLIC_PRICE_ID_LIFETIME="prod_your_lifetime_product_id"
6. Update Payment Provider Configuration
In src/config/index.ts
, set the provider to Creem:
payment: {
provider: "creem",
currency: "USD",
// ... rest of your configuration
plans: {
pro: {
prices: [
{
amount: 9.99, // your monthly price
interval: PlanInterval.MONTH,
trialPeriodDays: 7, // your trial period days
},
{
amount: 99, // your yearly price
interval: PlanInterval.YEAR,
trialPeriodDays: 30, // your trial period days
},
],
},
},
}
🧪 Testing with Creem
Test Mode
Creem automatically provides a test environment when toggle the test mode in the dashboard:
- All transactions are simulated
- No real money is processed
- Full webhook functionality available
Test Credit Cards
Use these test cards with Creem:
Card Number | Description |
---|---|
4242 4242 4242 4242 | Successful payment |
Local Development
For local webhook testing, you can use ngrok:
# Install ngrok
npm install -g ngrok
# Create tunnel to your local server
ngrok http 3000
# Use the ngrok URL in your Creem webhook configuration
# Example: https://abc123.ngrok.io/api/webhooks/creem
🔧 Creem Features
Simple API Design
Creem focuses on developer experience with:
- Clean REST APIs: Intuitive endpoint structure
- Comprehensive docs: Clear documentation with examples
- Fast setup: Get started in minutes, not hours
- Webhook reliability: Built-in retry mechanisms
Customer Portal
Creem provides a customer portal where customers can:
- View purchase history
- Manage subscriptions
- Update payment methods
- Download receipts
Key Advantages
- Lower fees: Competitive transaction rates
- Global coverage: Accept payments worldwide
- Modern interface: Clean, intuitive dashboard
- Developer-first: Built by developers, for developers
🔄 Webhook Events
Creem sends these webhook events to your application:
Checkout Events
checkout.completed
: One-time payment completed successfully
Subscription Events
subscription.active
: Subscription is active and billingsubscription.trialing
: Subscription is in trial periodsubscription.canceled
: Subscription was canceledsubscription.expired
: Subscription expired due to failed payments
📊 Creem Dashboard
The Creem Dashboard provides:
- Transaction overview: Real-time payment tracking
- Customer management: Customer profiles and history
- Product catalog: Manage your products and pricing
- Analytics: Revenue and conversion metrics
- Webhook monitoring: Track webhook delivery status
🔗 Creem Resources
🎯 Next Steps
Now that Creem is configured: