Skip to main content

Resolution API

Feature preview

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

The Resolution API reads the cart or payment data for your resolution interface, and registers a save handler to finish pending work before Shopify Point of Sale (POS) revalidates. For an item-targeted authenticity check demo, follow Build a cart validation UI extension.

  • Cart findings: Derive the cart line that needs attention from the intercepted cart.
  • Payment findings: Show the attempted payment method and cash amount received.
  • Pending changes: Run an asynchronous check and save its result before Shopify POS revalidates.
  • Revalidation updates: Refresh the interface after Shopify POS revalidates.

Each resolution target receives the following event data:

Payment resolution has read-only cart access through ReadonlyCartApi. Use shopify.cart.current to read the cart and subscribe to changes. You can't modify the cart from this target.

The shopify global object provides the intercepted event data and a save handler for the active resolution target. Access the following properties on shopify to read the cart or payment event and register work that Shopify POS must await before revalidation.

Anchor to event
event
<TEventData>
required

The data of the intercepted event this resolution target was opened for. The value property provides the current data, and subscribe receives Shopify POS revalidation updates.

Anchor to onSave
onSave
(handler: ) => Promise<() => Promise<void>>
required

Registers a handler that runs when staff advance the resolution flow (Save, Next, or Done). POS awaits the handler before it re-runs the intercepted validation, so use it to commit any pending work, for example cart updates or storage writes, and await those calls inside the handler. A rejected promise does not stop the flow; POS still re-runs validation and the interceptor result decides what happens next.

Only the most recent handler is kept.

Examples

jsx

import '@shopify/ui-extensions/preact';
import {render} from 'preact';
import {signal} from '@preact/signals';

const lineCount = signal(0);

export default async () => {
lineCount.value = shopify.resolution.event.value.cart.lineItems.length;
shopify.resolution.event.subscribe(({cart}) => {
lineCount.value = cart.lineItems.length;
});
render(<Extension />, document.body);
};

function Extension() {
return <s-text>Items after revalidation: {lineCount.value}</s-text>;
}

When staff tap the proceed control in the resolution interface to continue to checkout or complete the payment, Shopify POS runs validation again. The interceptor's findings, not the save handler's return value, decide whether staff can continue. This applies to both resolution targets. When staff proceed:

SituationWhat Shopify POS does
The save handler resolvesRuns validation again. The findings decide whether staff can continue.
The save handler rejectsStill runs validation again. The rejection doesn't stop the flow.
The save handler doesn't finish within 10 secondsStops waiting and runs validation again.
No save handler is registeredRuns validation again.

In payment resolution, after staff finish the flow with no blocking findings remaining, Shopify POS resumes the payment. Dismissing the interface doesn't resume it.


  • Save the latest change before revalidation: Await your cart or storage writes inside shopify.resolution.onSave, and keep your interceptor returning a finding until the new state is saved. Shopify POS revalidates even if the handler rejects or runs past 10 seconds, so validation can run before a slow save finishes.


Was this page helpful?