Two worlds that never touch
You need to test purchases, events, and entitlements without polluting the dashboards you make decisions from. Crossdeck keeps sandbox and production fully isolated — separate data, separate money, separate numbers — and, importantly, makes you choose the world explicitly, so you can't fat-finger your way into mixing them.
Three values name the destination
Every init() takes three values that together identify exactly where data goes: the appId (which app), the publishableKey (which env inside that app — a cd_pub_ key), and the environment:
Crossdeck.init({
appId: "app_…",
publishableKey: "cd_pub_…",
environment: "production", // or "sandbox" — explicit, never inferred
});
Validated, explicit, isolated
The SDK validates every init() in order: the public key must start with cd_pub_ (catching a secret key or a typo with an invalid_public_key error), and the appId must be present (catching the classic "I copied the key but forgot the appId" with missing_app_id). The environment is asked for as a third, explicit value rather than inferred — on purpose — because guessing it is precisely how a test charge ends up in production.
Data is isolated per environment: sandbox events and money never appear in your production reports, and a dashboard env switcher lets you flip which world you're viewing. There's also a localhost auto-shutoff, so your dev machine doesn't silently emit into production while you're working.
Clean numbers you can trust
With the environment named explicitly, your production dashboards show only real customers and real money, your sandbox holds everything you test, and the two never bleed together. The numbers you make decisions from stay honest.
Test purchases land in sandbox; production stays clean. The env switcher flips your view; localhost can't leak into prod.