Betslip

Embedded Betslip

The emBET SDK provides an embedded betslip UI. When a user places a bet, the SDK forwards the bet request to the bet/ticket engine of the integrator. The integrator remain responsible for validating the bet, accepting or rejecting it and providing the SDK with bet settlement feedback (placed or rejected) so it can inform the end user within the embedded betslip UI.​

Configuration

In order to allow bet placement through the emBET SDK the integrator needs to provide a betSlipConfig.

await embet.betSlipConfig({
  currency: "€",
  currencyDisplay: "prefix",
  decimalSign: ",",
  maxAmount: 1000,
  onPlaceBet: async (payload) => {
    // Integrator's logic for handling the betting process

    return {
      success: true,
    };
  },
});

Configuration Parameters

  • currency: A symbol or string representing the currency.
  • currencyDisplay: Determines whether the currency appears as a prefix (e.g., € 10) or suffix (e.g., 10 €).
    • Options are prefix or suffix.
  • decimalSign: A character representing the decimal sign used when showing a number.
  • maxAmount: A number indicating the maximum amount a user is able to place.
  • onPlaceBet: A function used for handling the betting process.

Handling Bets

Once the user selects an amount and initiates the betting process, the integrator must approve or decline the bet within the onPlaceBet function.

Always fulfill a promise!

The bet flow should handle all cases properly, ensuring a seamless user experience. User interaction is disabled during the waiting period.

Payload Object

The SDK sends the following payload to the onPlaceBet function:

  • amount: Amount selected for the bet.
  • marketId: ID of the selected market.
  • odds: Odds associated with the selected outcome.
  • outcomeId: ID of the selected outcome.
  • specifiers: Specifier string to identify the correct market.

The actual betting transaction is not handled by the emBET module but must be managed by the integrator. Additionally, by using the maxAmount configuration property you can enforce a maximum limit on the amount a user can place on individual bets to ensure responsible betting practices or meet legal restrictions.

Bet States

StateDescriptionPossible Actions
Success (success: true)Completes the betting process, shows a success message, and reverts to the initial state.No action required.
Error (error: betSuspended)Stops the process, shows an error message, and reverts to the initial state.Make another selection to place a bet
Error (error: insufficientFunds)Stops the process, shows an insufficient funds message, and returns the user to amount selection.Choose a lower amount to place the bet.
Error (error: oddsChanged)Stops the process, shows an odds changed message, updates the odds, and returns the user to amount selection.Review the updated odds and place a bet if desired
Error (error: undefined)Stops the process, shows a generic error message for a short duration and returns the user to initial stateTry to place the bet again or make another selection.

Success Example

const onPlaceBet = async (payload) => {
  // Integrator's logic for handling the betting process
  return {
    success: true,
  };
};

Error Example

const onPlaceBet = async (payload) => {
  // Integrator's logic for handling the betting process
  return {
    error: "insufficientFunds",
  };
};

Custom Betslip

With this approach the application of the integrator manages the full bet placement experience through it's own betslip.

When a user initiates a bet from the emBET overlay, the emBET SDK notifies the application of the integrator. The integrator then takes over by displaying it's own betslip and eventually handle the bet placement flow.​

When using a custom betslip, bet placement events (markets, stakes, outcomes) must be shared with the SDK to enable product analytics and performance tracking.​

Handling Bets

Once the user selects an outcome, the SDK will send an outcome_selected event through the Event Manager.

Payload Object

The SDK sends the following payload to the outcome_selected event:

  • marketId: ID of the selected market.
  • outcomeId: ID of the selected outcome.
  • specifiers: Specifier string to identify the correct market.

After the bet placement flow has finished the integrator needs to call the notifyBetPlaced function from the SDK to track product analytics and performance.

Payload Object

The integrator sends the following payload to the notifyBetPlaced function:

  • betResult: String representing success or error state according to our Bet States.
  • error: Error message indicating what went wrong.
  • marketId: ID of the selected market.
  • outcomeId: ID of the selected outcome.
  • stake: Number representing the stake.
embet.notifyBetPlaced({
  betResult: "success",
  error: null,
  marketId: "sr:market:1",
  outcomeId: "sr:outcome:1",
  stake: 10
});