Skip to main content

Order API
APIs

number
required

The unique identifier for the order

string
required

The name of the order

number

The unique identifier of the customer associated with the order

Was this section helpful?

Examples of using the Order API

Anchor to example-basic-usage-of-the-order-api-in-an-actionBasic usage of the Order API in an action
Was this section helpful?

Basic usage of the Order API in an action

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

const PostPurchaseAction = () => {
const api = useApi<'pos.purchase.post.action.render'>();
const order = api.order;

return (
<Navigator>
<Screen name="PostPurchaseAction" title="Post Purchase Action">
<ScrollView>
<Section title="Order Information">
<Text>Order ID: {order.id}</Text>
<Text>Order Name: {order.name}</Text>
{order.customerId && <Text>Order Customer ID: {order.customerId}</Text>}
</Section>
</ScrollView>
</Screen>
</Navigator>
);
};

export default reactExtension('pos.purchase.post.action.render', () => (
<PostPurchaseAction />
));