Search.../

createTicketDefinition( )

Developer Preview

Creates a ticket definition (and enables ticket sales).

Description

Note: Only visitors with Manage Ticket Definitions permissions can create a ticket definition. You can override the permissions with the wix-auth elevate() function.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function createTicketDefinition(eventId: string, definition: TicketDefinitionData): Promise<CreateTicketDefinitionResponse>

createTicketDefinition Parameters

NAME
TYPE
DESCRIPTION
eventId
string

Event ID.

definition
TicketDefinitionData

Ticket definition data.

Returns

Return Type:

Promise<
CreateTicketDefinitionResponse
>
NAME
TYPE
DESCRIPTION
definition
TicketDefinition

Created ticket definition.

Was this helpful?

createTicketDefinition example

Copy Code
1import { ticketDefinitions } from 'wix-events.v2';
2
3 async function createTicketDefinition(eventId, definition) {
4 try {
5 const result = await ticketDefinitions.createTicketDefinition(eventId, definition);
6
7 return result;
8 } catch (error) {
9 console.error(error);
10 // Handle the error
11 }
12 }
13