Crossdeck University
Watch — test money that never touches your real numbers Film in production
0:00 / 0:00
Reference · Lesson 3 of 4

Sandbox vs production

Test data and real data live in separate worlds. The SDK asks you to name the world explicitly — never guessing — so a test purchase can never quietly land in your production numbers.

3 min Web

When you're done: you keep test traffic and real traffic cleanly, provably isolated.

1 What this is & why it matters

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.

2 How to set it

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
});
3 How it works, piece by piece

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.

4 The result

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.

app.cross-deck.com · environment
sandbox · isolated

Test purchases land in sandbox; production stays clean. The env switcher flips your view; localhost can't leak into prod.

init() takes appId + publishableKey (cd_pub_) + an explicit environment — never inferred, because guessing is how test money leaks into prod. The SDK validates both keys on init; data is isolated per environment; an env switcher flips your view and a localhost auto-shutoff stops dev traffic reaching production.