Skip to main content

getOperationalEnvironment

Synchronously returns the operational environment in which the mini-app is running. Returns 'toss' when running inside the Toss app, and 'sandbox' in a sandbox environment. Use it to gate features or enable debugging tools based on the execution context.

Signature

import { getOperationalEnvironment } from '@apps-in-toss/web-framework';

declare function getOperationalEnvironment(): 'toss' | 'sandbox';

Parameters

None.

Returns

  • 'toss' — running inside the Toss app (production or QA build).
  • 'sandbox' — running in a sandbox environment.

Permission

No permission required — getOperationalEnvironment is not bound to a PermissionName. For the typical permission flow used by other namespaces, see Guides — Permissions pattern.

Examples

Minimal

import { getOperationalEnvironment } from '@apps-in-toss/web-framework';

const env = getOperationalEnvironment();
console.log('Operational environment:', env); // 'toss' or 'sandbox'

Realistic — show debug banner in sandbox

import { getOperationalEnvironment } from '@apps-in-toss/web-framework';

function DebugBanner() {
const env = getOperationalEnvironment();

if (env !== 'sandbox') return null;

return (
<div style={{ background: '#ff6b6b', color: '#fff', padding: '4px 12px', fontSize: 12 }}>
Sandbox environment — changes do not affect real data
</div>
);
}

Try it live

Open the Environment page in sdk-example and run the getOperationalEnvironment card to inspect the result.

Open in sdk-example

External references