Skip to main content

Customer API

The Customer API provides read-only access to customer data. Use this API to get customer information and build personalized experiences based on the selected customer context. The API offers the customer identifier for linking to customer data and enabling customer-specific features.

Use cases

  • Customer access: Access the customer identifier to implement customer-specific functionality.
  • Customer extensions: Build extensions displaying customer information or loyalty program details.
  • Contextual UI: Create contextual interfaces adapting based on current customer context.
  • External integrations: Link customer data with external CRM (Customer Relationship Management) platforms or third-party integrations.

The CustomerApi object provides access to customer data. Access this property through api.customer to interact with the current customer context.

number
required

The unique identifier for the customer. Use for customer lookups, applying customer-specific pricing, enabling personalized features, and integrating with external systems.

Examples
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 />
));

  • Implement customer-specific features: Use the customer context to enable personalized functionality like customer-specific pricing, loyalty program integration, or customized product recommendations.
  • Validate customer access: Verify that the customer ID is valid before performing customer-specific operations or external API calls.

  • The API provides only the customer identifier—use Shopify APIs or external systems to fetch additional customer details like name, email, or purchase history.
  • Customer data reflects the current POS session and may not include real-time updates from other channels until the session is refreshed.
Was this page helpful?