Jetron TicketFluid

Sales

Show presale countdowns, unlock password-protected sales, and collect waitlist signups.

An event can sell tickets in timed sales, such as a presale that opens a day early and a general sale after it. Each sale has a start date, an optional end date, and can cover every ticket or only some. A sale can also require a password, for example one you send to your mailing list.

Use sales to:

  • show a countdown to when tickets go on sale,
  • let attendees with a password into a presale,
  • collect waitlist signups so attendees are emailed when a sale opens.

Events without sales need none of this: their tickets can be bought straight away.

List an event's sales

GET /events/{slug}/sales returns every sale for the event.

const { data: sales } = await client.listSales('my-event')

for (const sale of sales.items) {
  sale.name // "Presale"
  sale.phase // "UPCOMING", "ACTIVE" or "ENDED"
  sale.startDate // ISO date-time
  sale.endDate // absent when the sale has no end
  sale.requiresPassword
  sale.waitlistOpen
}

Sales are ordered by start date, earliest first. Ended sales are included, so you can label a finished presale instead of hiding it.

FieldWhat it tells you
phaseUPCOMING before startDate, ACTIVE until endDate, ENDED after it. A sale with no endDate stays ACTIVE.
requiresPasswordWhether buyers need a password. The password itself is never returned.
includeAllTicketstrue when the sale covers every ticket. Otherwise ticketIds lists the tickets in it.
waitlistOpenWhether attendees can still join the waitlist. It closes when Jetron Ticket starts notifying the waitlist, at the latest when the sale opens.

Show a countdown

Count down to startDate for an UPCOMING sale, and to endDate for an ACTIVE one. phase is worked out when you make the request, so fetch the sales and tickets again when a countdown reaches zero rather than flipping the state yourself.

const next = sales.items.find((sale) => sale.phase === 'UPCOMING')

if (next) {
  startCountdown(new Date(next.startDate), {
    onZero: () => refreshSalesAndTickets(),
  })
}

How sales affect tickets

GET /events/{slug}/tickets already applies sales, so you can render tickets straight from it:

  • A ticket that only a sale unlocks lists that sale in its sales array. Each entry has the sale's id, name, dates, phase and requiresPassword.
  • While the ticket's sale has not opened, its status is SALE_NOT_STARTED.
  • Once every sale for the event has ended, tickets that would otherwise be AVAILABLE show SALE_ENDED, including tickets that were never in a sale.
  • When sales is empty, no open or upcoming sale covers the ticket. Its status tells you whether it can be bought.

To show the tickets for one sale, for example on a presale page, pass its ID:

const { data: tickets } = await client.listTickets('my-event', { saleId: presale.id })

Password-protected sales

When requiresPassword is true, the attendee needs the password to buy that sale's tickets.

Check the password

Ask the attendee for the password and check it with POST /events/{slug}/sales/{saleId}/verify-password. This only works while the sale is ACTIVE. Passwords are not case-sensitive.

try {
  await client.verifySalePassword('my-event', presale.id, { password: input })
  unlockPresaleTickets()
} catch (err) {
  if (err instanceof ApiError && err.status === 400) showMessage(err.message)
  else throw err
}

A wrong password, or a sale that is not open, returns 400.

Send it with the reservation

Checking a password does not unlock anything on its own. Send the sale and the password again when you reserve:

const { data: reservation } = await client.createReservation('my-event', {
  items: [{ sku: ticket.id, quantity: 2 }],
  saleId: presale.id,
  salePassword: input,
})

Keep the password in memory for the attendee's checkout, and send it on every reservation call for that sale.

saleId is optional when there is only one open sale: the API uses the open sale for tickets that need one. Send it when several sales are open at once, so the right one is used.

Waitlists

While waitlistOpen is true, attendees can sign up to hear when a sale opens with POST /events/{slug}/sales/{saleId}/waitlist:

await client.joinSaleWaitlist('my-event', sale.id, {
  name: 'Kendall Roy',
  email: 'kendall@example.com',
})
  • Jetron Ticket emails the attendee to confirm, then emails them again when the sale is about to open (unless you turned waitlist emails off for that sale).
  • Signing up twice with the same email is safe.
  • Once waitlistOpen is false, signups return 400. Show the countdown or the tickets instead.

Protect your forms

Waitlist and password forms are public, so add your own spam protection, such as a CAPTCHA, in front of them if your site attracts bots.

On this page