# Running the door

Source: https://docs.tuppence.ai/docs/point-of-sale/event-check-in/

> Check guests in from the Tuppence app or the browser till, online or offline, at several gates, and sell the last tickets at the door from the normal till.

For agents: [start here](https://docs.tuppence.ai/docs/agents.md), [every page](https://docs.tuppence.ai/docs/llms.txt), [the agent guide](https://docs.tuppence.ai/docs/SKILL.md), [the MCP server](https://docs.tuppence.ai/docs/mcp.md).

Check guests in by scanning their ticket, typing the code they read out, or finding their name.
It works offline: each device carries the guest list and checks codes itself, and the scans sync
when the signal comes back. The first scan of a ticket wins.

## 1. Get the door ready

| What | Where | Default |
|---|---|---|
| Gates | The event's `gates`: up to 10 names (`Main`, `VIP`) | One gate, `Main` |
| Who scans | Anyone on the team, or **Door staff** (a team role that checks guests in and sells door tickets, nothing else) | Owners, admins, managers and developers |
| Seats kept for the door | A ticket type's `door_allowance`: the event page never sells them | `0` |
| Door sales | Link a ticket type to a catalogue product of kind `ticket` (`product` on the ticket type) | Not sold at the till |
| Something to hand over | A ticket type's `hand_over` (`Hoodie`, `Two drink tokens`), shown when its ticket is scanned in | Nothing |

## 2. Check guests in

Open **Check-in** in the app (Account) or the browser till (the ticket button at the top), pick the
event and your gate, then:

- **Scan** the QR with the camera, or a scanner on the browser till. Both the printed code and the
  ticket page's moving code work.
- **Type the code** a guest reads out (`T-8F2K-QX41`; case, spaces and dashes don't matter).
- **Find a name** for a guest without a phone, then tap them.

| Result | Shown as | Means |
|---|---|---|
| `admitted` | Green, "Welcome in" | First scan of a valid ticket. The hand-over note shows here |
| `duplicate` | Amber, "Already checked in" | Scanned in before, at the gate named |
| `void` | Red, "Ticket cancelled" | Refunded or cancelled |
| `invalid` | Red, "Not a ticket for this event" | Not this event's code, a forged code, or an old moving code |

## 3. Offline

The device downloads the guest list (every ticket, the holder's name, its type and the event's
verification key) and asks again every 30 seconds while online. Without signal it keeps checking
codes and names from that list, keeps each scan, and shows how many are waiting to send. They go
as soon as it is back online, a batch every few seconds.

## Duplicates and several gates

Scans are applied in the order they were made, by each device's clock, not the order they arrive.
If two devices scan the same ticket offline, the earlier scan admits the guest and the later one is
flagged `duplicate`, naming the gate that let them in. A device that synced first can see its own
scan turn into the duplicate once the other device syncs.

## Selling at the door

Ring up the ticket product on the till as usual. When the sale is paid its tickets are issued (a
ticket order with `source: "door"`). Door sales are paid out like any till sale: the money is not
held until after the event.

- Online, the till sells what is left, including the seats kept for the door, and refuses a sale
  when the date is sold out.
- Offline, a till may sell what is left of the door allowance it last downloaded
  (`GET /v1/pos/door_stock`, `offline_allowance`). With several tills offline at once, keep door
  sales to one of them.

## The live panel

The event's page in the dashboard shows **Check-in**: guests in out of tickets issued, by gate and
by ticket type, and the time of the last scan. It updates every few seconds.

## API

| Call | What it does |
|---|---|
| `GET /v1/ticketing/check_in_events` | The events a device can check guests in for |
| `GET /v1/ticketing/events/{id}/check_in_manifest` | The guest list and verification key (`no-store`) |
| `POST /v1/ticketing/check_ins` | One scan: `code`, `short_code` or `ticket`, with `gate` |
| `POST /v1/ticketing/check_ins/sync` | Up to 500 scans a device kept offline, applied in the order made |
| `GET /v1/ticketing/check_ins` | Scans, newest first (`?event=`, `?ticket=`) |
| `GET /v1/ticketing/events/{id}/check_in_counts` | Guests in, by gate and ticket type |
| `GET /v1/pos/door_stock` | What a till may sell at the door, online and offline |

Each admitted ticket sends `ticket.checked_in` once. Requests need the `check_ins` scope (a paired
till has it).
