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
- The button calls
POST /api/v1/orders/createwith your key. - TixCore creates an order on your gateway and returns its public key + order id.
- The SDK opens the gateway’s checkout with that order.
- On payment, the SDK posts the signature to
POST /api/v1/payments/verify. - TixCore verifies it server-side and issues the ticket.