Customer APIAPIs
APIs
The customer API provides an extension with data about the current customer.
Supporting targets
Anchor to customerapiCustomerApi
number
required
The unique identifier for the customer
Was this section helpful?
Anchor to examplesExamples
Examples of using the Customer API.
Anchor to example-retrieve-the-id-of-the-customer.Retrieve the ID of the customer.
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 />
));