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.

Anchor to PaymentValidationTarget

PaymentValidationTarget

"$.payment"

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

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.


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?