Search.../

createReservation( )

Developer Preview

Reserves tickets for 20 minutes. Reserved tickets are deducted from tickets stock and cannot be bought by another party. When the reservation expires, the tickets are added back in the stock.

Note: This function is restricted and only runs if you elevate permissions using the wix-auth.elevate() function.

Syntax

function createReservation(eventId: string, options: CreateReservationOptions): Promise<CreateReservationResponse>

createReservation Parameters

NAME
TYPE
DESCRIPTION
eventId
string

Event ID.

options
Optional
CreateReservationOptions

An object representing the available options for creating a reservation.

Returns

Return Type:

Promise<
CreateReservationResponse
>
NAME
TYPE
DESCRIPTION
_id
string

Reservation ID.

expires
Date

Reservation expiration timestamp.

invoice
Invoice

Reservation invoice.

reservations
Array<
TicketReservation
>

Ticket reservations.

Was this helpful?

createReservation example

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