Betting events
This page lists the events exchanged between the betting frame and your platform. Outbound events are delivered through bettingAPI.subscribe, inbound events are sent with bettingAPI.emit.
Initialization
betting-init
Description: This event is dispatched by application once it is fully initialized on the client side.
This event acts as a signal that the global window.bettingAPI object is now available and ready to be used.
Important
Unlike other application events, betting-init is a global DOM event emitted via document.dispatchEvent(...), not an event you subscribe to through bettingAPI.
Example:
1 2 3 4 5 6 | |
Outbound events
Events the frame sends to your platform. Subscribe with bettingAPI.subscribe(event, handler); the returned function unsubscribes.
redirect
Description: Trigger at the moment of performing the actions specified in the Destination; it must be possible to set the transition via external routes.
1 2 3 4 5 6 | |
Example: This event is typically used to trigger the opening of a login modal when an unauthorized user attempts to place a bet
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |
handle-not-enough-balance
Description: Trigger when a player does not have enough funds to make a bet. The integrator can handle the case where the user needs to deposit more funds.
1 2 3 | |
Example: This event is typically used to trigger the opening of a deposit modal
1 2 3 | |
handle-custom-errors
Description: Triggers when a custom_error is received from the bet/place callback. The integrator can handle these custom errors and implement appropriate user-facing actions based on the error codes and context.
1 2 3 4 5 6 7 8 9 | |
Example:
1 2 3 | |
toggle-widget-betslip
Description: Trigger when a player opens or close the betslip widget
1 2 3 4 5 | |
Example: The integrator can use this event to handle UI changes, such as enabling/disabling scrolling on mobile devices.
custom-widget-init
Description: Triggered when the custom widget container is mounted and ready to receive content. This event indicates that the container is ready for rendering custom React components using createPortal.
1 2 3 4 | |
Properties:
containerId: Unique identifier for the containerelement: The DOM element where custom content should be rendered
Example:
Use this event to render custom content into specific widget containers once they become available.
1 2 3 4 5 6 | |
odd-click
Description: Triggered when the user clicks an odd in the SPA: one selection for a plain click, several for a bundle (for example a pre-generated bet). The event only reports the click. What it means for your betslip (add, remove, replace, reject) is your decision; the SPA does not keep its own copy and learns the outcome from betslip-selections-change. Use the identifiers to fetch the current odds from your own API.
The odds for a Bet Builder and its individual legs are returned in betBuilderSelections instead of selections. A Bet Builder is one bet per sportEventId, so group the legs by that id: a click in a Bet Builder market reports one leg, a pre-generated Bet Builder card reports all of its legs. A bundle that combines regular odds with a Bet Builder fills both arrays in the same click; apply them to your betslip as one change.
1 2 3 4 5 6 7 8 9 10 | |
Example: A host with its own betslip applies its rules to the click and reports the result back with emit("betslip-selections-change"). See External betslip.
1 2 3 | |
Inbound events
Events your platform sends to the frame with bettingAPI.emit(event, payload). Unknown event names are logged and ignored. See External betslip for the full integration flow.
betslip-selections-change
Description: Reports the full set of selections currently in the host's own betslip, allowing the SPA to highlight the corresponding odds as selected. This is a snapshot, not a delta: send it on start, once bettingAPI is available, and after every change (add, remove, clear, bet placed). An empty array clears every highlight. Odds rendered later (navigation, expanded markets) pick the snapshot up automatically. Bet Builder legs go into betBuilderSelections; the SPA groups them into one Bet Builder per sportEventId and highlights them in the Bet Builder markets. Omit the field when your betslip has no Bet Builders.
1 2 3 4 | |
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |