Skip to main content
This page documents the current behavior of the Checkout Embed SDK (window.Shoppex).

Script

Global object:

Integration Modes

The SDK auto-binds clickable elements matching:
  • [data-shoppex-product-id]
  • [data-shoppex-group-id]
  • [data-shoppex-checkout]
Simple button:
Multi-item via JSON:
Group button:

Data Attributes

* Required unless data-shoppex-items contains at least one valid item. ** Required when you want to open a group instead of a product checkout. data-shoppex-metadata example:

JavaScript API

Shoppex.init(config?)

Initializes bindings and keyboard handlers.
Notes:
  • Usually optional because the script initializes automatically.
  • Safe to call multiple times; first call wins.

Shoppex.open(options)

Opens modal checkout.
Important behavior:
  • items must contain at least one valid productId, unless groupId is provided.
  • groupId opens a group picker first, then forwards the buyer into the normal product checkout page.
  • If more than one item is passed, current modal flow uses the first valid item.
  • Calling open() while a modal is open closes the old modal first.

Shoppex.close()

Closes the modal programmatically.

Events

Listen on document:
Event payloads: Internal iframe events used by the SDK:
  • shoppex:ready
  • shoppex:resize
  • shoppex:close

URL Mapping

The SDK resolves checkout iframe URLs to:
Supported query params sent by SDK:
  • quantity
  • variantId
  • theme (only when not auto)
  • flow
  • shopId
  • returnUrl
  • email
  • couponCode
  • affiliateCode
  • metadata[key]=value

Runtime Behavior

  • Modal uses Shadow DOM (mode: closed) for style isolation.
  • Escape, backdrop click, and close button all close modal.
  • Dynamically inserted buttons are auto-bound (MutationObserver).
  • Message handling only accepts trusted checkout origins.

Practical Example


Need Faster Setup?

Copy/Paste Snippets

Framework snippets for Next.js, React, WordPress, and Webflow.