--- title: POS description: Learn more about the POS actions in App Bridge. api_name: app-bridge source_url: html: https://shopify.dev/docs/api/app-bridge/previous-versions/actions/pos md: https://shopify.dev/docs/api/app-bridge/previous-versions/actions/pos.md --- # POS **Note:** This is a legacy API. Use the latest version of [`POS`](https://shopify.dev/docs/api/app-home/apis/pos) instead. Provides a mechanism for closing the app when it's running in Shopify POS, and for retrieving information about a Shopify POS device. *** ## Requirements * User and location data are available in all version of Point of Sale Android and iOS. * Device data is available in following app version: * **Point of Sale iOS version 5.36.0** or above * **Point of Sale Android version 3.29.0** or above * Close is available in the following app version: * **App Bridge version 1.18.0** or above is required * **Point of Sale iOS version 5.50.0** or above * **Point of Sale Android version 3.43.0** or above *** ## Setup Create an app and import the `Pos` module from `@shopify/app-bridge/actions`. Note that we'll be referring to this sample application throughout the examples below. **Note:** In the following example, `config` is a valid App Bridge configuration object. Learn more about [configuring App Bridge](https://shopify.dev/docs/api/app-bridge/previous-versions/app-bridge-from-npm/app-setup#initialize-shopify-app-bridge-in-your-app). ```js import createApp from '@shopify/app-bridge'; import {Pos} from '@shopify/app-bridge/actions'; const app = createApp(config); ``` *** ## Close an app in Shopify POS Create a Pos object that can be used to close the app. You might close the app after the user successfully completes an action to return them to the Shopify POS app. ```js const pos = Pos.create(app); ``` To close the app, use the Pos object to dispatch the `CLOSE` action. ```js // App Bridge 1.x pos.dispatch(Pos.ActionType.CLOSE); // App Bridge 2.x pos.dispatch(Pos.Action.CLOSE); ``` *** ## Get POS data POS data is available in the state and accessible through [app.getState()](https://shopify.dev/docs/api/app-bridge/previous-versions/methods#app-getstate). There are several ways to get the data: **Option 1: get all state** ```js app.getState().then((data) => { const {pos} = data; }); ``` **Option 2: get only pos** ```js app.getState('pos').then((pos) => { }); ``` **Option 3: get only pos user** ```js app.getState('pos.user').then((user) => { }); ``` **Option 4: get only pos location** ```js app.getState('pos.location').then((location) => { }); ``` **Option 5: get only pos device** ```js app.getState('pos.device').then((device) => { }); ``` **Note:** app.getState() just returns current state. To avoid getting state before it is ready, you may need to subscribe as below: ```js const unsubscribe = app.subscribe(function() { app.getState('pos').then(function(pos) { if (!pos) { return; } unsubscribe(); }); }); ``` *** ## Payload ### POS Payload | Key | Type | Description | | - | - | - | | `user` | [User](#user-payload) | User info. | | `location` | [Location](#location-payload) | Location info. | | `device` | [Device](#device-payload) | Device info. | ### User Payload | Key | Type | Description | | - | - | - | | `id` | Number | The ID of login user. | | `firstName` | String | The first name of login user. | | `lastName` | String | The last name of login user. | | `email` | String | The email name of login user. | | `accountOwner` | Boolean | Indicate if login user is the shop owner. | | `userType` | String | The type of login user. | ### Location Payload | Key | Type | Description | | - | - | - | | `id` | Number | The ID of current location. | | `active` | Boolean | The status of current location. | | `name` | String | The name of current location. | | `locationType` | String? | The type of current location. | | `address1` | String? | The primary address of current location. | | `address2` | String? | Any extra information associated with the address (Apartment #, Suite #, Unit #, etc.). | | `zip` | String? | The ZIP or postal code of the address. | | `city` | String? | The name of the city. | | `province` | String? | The province or state of the address. | | `countryCode` | String? | The Country Code in ISO 3166-1 (alpha-2) format. | | `countryName` | String? | The country of the address. | | `phone` | String? | The phone number of the location. | ### Device Payload | Key | Type | Description | | - | - | - | | `name` | String | The name of the device | | `serialNumber` | String | The unique ID associated device ID and app ID. | ***