This guide covers secure production setup and common embed issues.Documentation Index
Fetch the complete documentation index at: https://docs.shoppex.io/llms.txt
Use this file to discover all available pages before exploring further.
Security Model
The SDK protects modal message handling by validating iframe origin before processing events.
Only messages from trusted origins are accepted — forged
postMessage events from random origins are ignored.https://checkout.shoppex.io- local development origin for checkout app
postMessage events from random origins are ignored.
CSP Setup
If you run strict CSP, allow checkout iframe + script and pass a nonce toShoppex.init.
Example policy:
- The SDK injects styles into its shadow root.
- The
nonceallows those injected styles under strict CSP.
Return URL Safety
Use a trusted application URL forreturnUrl.
returnUrl.
Production Checklist
Use HTTPS everywhere
The embed modal runs inside a cross-origin iframe. Most browsers block mixed content, so your host page must be served over HTTPS.
Load the embed script from the correct origin
Always load from
https://checkout.shoppex.io/embed/embed.iife.js — never self-host or proxy the script, as it needs to match the iframe origin.Bind event handlers
Listen for
shoppex:success and shoppex:error events so your app knows when a payment completed or failed. Without these, your UI has no feedback loop.Track conversions
Fire your analytics conversion event inside the
shoppex:success handler. This is the only reliable moment to attribute a sale to your funnel.Validate product and variant IDs
Double-check that
data-shoppex-product-id and data-shoppex-variant-id values match real products. Invalid IDs silently fail to open the modal.Test dark mode and mobile viewports
The modal adapts to
prefers-color-scheme and small screens. Test both to catch layout issues before your customers do.Troubleshooting
Modal does not open
Modal does not open
Checklist:
- Script is loaded.
- Element has valid
data-shoppex-product-id,data-shoppex-group-id, ordata-shoppex-items. itemscontains at least one non-emptyproductId, unless you pass a validgroupId.- No JavaScript error before click handler runs.
Wrong product opens
Wrong product opens
Cause:
Multiple
items currently resolve to first valid item in modal flow.Fix:
Pass one item per checkout open until multi-item modal support lands.Event listeners do not fire
Event listeners do not fire
Checklist:
- Listen on
document, not only on button element. - Ensure checkout completed successfully for
shoppex:success. - Verify browser extensions/policies are not blocking cross-origin frames.
Modal appears behind custom UI
Modal appears behind custom UI
Use low-risk defaults:
- Avoid custom overlays with extreme z-index values.
- Test with your cookie/privacy banners and support widgets.
Dynamic content buttons do not open checkout
Dynamic content buttons do not open checkout
Debug Helpers
Simple runtime checks:Related Docs
Embed SDK Overview
Start here for integration patterns.
Embed SDK Reference
Full API, attributes, and event details.
Embed Snippets
Copy-paste code snippets for common embed scenarios.