Skip to main content

Use cases

Sandbox → production rollout (sk_test_* to sk_live_*)

Controlled switch of API keys and business data

Scell.io exposes two isolated environments on the same `api.scell.io` domain. The API key prefix determines which database is used: `sk_test_*` / `pk_test_*` → sandbox DB (`pgsql_sandbox`), `sk_live_*` / `pk_live_*` → production DB (`pgsql`). No call is billed in sandbox, and sandbox invoices are intentionally not fiscally sealed. Rollout workflow: (1) test full integration in sandbox, (2) generate the live key from the dashboard, (3) deploy the new key via secret manager (never in code), (4) run a smoke test on 1 live invoice, (5) progressive traffic switch. Sandbox and production webhooks use different secrets.

Key facts

  • Same `api.scell.io` domain, routing via key prefix
  • `sk_test_*` → sandbox DB, `sk_live_*` → production DB
  • Sandbox: non-fiscally-sealed invoices, fictitious balance, no Scell.io billing
  • Production: fiscal sealing active, real balance, Scell.io billing
  • Independent sandbox and production webhooks
  • Key migration via secret manager (Vault, AWS Secrets Manager)

Code example

// lib/scell.ts — un seul client, clé injectée par environnement
import { ScellClient } from '@scell/sdk';

const apiKey = process.env.SCELL_SECRET_KEY!;
if (!/^sk_(test|live)_/.test(apiKey)) {
  throw new Error('Invalid SCELL_SECRET_KEY format');
}

const environment = apiKey.startsWith('sk_live_') ? 'production' : 'sandbox';
console.log(`[scell] running in ${environment} mode`);

export const scell = new ScellClient({ apiKey });

// Smoke test post-deploy live (CI)
if (environment === 'production' && process.env.RUN_SMOKE === '1') {
  const ping = await scell.health.check();
  if (!ping.ok) throw new Error('Smoke test failed');
}

See also

Your cookie preferences

We use cookies to improve your experience. Essential cookies are always active. Cookie policy.