Skip to content

feat(point-of-sale): add paymentvalidations intercept types - #4611

Open
aaronschubert0 wants to merge 3 commits into
2026-10-rcfrom
pos-intercept-payment-method-selected
Open

feat(point-of-sale): add paymentvalidations intercept types#4611
aaronschubert0 wants to merge 3 commits into
2026-10-rcfrom
pos-intercept-payment-method-selected

Conversation

@aaronschubert0

@aaronschubert0 aaronschubert0 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Why

Enables payment-type interception (cash first) for extensible client-side validations — e.g. compliance workflows blocking cash tenders until required data is collected. Types-only and @private.

What

Adds the second interceptable workflow to the POS surface's private intercept API: paymentvalidations, dispatched when staff selects a payment method on the payments screen.

Follows the pattern established in #4520:

  • New POS_INTERCEPT_NAMES entry: PAYMENT_VALIDATIONS: 'paymentvalidations'
  • New ShopifyInterceptMap entry so shopify.intercept() picks up the workflow through the map generic — no changes to globals.ts
  • New payload types: PaymentValidationsEvent, InterceptedPaymentMethod, InterceptedPaymentMethodType

Also renames the first workflow per review, so both interceptable workflows follow one *validations naming scheme:

  • beforecheckoutcartvalidations (POS_INTERCEPT_NAMES.CART_VALIDATIONS, BeforeCheckoutEventCartValidationsEvent)
  • Safe pre-release: 2026-10-rc only, @private; the POS adapter consumes the constant symbolically (companion PR wiring bumps in lockstep)

InterceptResult / Operation / ValidationAdd are shared unchanged: ERROR blocks the selected method, WARNING does not.

Payload

  • paymentMethod: {type, identifier?}type is a stable string vocabulary (the internal numeric PaymentOptionType never crosses the boundary), constrained to 'cash' for v1; further method kinds join the union as they become interceptable. identifier is reserved for method types a shop can have several of (custom / local payment methods); unused for cash. Matching is exact on the pair.
  • amount: MoneyV2 — the per-tender amount in presentment currency.

Intentionally minimal for v1:

  • No split-payment context — interceptors see each split leg's amount independently; cross-leg aggregation (e.g. structuring detection) is future work.

References

@aaronschubert0
aaronschubert0 force-pushed the pos-intercept-payment-method-selected branch from 1953c8d to 5843221 Compare August 11, 2026 12:44
Assisted-By: devx/815595f2-0ce0-49e1-87fc-903983c87fa6
@aaronschubert0
aaronschubert0 force-pushed the pos-intercept-payment-method-selected branch from 5843221 to d5dd478 Compare August 11, 2026 12:51
@aaronschubert0
aaronschubert0 marked this pull request as ready for review August 11, 2026 13:19
readonly paymentMethod: InterceptedPaymentMethod;

/** The amount this tender would charge, in presentment currency. */
readonly amount: MoneyV2;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add transactionId

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reversed after discussion — dropping transactionId from v1. The host cannot guarantee an id at selection time (Transaction.id?), so the field would be unreliable at exactly the moment it dispatches; payload stays paymentMethod + amount. Can revisit if a concrete correlation need lands.

Comment thread packages/ui-extensions/src/surfaces/point-of-sale/events.ts Outdated
…ymentvalidations

Assisted-By: devx/8f5f2569-f126-402e-ae95-8081edfa5d81
…ations

Assisted-By: devx/ec0d35cb-d0dc-42cc-bac7-60ff45d75c7c
@aaronschubert0 aaronschubert0 changed the title feat(point-of-sale): add paymentmethodselected intercept types feat(point-of-sale): add paymentvalidations intercept types Aug 14, 2026
@aaronschubert0
aaronschubert0 force-pushed the pos-intercept-payment-method-selected branch from c915032 to 576635e Compare August 14, 2026 13:28
@vctrchu

vctrchu commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

/snapshot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants