on on the block from Shoppex.mount, or with DOM events on the HTML block.
Events
Steps are
details (email and fields), payment, processing, redirect and success. Before 3-D Secure, the block sends step: 'processing' with reason: 'authentication' and the script scrolls the block into view, so the bank’s check is not off screen.
Redirects. reason is 'gateway' or 'authentication'. target is 'popup', 'new_tab' or 'top'. If the browser blocks the popup or new tab, the script opens the address in the current tab.
Test mode adds test: true to invoice-created and success, and the invoice ID starts with test_. No invoice exists.
DOM events
The HTML block sends every event as a DOM event namedshoppex:element:<event> on its <div>. The payload is in event.detail. The events bubble, so you can listen on document:
Shoppex.mount sends the same DOM events on its container.
Error codes
Match oncode. A code never changes its meaning, and new errors get new codes. message is text for the buyer in their language and can change at any time.
recoverable: true means the buyer can still finish in the same block, for example by fixing a field, picking another payment method or clicking Try again.
For the load and config errors, the block shows its own message in place of the checkout. The other errors show inside the checkout, where the buyer can act on them.
Warnings
Warnings come after
ready, once per key and appearance.
What your page cannot do
Your page can restyle the block withupdate({ appearance }). It cannot start, confirm or cancel a payment, and it cannot change the product, the quantity or the amount. Only the buyer can, inside the block. The block accepts messages only from the page that loaded it, and your script accepts events only from its own block on checkout.shoppex.io.