Search.../

reserveReservation( )

Developer Preview

Reserves or requests a held reservation.

Description

Held reservations are temporary reservations with the HELD status created by createHeldReservation().

They are intended to reserve seats and tables for a party in a selected time slot while they enter further reservation details, such as names and contact information. Reservations with the HELD status are only valid for 10 minutes. Trying to call Reserve Reservation with a held reservation older than 10 minutes returns an error.

Reserve Reservation changes a reservation's HELD status to:

  • RESERVED if the reservation's reservation location does not require manual approval.
  • REQUESTED if the reservation's reservation location requires manual approval.

Syntax

function reserveReservation(reservationId: string, reservee: Reservee, revision: string): Promise<ReserveReservationResponse>

reserveReservation Parameters

NAME
TYPE
DESCRIPTION
reservationId
string

Reservation ID.

reservee
Reservee

Reservee details.

revision
string

Revision number.

Include the existing revision to prevent conflicting updates to reservations.

Returns

Return Type:

Promise<
ReserveReservationResponse
>
NAME
TYPE
DESCRIPTION
reservation
Reservation

Reservation.

Was this helpful?

Reserve a held reservation (frontend)

Copy Code
1import { reservations } from 'wix-table-reservations-v2';
2
3/* Sample reservationId value: "1631633f-ab4b-4302-ab7a-26427bee4d37"
4 *
5 * Sample reservee value: {
6 * "firstName": "John",
7 * "phone": "+972555555555",
8 * "contactId": "e8396cd4-1398-4886-a0ca-82647ff0ccaf"
9 * };
10 *
11 * Sample revision value: 2
12 */
13
14reservations.reserveReservation(reservationId, reservee, revision)
15 .then((reservedReservation) => {
16 const id = reservedReservation._id;
17 const status = reservedReservation.status;
18
19 console.log('Success! Reserved a held reservation:', reservedReservation);
20 return reservedReservation;
21 })
22 .catch((error) => {
23 console.error(error);
24 // Handle the error
25 });
26
27/* Promise resolves to:
28 * {
29 * "reservation": {
30 * "status": "RESERVED",
31 * "source": "UNKNOWN",
32 * "details": {
33 * "reservationLocationId": "fab8cc1f-31cf-462f-b5bb-392594624bf2",
34 * "tableIds": [],
35 * "startDate": "2024-12-09T15:30:00.000Z",
36 * "endDate": "2024-12-09T17:00:00.000Z",
37 * "partySize": 2
38 * },
39 * "revision": "2",
40 * "migrationNotes": [],
41 * "tablesWithReservationConflicts": [],
42 * "_id": "1631633f-ab4b-4302-ab7a-26427bee4d37",
43 * "_createdDate": "2024-01-17T10:20:09.332Z"
44 * }
45 * }
46 */