Embedded betslip

SDK betslip with onPlaceBet on web.

Guide: Embedded

Use the SDK betslip inside <embet-overlay> and settle each bet in onPlaceBet. Omit mode or set mode: 'INTERNAL'.

Replace YOUR_CLIENT_ID, YOUR_EVENT_ID, and wire onPlaceBet to your sportsbook API.

CDN (vanilla HTML + JavaScript)

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>emBET embedded betslip</title>
  </head>
  <body>
    <embet-overlay customid="YOUR_EVENT_ID"></embet-overlay>

    <script src="https://unpkg.com/@livelike/[email protected]/embet.umd.min.js"></script>
    <script>
      (async () => {
        await embet.init({ clientId: "YOUR_CLIENT_ID" });

        embet.betSlipConfig({
          currency: "€",
          currencyDisplay: "prefix",
          decimalSign: ",",
          maxAmount: 1000,
          onPlaceBet: async (payload) => {
            const accepted = await placeBetWithYourSportsbook(payload);
            return accepted ? { success: true } : { error: "undefined" };
          },
        });
      })();

      async function placeBetWithYourSportsbook(payload) {
        console.log("place bet", payload);
        return true;
      }
    </script>
  </body>
</html>

NPM + React

npm install @livelike/embet
import { useEffect } from "react";
import embet from "@livelike/embet";

const CLIENT_ID = "YOUR_CLIENT_ID";
const EVENT_ID = "YOUR_EVENT_ID";

export function EmbetSportsbookPlayer() {
  useEffect(() => {
    (async () => {
      await embet.init({ clientId: CLIENT_ID });

      embet.betSlipConfig({
        currency: "€",
        currencyDisplay: "prefix",
        decimalSign: ",",
        maxAmount: 1000,
        onPlaceBet: async (payload) => {
          const accepted = await placeBetWithYourSportsbook(payload);
          return accepted ? { success: true } : { error: "undefined" };
        },
      });
    })();
  }, []);

  return <embet-overlay customid={EVENT_ID} />;
}

async function placeBetWithYourSportsbook(payload: unknown) {
  console.log("place bet", payload);
  return true;
}