Bookitive
Developers

JS client

The @bookitive/js typed client for building your own checkout — reads, placing orders, phone verification, waitlist, live seat updates, and typed errors.

Not verified yet

@bookitive/js is the headless companion to the widget: where the widget gives you the seat-map UI, this package gives you the raw typed API for building your own checkout from scratch. Every request and response type is generated from the backend's OpenAPI spec, so they can't drift.

npm i @bookitive/js

Reading data

import { BookitiveClient } from '@bookitive/js';

const client = new BookitiveClient({
  baseUrl: 'https://api.bookitive.com',
  org: 'city-theatre',
  event: 'spring-gala-2027',
});

const event = await client.event(); // identity, branding, priced ticket types
const seating = await client.seating(); // floors → sections → tables, seats, GA areas
const availability = await client.availability(); // current sellability snapshot
const preview = await client.discount('SPRING10'); // validate a promo code

Pass your framework's fetch to the constructor for SSR.

Placing an order

checkout() places a reservation: seats are held atomically for the event's hold TTL, and payment instructions are emailed to the buyer and returned to you.

import { BookitiveError, checkoutErrorMessage } from '@bookitive/js';

try {
  const order = await client.checkout({
    customer: { name: 'Jana Nováková', email: 'jana@example.com' },
    items: [
      { ticketTypeId: '…', seatId: '…', quantity: 1 }, // a seat
      { ticketTypeId: '…', gaAreaId: '…', quantity: 2 }, // standing
    ],
    // discountCode, verificationToken, captchaToken, …
  });
} catch (err) {
  if (err instanceof BookitiveError && err.isConflict) {
    // a seat was taken mid-checkout — refresh and reselect
  }
}

Phone verification and waitlist

  • verifyStart(phone, captchaToken?) and verifyCheck(phone, code) mint the single-use verificationToken you pass to checkout() for phone-verified events.
  • joinWaitlist(req) adds a buyer to a sold-out type's waitlist.

Live seat updates

live() opens a websocket for real-time seat changes — essential for a custom seat map that must stay honest:

const sub = client.live({
  onStartstate: (snapshot) => {}, // full state on every (re)connect — your resync point
  onSeat: (delta) => {}, // per-seat changes after that
  onConnectionChange: (connected) => {}, // boolean — true on connect, false on drop
});

It fires a full startstate snapshot on every connect and reconnect (auto-reconnect with jittered backoff), so you resync cleanly after any network blip rather than drifting.

Typed errors

BookitiveError carries status, a runtime type enum you can compare (err.type === …), per-code fields (e.g. order limits), and the isConflict shortcut. checkoutErrorMessage(err, locale) returns buyer-ready Czech/English copy for known errors, or undefined for ones you should handle yourself.

This is the public API — it does only what a buyer could do (read the event, hold seats, verify a phone). For server-side reads across your whole organization, that's the partner API with a secret key.

On this page