Skip to main content

Customer API
APIs

The customer API provides an extension with data about the current customer.

Supporting targets

number
required

The unique identifier for the customer

Was this section helpful?

Examples of using the Customer API.

Was this section helpful?

Retrieve the ID of the customer.

import React from 'react';

import {
Text,
Screen,
ScrollView,
Navigator,
reactExtension,
useApi,
} from '@shopify/ui-extensions-react/point-of-sale';

const Modal = () => {
const api = useApi<'pos.customer-details.action.render'>();
return (
<Navigator>
<Screen name="CustomerApi" title="Customer Api">
<ScrollView>
<Text>{`Customer ID: ${api.customer.id}`}</Text>
</ScrollView>
</Screen>
</Navigator>
);
};

export default reactExtension('pos.customer-details.action.render', () => (
<Modal />
));