JavaScript integration

Embed checkout on any website with a script tag and a single TixCore.init() call.

Minimal example

html
<script src="https://your-app.netlify.app/sdk.js"></script>
<div id="tixcore-buy"></div>
<script>
  TixCore.init({
    apiKey: "tix_live_•••••",
    eventId: "evt_champions_final",
    mount: "#tixcore-buy",
  });
</script>

Options

  • apiKey — your public API key. Required.
  • eventId — the event to sell. Required.
  • mount — a CSS selector to render the button into. Required.
  • ticketTypeId — pre-select a ticket type (optional).
  • theme"dark" or "light" (optional).
  • onSuccess — callback with the issued ticket (optional).

Handling success

The SDK opens a checkout modal, runs the gateway flow, verifies the payment, and then calls onSuccess with the ticket so you can show a confirmation or trigger your own analytics.

js
TixCore.init({
  apiKey: "tix_live_•••••",
  eventId: "evt_champions_final",
  mount: "#tixcore-buy",
  onSuccess: (ticket) => {
    console.log("Issued", ticket.ticketNumber);
    window.location.href = "/thank-you";
  },
});

How the flow works

  1. The button calls POST /api/v1/orders/create with your key.
  2. TixCore creates an order on your gateway and returns its public key + order id.
  3. The SDK opens the gateway’s checkout with that order.
  4. On payment, the SDK posts the signature to POST /api/v1/payments/verify.
  5. TixCore verifies it server-side and issues the ticket.