Environments
Two isolated environments: Live (real data, real payments) and Test (sandbox, no charges).
Environment is determined by key prefix
import { createCimplifyClient } from "@cimplify/sdk";
// Test mode - sandbox data, no real charges
const testClient = createCimplifyClient({ publicKey: "pk_test_abc123" });
console.log(testClient.isTestMode()); // true
// Live mode - real data, real payments
const liveClient = createCimplifyClient({ publicKey: "pk_live_def456" });
console.log(liveClient.isTestMode()); // falseComparison
| Feature | Live | Test |
|---|---|---|
| Key prefix | pk_live_ / sk_live_ | pk_test_ / sk_test_ |
| Payments | Real charges processed | No charges, simulated |
| Data | Real business data | Sandbox copy of catalogue |
| Notifications | Sent to real customers | Suppressed |
| Inventory | Affects real stock | Isolated sandbox stock |
Sandbox business
Enabling developer access creates a sandbox business with a copy of your catalogue. It appears in the dashboard business switcher and is fully isolated from live data.
When to use each environment
| Context | Environment | Key |
|---|---|---|
| Local development | Test | pk_test_ |
| Staging / QA | Test | pk_test_ |
| CI / Integration tests | Test | sk_test_ |
| Production | Live | pk_live_ |
Switching environments
.env
# Development
NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY=pk_test_abc123
# Production
NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY=pk_live_def456The SDK reads NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY automatically. No code changes needed to switch environments.
Environment detection
TYPESCRIPT
function getEnvironment(apiKey: string): "live" | "test" {
if (apiKey.startsWith("sk_live_") || apiKey.startsWith("pk_live_")) {
return "live";
}
return "test";
}
// In webhook handlers, the event payload also includes environment
app.post("/webhooks", (req, res) => {
if (req.body.environment === "test") {
console.log("Test event - skipping production logic");
return res.sendStatus(200);
}
processLiveEvent(req.body);
});