You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
'Learn how to present full-screen modals from tiles and menu items using the Action API.',
26
27
examples: [
27
28
{
28
29
codeblock: generateCodeBlockForActionApi(
29
-
'Present a modal from post purchase.',
30
+
'Open a modal from a post-purchase action',
30
31
'present-modal',
31
32
),
33
+
description:
34
+
"Create an action menu item that appears after a purchase is completed. When pressed, it launches a full-screen modal view using the Action API's `presentModal()` method, allowing you to display custom workflows or additional functionality in the post-purchase flow.",
32
35
},
33
36
{
34
37
codeblock: generateCodeBlockForActionApi(
35
-
'Present a modal from smart grid.',
38
+
'Open a modal from a smart grid tile',
36
39
'present-modal-tile',
37
40
),
41
+
description:
42
+
"Create a smart grid tile on the POS home screen that launches a full-screen modal when tapped. This example shows how to use the Action API to present detailed views or workflows from your app's home tile, providing quick access to extended functionality.",
'Learn how to manage cart contents, apply discounts, handle customer information, and track cart changes in real time.',
26
27
examples: [
27
28
{
28
29
codeblock: generateCodeBlockForCartApi(
29
-
'Subscribe to cart changes.',
30
-
'subscribable',
30
+
'Add a custom sale item to the cart',
31
+
'add-custom-sale',
31
32
),
33
+
description:
34
+
"Create and add a custom sale item that isn't tied to an existing product in your catalog. This example demonstrates using `addCustomSale()` to add a line item with a custom title, quantity, price, and tax settings—useful for services, custom orders, or special charges.",
32
35
},
33
36
{
34
37
codeblock: generateCodeBlockForCartApi(
35
-
'Apply a cart level discount',
36
-
'apply-cart-discount',
38
+
'Add a new address to the customer',
39
+
'add-address',
37
40
),
41
+
description:
42
+
"Create and add a new address to the customer associated with the cart. This example shows how to use `addAddress()` to add a complete address with street, city, province, name, and country information to the customer's profile for shipping or billing purposes.",
38
43
},
39
44
{
40
45
codeblock: generateCodeBlockForCartApi(
41
-
'Apply a cart level discount code',
42
-
'apply-cart-code-discount',
46
+
'Add a product to the cart',
47
+
'add-line-item',
43
48
),
49
+
description:
50
+
"Add a product to the cart by specifying its variant ID and quantity. This example uses `addLineItem()` to add a product variant with the specified quantity, returning the new line item's UUID for future reference or manipulation.",
44
51
},
45
52
{
46
53
codeblock: generateCodeBlockForCartApi(
47
-
'Remove all the discounts on the cart and line items',
48
-
'remove-all-discounts',
54
+
'Add custom properties to a line item',
55
+
'add-line-item-properties',
49
56
),
57
+
description:
58
+
"Attach custom key-value metadata to a specific line item using its UUID. This example uses `addLineItemProperties()` to add an `'Engraving'` property to a particular line item, useful for storing item-specific customizations, notes, or tracking data.",
50
59
},
51
60
{
52
61
codeblock: generateCodeBlockForCartApi(
53
-
'Set a custom discount on a line item',
54
-
'set-line-item-discount',
62
+
'Add custom properties to multiple line items',
63
+
'bulk-add-line-item-properties',
55
64
),
65
+
description:
66
+
'Attach different custom properties to multiple line items simultaneously in a single operation. This example shows how to use `bulkAddLineItemProperties()` to efficiently add unique engraving text to multiple items at once, reducing API calls and improving performance.',
56
67
},
57
68
{
58
69
codeblock: generateCodeBlockForCartApi(
59
-
'Set a custom discount on multiple line items',
60
-
'bulk-set-line-item-discounts',
70
+
'Add custom properties to the cart',
71
+
'add-cart-properties',
61
72
),
73
+
description:
74
+
"Attach custom key-value metadata to the cart for tracking, integrations, or additional context. This example uses `addCartProperties()` to add an `'Engraving'` property to the cart, which merges with existing properties and overwrites duplicate keys.",
62
75
},
63
76
{
64
77
codeblock: generateCodeBlockForCartApi(
65
-
'Remove a discount on a line item',
66
-
'remove-line-item-discount',
78
+
'Apply a discount code to the cart',
79
+
'apply-cart-code-discount',
67
80
),
81
+
description:
82
+
"Add a discount to the cart using a discount code. This example shows how to apply the discount code `'SUMMER_2024'` using the `addCartCodeDiscount()` method, which validates and applies the code server-side if it's valid and applicable to the current cart.",
68
83
},
69
84
{
70
85
codeblock: generateCodeBlockForCartApi(
71
-
'Clear the entire cart',
72
-
'clear-cart',
86
+
'Apply a discount to a line item',
87
+
'set-line-item-discount',
73
88
),
89
+
description:
90
+
"Add a discount to an individual line item in the cart using its UUID. This example applies a 10% discount titled `'Summer discount'` to a specific line item using the `setLineItemDiscount()` method, allowing you to target discounts at particular products.",
74
91
},
75
92
{
76
93
codeblock: generateCodeBlockForCartApi(
77
-
'Set the customer in the cart',
78
-
'set-customer',
94
+
'Apply a percentage discount to the cart',
95
+
'apply-cart-discount',
79
96
),
97
+
description:
98
+
"Add a cart-level discount that applies to the total cart value. This example demonstrates applying a 10% discount titled `'Summer discount'` to the cart using the `applyCartDiscount()` method with the `Percentage` discount type.",
80
99
},
81
100
{
82
101
codeblock: generateCodeBlockForCartApi(
83
-
'Remove the customer in the cart',
84
-
'remove-customer',
102
+
'Apply different discounts to multiple line items',
103
+
'bulk-set-line-item-discounts',
85
104
),
105
+
description:
106
+
'Add discounts to multiple line items simultaneously using a single operation. This example shows how to use `bulkSetLineItemDiscounts()` to apply different discount types and amounts to multiple items efficiently—one gets a 10% percentage discount while another receives a $15 fixed amount discount.',
86
107
},
87
108
{
88
109
codeblock: generateCodeBlockForCartApi(
89
-
'Add a custom sale to the cart',
90
-
'add-custom-sale',
110
+
'Associate a customer with the cart',
111
+
'set-customer',
91
112
),
113
+
description:
114
+
'Associate a customer with the cart using their ID to enable customer-specific features. This example shows how to use `setCustomer()` to associate a customer, which enables personalized pricing, applicable discounts, loyalty benefits, and streamlines the checkout process.',
92
115
},
93
116
{
94
117
codeblock: generateCodeBlockForCartApi(
95
-
'Add a line item to the cart',
96
-
'add-line-item',
118
+
'Attribute a staff member to a line item',
119
+
'set-attributed-staff-to-line-item',
97
120
),
121
+
description:
122
+
'Assign a staff member to an individual line item for detailed sales tracking. This example demonstrates using `setAttributedStaffToLineItem()` to track which staff member was responsible for selling a specific item, enabling item-level commission tracking and performance analysis.',
98
123
},
99
124
{
100
125
codeblock: generateCodeBlockForCartApi(
101
-
'Remove a line item from the cart',
102
-
'remove-line-item',
126
+
'Attribute a staff member to the cart',
127
+
'set-attributed-staff',
103
128
),
129
+
description:
130
+
'Assign a staff member to the cart for sales tracking and commission purposes. This example uses `setAttributedStaff()` with a staff member ID to track who facilitated or managed the sale, useful for performance metrics and incentive calculations.',
104
131
},
105
132
{
106
133
codeblock: generateCodeBlockForCartApi(
107
-
'Add custom properties to the cart',
108
-
'add-cart-properties',
134
+
'Clear all items from the cart',
135
+
'clear-cart',
109
136
),
137
+
description:
138
+
'Empty the cart completely, removing all line items, discounts, and properties. This example uses `clearCart()` to reset the cart to its initial empty state while preserving the customer association if present, useful for starting a new transaction or canceling a sale.',
110
139
},
111
140
{
112
141
codeblock: generateCodeBlockForCartApi(
113
-
'Remove custom properties from the cart',
114
-
'remove-cart-properties',
142
+
'Delete a customer address',
143
+
'delete-address',
115
144
),
145
+
description:
146
+
"Remove a specific address from the customer's profile using its ID. This example demonstrates using `deleteAddress()` to permanently delete an address from the customer associated with the cart, useful for cleaning up outdated or incorrect addresses.",
116
147
},
117
148
{
118
149
codeblock: generateCodeBlockForCartApi(
119
-
'Add custom properties to a line item',
120
-
'add-line-item-properties',
150
+
'Monitor cart updates in real time',
151
+
'subscribable',
121
152
),
153
+
description:
154
+
'Subscribe to cart state changes to display dynamic information based on cart contents. This example shows how to react to cart updates and display the current number of line items in the cart, automatically updating the tile subtitle whenever the cart changes.',
122
155
},
123
156
{
124
157
codeblock: generateCodeBlockForCartApi(
125
-
'Add custom properties to multiple line items',
126
-
'bulk-add-line-item-properties',
158
+
'Remove a discount from a line item',
159
+
'remove-line-item-discount',
127
160
),
161
+
description:
162
+
"Clear the discount from an individual line item while leaving other cart discounts intact. This example uses `removeLineItemDiscount()` with the line item's UUID to remove only that item's discount without affecting cart-level or other line item discounts.",
128
163
},
129
164
{
130
165
codeblock: generateCodeBlockForCartApi(
131
-
'Remove custom properties from a line item',
132
-
'remove-line-item-properties',
166
+
'Remove a line item from the cart',
167
+
'remove-line-item',
133
168
),
169
+
description:
170
+
'Delete a line item from the cart using its UUID. This example demonstrates using `removeLineItem()` to completely remove a specific item along with any associated discounts or properties, without affecting other cart contents.',
134
171
},
135
172
{
136
173
codeblock: generateCodeBlockForCartApi(
137
-
'Set an attributed staff member on the cart',
138
-
'set-attributed-staff',
174
+
'Remove all discounts from cart and line items',
175
+
'remove-all-discounts',
139
176
),
177
+
description:
178
+
"Clear all discounts applied to both the cart and individual line items in a single operation. This example uses `removeAllDiscounts(true)` to remove all discounts and disable automatic discounts from being reapplied, giving you full control over the cart's discount state.",
140
179
},
141
180
{
142
181
codeblock: generateCodeBlockForCartApi(
143
-
'Set an attributed staff member on a line item',
144
-
'set-attributed-staff-to-line-item',
182
+
'Remove custom properties from a line item',
183
+
'remove-line-item-properties',
145
184
),
185
+
description:
186
+
"Delete specific properties from a line item by its UUID and property keys. This example demonstrates using `removeLineItemProperties()` to remove the `'Engraving'` property from a specific line item while preserving other line item properties and data.",
146
187
},
147
188
{
148
189
codeblock: generateCodeBlockForCartApi(
149
-
'Add an address to the customer in the cart',
150
-
'add-address',
190
+
'Remove custom properties from the cart',
191
+
'remove-cart-properties',
151
192
),
193
+
description:
194
+
"Delete specific cart properties by their keys while leaving other properties intact. This example demonstrates using `removeCartProperties()` to remove the `'Engraving'` property from the cart without affecting other custom properties or cart data.",
152
195
},
153
196
{
154
197
codeblock: generateCodeBlockForCartApi(
155
-
'Delete an address corresponding to an ID',
156
-
'delete-address',
198
+
'Remove the customer from the cart',
199
+
'remove-customer',
157
200
),
201
+
description:
202
+
'Disassociate the customer from the cart and convert it to a guest cart. This example uses `removeCustomer()` to remove customer-specific pricing, discounts, and personalization while preserving all cart contents and line items.',
158
203
},
159
204
{
160
205
codeblock: generateCodeBlockForCartApi(
161
-
'Set the default address of the customer in the cart',
206
+
"Set a customer's default address",
162
207
'update-default-address',
163
208
),
209
+
description:
210
+
"Update which address is marked as the default for the customer in the cart. This example uses `updateDefaultAddress()` with an address ID to set the customer's primary address, which will be automatically selected for future transactions.",
description: 'Examples of using the Connectivity API',
24
+
description:
25
+
'Learn how to monitor internet connectivity status and respond to network changes in your extension.',
25
26
examples: [
26
27
{
27
28
codeblock: generateCodeBlockForConnectivityApi(
28
-
'Subscribe to connectivity changes.',
29
+
'Monitor network connectivity changes',
29
30
'subscribable',
30
31
),
32
+
description:
33
+
'Subscribe to connectivity state changes to respond when the device goes online or offline. This example demonstrates using the connectivity subscription to track network status and display the current connection state, allowing your extension to adapt behavior based on network availability.',
description: 'Examples of using the Customer API.',
23
+
description:
24
+
'Learn how to access customer information and build personalized experiences based on customer context.',
24
25
examples: [
25
26
{
26
27
codeblock: generateCodeBlockForCustomerApi(
27
-
'Retrieve the ID of the customer.',
28
+
'Get the current customer ID',
28
29
'id',
29
30
),
31
+
description:
32
+
"Retrieve the unique identifier of the customer currently associated with the extension's context. This example shows how to access the customer ID from customer details screens, enabling you to fetch additional customer data, track customer-specific actions, or link to external systems.",
'Learn how to access device information and adapt your extension based on hardware characteristics.',
25
26
examples: [
26
27
{
27
28
codeblock: generateCodeBlockForDeviceApi(
28
-
'Retrieve name of the device.',
29
-
'name',
29
+
'Check if the device is a tablet',
30
+
'tablet',
30
31
),
32
+
description:
33
+
'Check whether the extension is running on a tablet form factor. This example uses the `isTablet` property to determine the device type, allowing you to adapt layouts, adjust component sizing, or enable tablet-specific features for larger screen experiences.',
31
34
},
32
35
{
33
36
codeblock: generateCodeBlockForDeviceApi(
34
-
'Retrieve the ID of the device.',
37
+
'Get the device ID',
35
38
'device-id',
36
39
),
40
+
description:
41
+
'Retrieve the unique identifier for the device running your extension. This example accesses the device ID, enabling device-specific tracking, settings synchronization, or associating actions with specific POS terminals for audit trails and analytics.',
37
42
},
38
43
{
39
-
codeblock: generateCodeBlockForDeviceApi(
40
-
'Check if device is a tablet.',
41
-
'tablet',
42
-
),
44
+
codeblock: generateCodeBlockForDeviceApi('Get the device name','name'),
45
+
description:
46
+
"Retrieve the human-readable name of the device running your extension. This example accesses the device's name, which can be useful for debugging, analytics, device-specific customization, or displaying device information to staff members.",
description: 'Examples of using the Draft Order API.',
20
+
description:
21
+
'Learn how to access draft order information and build contextual experiences for draft order workflows.',
21
22
examples: [
22
23
{
23
24
codeblock: generateCodeBlock(
24
-
'Retrieve the ID of the draft order.',
25
+
'Get the current draft order ID',
25
26
'draft-order-api',
26
27
'id',
27
28
),
29
+
description:
30
+
"Retrieve the unique identifier of the draft order currently associated with the extension's context. This example shows how to access the draft order ID from draft order detail screens, enabling you to fetch additional order data, implement custom workflows, or integrate with external systems.",
"Learn how to access locale information and internationalize your extension based on the merchant's language settings.",
25
26
examples: [
26
27
{
27
28
codeblock: generateCodeBlockForLocaleApi(
28
-
'Subscribe to locale changes.',
29
+
'Track locale changes in real time',
29
30
'subscribable',
30
31
),
32
+
description:
33
+
"Subscribe to locale changes to dynamically update your extension's content when the merchant switches languages. This example demonstrates monitoring locale updates and displaying the current locale in IETF format, allowing you to provide properly localized content and adapt to language preferences in real time.",
0 commit comments