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.
Related APIs
getPlatformOS— returns the current platform OS.getTossAppVersion— returns the Toss app version.isMinVersionSupported— checks whether the current app version meets a minimum.
Related guides
- Guides — Permissions pattern — permission flow used by other namespaces (reference only;
getOperationalEnvironmentdoesn't require a permission). - Recipes — Sandbox vs production branching
External references
@apps-in-toss/web-framework— SDK package. The actual exports are re-exported from@apps-in-toss/web-bridge.- Web standard counterpart: none — execution environment distinction is a mini-app platform concept.