Skip to main content
Test Mode allows you to build and test your Creem integration in a completely isolated environment. All API calls, payments, webhooks, and data are kept separate from your production environment, ensuring you can develop with confidence.
Always develop and test your integration in Test Mode before going live. This prevents accidental charges and allows you to verify your entire payment flow safely.

Activating Test Mode

To switch to the test environment, click the Test Mode toggle on the top navbar of your dashboard.

Using Test Mode in Code

When building your integration, you’ll need to configure your code to use Test Mode. Here’s how to do it across different SDKs:
  • Next.js
  • TypeScript SDK
  • Better Auth
  • REST API
Use the testMode parameter when creating checkouts:
// app/api/checkout/route.ts
import { Checkout } from "@creem_io/nextjs";

export const GET = Checkout({
  apiKey: process.env.CREEM_API_KEY!,
  testMode: true, // Enable test mode
  defaultSuccessUrl: "/success",
});
For production, use an environment variable:
export const GET = Checkout({
  apiKey: process.env.CREEM_API_KEY!,
  testMode: process.env.NODE_ENV !== "production",
  defaultSuccessUrl: "/success",
});

API Endpoints

Creem uses separate API endpoints for test and production environments:
EnvironmentBase URL
Productionhttps://api.creem.io
Test Modehttps://test-api.creem.io
Make sure to use the correct API endpoint for your environment. Using the production endpoint with test mode enabled (or vice versa) will result in errors.

API Keys

Test and production environments use different API keys. You can find both keys in the Developers section. Make sure to toggle Test Mode in the navigation bar.
Store your API keys as environment variables and never commit them to version control.
# .env.local
CREEM_API_KEY=your_test_api_key_here

Testing Payments

Use these test card numbers to simulate different payment scenarios:
All test card numbers work with any future expiration date, any CVV, and any billing information.
Card NumberBehavior
4242 4242 4242 4242Successful payment
4000 0000 0000 0002Card declined
4000 0000 0000 9995Insufficient funds
4000 0000 0000 0127Incorrect CVC
4000 0000 0000 0069Expired card

Webhook Testing

When in Test Mode, webhook events are sent to your test webhook URL. This allows you to:
  1. Test your webhook endpoint locally using tools like ngrok
  2. Verify webhook signature validation
  3. Ensure your event handlers work correctly
If you want a more in-depth explanation about webhooks, check the guide below:

Learn More About Webhooks

Set up webhooks to receive real-time payment notifications.

Switching to Production

When you’re ready to go live:
1

Complete Testing

Verify all payment flows work correctly in Test Mode
2

Update API Keys

Replace test API keys with production API keys in your environment variables
3

Update API Endpoint

Ensure your code uses https://api.creem.io or disable testMode flag
4

Configure Production Webhooks

Register your production webhook URL in the live dashboard
5

Create Production Products

Switch to production mode in the dashboard and create your live products
6

Monitor First Transactions

Watch your first few production transactions carefully to ensure everything works as expected
Never use test API keys or the test API endpoint in production. This will cause all payments to fail.

Next Steps