Skip to main content

Intercept API

Feature preview

This feature is available only to approved apps and is subject to change.

The Intercept API registers a callback that checks the cart before checkout or a cash payment before Shopify Point of Sale (POS) adds it. Your callback returns validation findings, which Shopify POS displays as required or recommended actions. Staff address the findings in a resolution target. For complete examples, follow Build a cart validation UI extension and Build a payment validation UI extension. Before registering an interceptor, declare its event and matching resolution target. See Configuration rules.

  • Cart checks (cartvalidations): Apply a rule to the whole cart before checkout, such as requiring a note when the cart has a discount.
  • Product checks (cartvalidations): Collect staff input for a specific cart line before checkout.
  • Cash review (paymentvalidations): Recommend that staff review the cash count before accepting payment.

Register interceptors at this target for the following events:

TargetEvents
pos.app.ready.datacartvalidations, paymentvalidations

Use shopify.intercept() in the default entry function of pos.app.ready.data to register a callback for a declared event. This method is available only on the app background target. The method returns a function that unregisters the callback. You can register one callback per event in each extension instance, and the callback must return its result synchronously. Returning a Promise isn't supported.

A valid empty operations array adds no findings.

The app background target adds shopify.intercept() for registering validation callbacks.

Anchor to intercept
intercept
<K extends keyof >(type: K, interceptor: <K>) => () => void
required

Register an interceptor for a POS host workflow that can be blocked. Returns a function that unregisters the interceptor.

Event names accepted by shopify.intercept() and the event each callback receives.

Anchor to cartvalidations
cartvalidations
required

The event a cartvalidations interceptor receives. Carries a snapshot of the POS cart taken when the event was produced.

Anchor to paymentvalidations
paymentvalidations
required

The event a paymentvalidations interceptor receives. Carries the tender attempt's payment method and amount; split payments produce one event per tender, each with its own amount.

Anchor to Validation operationsValidation operations

Return this object synchronously from an interceptor. Each operation can add one validation finding.

Anchor to operations
operations
<TTarget>[]
required

The operations to apply. Each operation can add one validation finding.

Each handle must be unique within one result, even when operations target different line items. Shopify POS rejects a result that repeats a handle.

Use one of these exact target tokens to identify where a validation applies.

Anchor to CartValidationTarget

CartValidationTarget

|

A target that a cartvalidations interceptor can use: the whole cart or one cart line item. The target decides where Shopify POS shows the finding in the cart. Both targets open the same cart resolution target.

Anchor to PaymentValidationTarget

PaymentValidationTarget

"$.payment"

A target that a paymentvalidations interceptor can use. The only supported target is the payment attempt.

To learn where Shopify POS shows a finding for each cart target, refer to Where findings display.

Examples

jsx

export default function extension() {
shopify.intercept('cartvalidations', ({cart}) => {
if (cart.cartDiscounts.length === 0 || cart.note) return {operations: []};

return {
operations: [
{
validationAdd: {
level: 'ERROR',
handle: 'discount-note-required',
target: '$.cart',
},
},
],
};
});
}

The callback's result and the store's settings determine how Shopify POS displays a finding:

Callback resultStore configurationPOS label
ERRORblocking = true and the store has turned on Allow app to block checkoutRequired
ERRORBlocking isn't declared or the store hasn't allowed itRecommended
WARNINGAnyRecommended
Fails: isn't registered, rejects, times out, or returns an invalid or missing resultblocking = true, and the store has turned on both Allow app to block checkout and Block checkout if app experiences a problemRequired
FailsAny other configurationRecommended

Setting blocking = true declares that your interceptor can block checkout (cartvalidations) or a payment (paymentvalidations). It doesn't grant the store's permission. Required findings stop checkout or the payment until staff resolve or skip them through the Shopify POS flow. Recommended findings don't require resolution.

Merchants turn on both settings in the POS editor, in your extension's configuration. For the steps, see Activate a POS app extension. Allow app to block checkout lets your ERROR findings block the workflow. Block checkout if app experiences a problem makes the finding that Shopify POS creates for a failed interceptor Required, but only for an intercept that sets blocking = true. Despite their labels, both settings apply to cart validations and payment validations.


Anchor to Where findings displayWhere findings display

A finding's target identifies the part of the cart that the finding applies to: the whole cart (CartTarget) or one line item (CartLineItemTarget). It's different from an extension target, such as pos.app.ready.data. For the exact values, refer to Validation operations.

The finding's target decides where Shopify POS displays the finding in the cart. Shopify POS writes the label text, and your extension can't change it.

Place in the cartCartTarget ('$.cart')CartLineItemTarget ($.cart.lineItems['<uuid>'])
Cart validation bannerIncludedIncluded
Label on the line itemNo labelShows a label, such as 1 action required
Action in the line item's action menuNo actionShows an action, such as Complete required action

The banner and the line item action show one severity at a time:

  • If at least one finding is Required, then they read Complete required action, or Complete required actions for more than one, and count only the Required findings.
  • If every finding is Recommended, then they read Complete recommended action and count all of them.

The banner uses the findings in the cart. The line item action uses the findings on the selected line items.

Findings with either target lead staff to the cart resolution target, pos.cart.validations.resolution.render.

The resolution target doesn't receive the finding or the line item that staff selected. Its event data contains the cart, so read the cart to find the line items that need work.

Staff can also reach the resolution flow from checkout, for both targets. When staff select Checkout and validation finds a Required finding, Shopify POS opens the resolution flow for the whole cart.

Use CartTarget for a finding that applies to the whole cart, such as a missing cart note. Shopify POS shows a $.cart finding only in the cart validation banner. The banner also includes findings from Shopify POS and from other apps.

Staff tap the banner to open the resolution flow for the whole cart. The flow has a step for your extension, which renders your cart resolution target.

The Complete required action banner at the bottom of the Shopify POS cart.

Use CartLineItemTarget for a finding about one cart line item, such as a quantity limit or a serial number check. Get the uuid from lineItems in the event's cart. Shopify POS shows a finding with this target in two places. The line item shows a label for each severity, with the number of findings of that severity on the line item, such as 1 action required or 1 action recommended. The cart validation banner also includes the finding, with all other findings in the cart.

The 1 action required label on a line item in the Shopify POS cart, above the Complete required action banner.

Staff have two ways to open your cart resolution target:

  • Tap the banner. The flow covers all findings in the cart, from every target.
  • Select the line item, and then tap the action in the line item's action menu, such as Complete required action. The flow covers only the findings on the selected line items. It doesn't include findings with a $.cart target.

If you omit target, or the uuid doesn't match a line item in the event's cart, then Shopify POS handles the finding as a $.cart finding and shows it only in the banner.

The Complete required action item in the action menu of a selected line item in the Shopify POS cart.

Shopify POS runs your interceptor callback at specific points in each flow, and the order differs by event. The following sections give the sequence for each event: cart validation (cartvalidations) and payment validation (paymentvalidations).

Anchor to Cart validation (cartvalidations)Cart validation (cartvalidations)

The following steps describe the order in which Shopify POS runs cart validation, from the first cart change through checkout to the resolution target:

  1. Changes to the cart run cart validation. Shopify POS clears findings when the cart has no items and no customer. A cart with only a customer still runs validation.
  2. Starting checkout runs cart validation again rather than reusing an earlier result. Blocking findings prevent checkout.
  3. Staff can tap the cart validation banner to open the cart resolution target. For what happens when staff proceed, see Revalidation.

Anchor to Payment validation (paymentvalidations)Payment validation (paymentvalidations)

The following steps describe the order in which Shopify POS runs payment validation, from a cash payment attempt to the resolution target:

  1. Selecting or confirming cash runs payment validation before Shopify POS adds the payment. For split payments, each cash payment attempt runs validation. Retrying a failed payment submission doesn't run validation again.
  2. After staff select the cash tendered amount, Shopify POS automatically opens the payment resolution target if your callback returns findings, including Recommended findings. For what happens when staff proceed, see Revalidation.

Configure intercepts in shopify.extension.toml. The following sections cover the properties you set on each intercept and the requirements your configuration must meet. For complete examples, see Configure intercepts in the cart validation tutorial and the payment validation tutorial.

Anchor to Intercept propertiesIntercept properties

Each intercept declaration accepts the following properties:

PropertyRequired?ValueDescription
eventYesstring matching cartvalidations or paymentvalidationsThe Shopify POS workflow to intercept. Declare each event at most once.
blockingNobooleanSet to true if the callback can return ERROR findings. Defaults to false. Required findings also need the store's blocking permission.
applies_toYes if event is paymentvalidationsarray of unique string valuesThe payment methods that trigger the interceptor. Currently supports only ["cash"]. Don't set this property when event is cartvalidations, even to an empty array.

Anchor to Configuration requirementsConfiguration requirements

A valid intercept configuration must meet these requirements:

  • Use an app whose API client is approved for the POS intercept developer preview. Shopify checks this access when you run shopify app dev.
  • Add [[extensions.targeting.capabilities.intercepts]] to the [[extensions.targeting]] entry where target = "pos.app.ready.data". Don't add it under extension-level capabilities.
  • Set runs_offline = true under [extensions.supported_features].
  • Set api_version to 2026-10 or a later stable version.
  • Declare the matching resolution target for each event, even if it returns only warnings: pos.cart.validations.resolution.render for cartvalidations, and pos.payment.validations.resolution.render for paymentvalidations. Each resolution target also requires its matching event declaration in the same extension.
  • Shopify rejects unknown fields or events, duplicate events, invalid types or payment method values, and events or resolution targets without a matching declaration.

  • Prepare asynchronous data before the callback runs: The callback must return synchronously, so fetch or subscribe to any data it needs during target setup, cache the result, and read the cached value inside the callback.


Was this page helpful?