Skip to content

How would you prevent the same ticket being checked in twice?

1 min read · main part only; folded sections are optional

After this you can answer: How would you prevent the same ticket being checked in twice?

The current HMAC token authenticates its payload and checks that ticket identity matches booking and seat. It does not record admission. A screenshot or copied QR remains cryptographically valid until the verifier applies additional state and policy.

A proposed check-in endpoint would authorize staff for the event, validate ticket ownership rules and use a conditional database transition. Record scanner, request identity and admission time for audit. If the response is lost after the transition commits, the same scan intent must replay its success rather than appear to be a new fraud attempt.

Two online scanners need one authoritative state change. Two disconnected scanners cannot both know whether the other admitted the ticket. Choose online-only admission, partition tickets among devices, or accept and reconcile offline conflicts. Revocation, event rescheduling, key rotation and manual override also need rules. The referenced verifier is implemented; the endpoint, admission records and staff scanner UI are proposed only.

Can you put used=true inside the QR?
A printed or copied token cannot update shared state. The authoritative used state belongs on the server.
What if the check-in server is unavailable?
Follow the agreed offline policy. Failing closed preserves the single-use guarantee but can stop admission; offline acceptance risks duplicates.
Why retain an audit record?
It explains duplicate scans and overrides, supports investigations and helps distinguish a lost response from a second admission.

Read the path chapter, select the relevant map piece →, then inspect apps/worker/src/tickets/token.ts → verifyTicket.

Read this book online: https://book.theversehub.in/