POS

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 v5.36.0 or above
    • Point of Sale Android v3.29.0 or above
  • Close is available in the following app version:
    • App Bridge v1.18.0 or above is required
    • Point of Sale iOS v5.50.0 or above
    • Point of Sale Android v5.50.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.

import createApp from '@shopify/app-bridge';
import {Pos} from '@shopify/app-bridge/actions';

const app = createApp({
  apiKey: '12345',
  shopOrigin: shopOrigin,
});

Close an app embedded in Shopify POS

Create a Pos object that can be used to close the embedded app. You might close the embedded app after the user successfully completes an action to return them to the Shopify POS app.

const pos = Pos.create(app);

To close the embedded app, use the Pos object to dispatch the CLOSE action.

pos.dispatch(Pos.Action.CLOSE);

Get POS data

POS data is available in the state and accessible through app.getState(). There are several ways to get the data:

Option 1: get all state

app.getState().then((data) => {
  const {pos} = data;
});

Option 2: get only pos

app.getState('pos').then((pos) => {
});

Option 3: get only pos user

app.getState('pos.user').then((user) => {
});

Option 4: get only pos location

app.getState('pos.location').then((location) => {
});

Option 5: get only pos device

app.getState('pos.device').then((device) => {
});

Payload

POS Payload

Key Type Description
user User User info.
location Location Location info.
device Device 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.