Endpoint
Description
Updates the status of a ticket. This mutation is typically used for ticket scanning at events (marking as “used”), processing refunds (marking as “refunded”), or cancelling tickets (marking as “cancelled”). Source:convex/tickets.ts:50-63
Parameters
The unique identifier of the ticket to update
The new status for the ticket. Must be one of:
"valid"- Ticket is active and unused"used"- Ticket has been scanned/used for event entry"refunded"- Ticket has been refunded"cancelled"- Ticket has been cancelled
Ticket Status Enum
The status parameter accepts exactly four values:Status Meanings
- valid: Default status when a ticket is purchased. Indicates the ticket can be used for event entry.
- used: Ticket has been scanned at the event entrance. Prevents duplicate entry.
- refunded: Ticket has been refunded to the purchaser. Cannot be used for entry.
- cancelled: Ticket has been cancelled. Cannot be used for entry.
Response
The mutation does not return a value. It updates the ticket status in the database.Example
Common Use Cases
Event Entry Scanning
When a ticket is scanned at event entrance:Processing Refunds
When issuing a refund to a customer:Cancelling Tickets
When a user cancels before an event:Reactivating a Ticket
If needed, a ticket can be reactivated:Status Flow
Typical ticket lifecycle:Integration with Event Availability
Only tickets with “valid” or “used” status count toward event capacity. Refunded and cancelled tickets free up space for other attendees. Fromconvex/events.ts:331-342:
Security Considerations
- Implement proper authorization checks before calling this mutation
- Event organizers should only be able to mark their own event tickets as “used”
- Users should only be able to request refunds for their own tickets
- Consider adding audit logging for status changes