environment
A collection of functions for querying the runtime environment of a mini-app: device identifier, network status, platform OS, app version, locale, and more. Most functions are synchronous; only getNetworkStatus and getServerTime return a Promise.
Methods
| Method | Return type | Purpose |
|---|---|---|
env.getDeploymentId | string | Member of the env namespace. Returns the current deployment ID. |
getAppsInTossGlobals | AppsInTossGlobals | Returns deployment ID, brand name, icon, and primary color. |
getDeviceId | string | Returns the device's unique identifier. |
getGroupId | string | Returns the group ID assigned by Apps in Toss. |
getLocale | string | Returns the user's locale. Defaults to 'ko-KR'. |
getNetworkStatus | Promise<NetworkStatus> | Asynchronously returns the current network connection state. |
getOperationalEnvironment | 'toss' | 'sandbox' | Returns the current execution environment (toss or sandbox). |
getPlatformOS | 'ios' | 'android' | Returns the current platform OS. |
getSafeAreaInsets | number | Deprecated. Returns the safe area inset value. |
getSchemeUri | string | Returns the scheme URI used at initial entry. |
getServerTime | Promise<number | undefined> | Asynchronously returns the server-side Unix timestamp (ms). |
getTossAppVersion | string | Returns the Toss app version string. |
isMinVersionSupported | boolean | Checks whether the current app version meets the specified minimum. |
Permission
No permission required. None of the functions in the environment namespace are bound to a PermissionName, and none expose getPermission() / openPermissionDialog() helpers — for the typical permission flow used by other namespaces, see Guides — Permissions pattern.
Sync vs async
| Function | Sync / Async |
|---|---|
env.getDeploymentId | Sync |
getAppsInTossGlobals | Sync |
getDeviceId | Sync |
getGroupId | Sync |
getLocale | Sync |
getNetworkStatus | Async (Promise) |
getOperationalEnvironment | Sync |
getPlatformOS | Sync |
getSafeAreaInsets | Sync (Deprecated) |
getSchemeUri | Sync |
getServerTime | Async (Promise) |
getTossAppVersion | Sync |
isMinVersionSupported | Sync |
UX guidance
- Use
isMinVersionSupportedfor version gating. If a feature only works on newer app versions, check first withisMinVersionSupportedand prompt the user to update if not met. - Use
getServerTimefor reward and expiry logic. Device time can be manipulated by users — always usegetServerTimefor deadline and reward eligibility decisions. - Don't use
getSafeAreaInsets. This function is deprecated — migrate toSafeAreaInsets.get(). - Don't use
getDeviceIdas a security key. Device IDs can change after a factory reset or OS upgrade. Use a server-side user ID for anything security-sensitive.
Try it live
Try all methods on the Environment page in sdk-example.
Open in sdk-exampleExternal references
@apps-in-toss/web-framework— SDK package. The actual exports are re-exported from@apps-in-toss/web-bridge.