This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Creates a new temporary reservation and holds it for the customer for 10 minutes.
Creates a new reservation with the HELD
status. HELD
reservations 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 change a HELD
reservation’s status after 10 minutes returns an error.
You cannot call updateReservation()
to change a reservation’s status from HELD
. Trying to do so returns an error. Instead, you should use reserveReservation()
.
If you do not wish to have HELD
reservations in your flow, you can create a reservation with all required details using createReservation()
.
function createHeldReservation(
reservationDetails: HeldReservationDetails,
): Promise<CreateHeldReservationResponse>;
Held reservation information to update.
import { reservations } from "wix-table-reservations.v2";
/* Sample reservationDetails value:
* {
* "reservationLocationId": "fab8cc1f-31cf-462f-b5bb-392594624bf2",
* "startDate": new Date("2024-12-14T15:30:00Z"),
* "partySize": 2
* }
*/
reservations
.createHeldReservation(reservationDetails)
.then((createdHeldReservation) => {
const id = createdHeldReservation._id;
const status = createdHeldReservation.status;
console.log("Success! Created a held reservation:", createdHeldReservation);
return createdHeldReservation;
})
.catch((error) => {
console.error(error);
// Handle the error
});
/* Promise resolves to:
* {
* "reservation": {
* "status": "HELD",
* "source": "UNKNOWN",
* "details": {
* "reservationLocationId": "fab8cc1f-31cf-462f-b5bb-392594624bf2",
* "tableIds": [],
* "startDate": "2024-12-14T15:30:00.000Z",
* "endDate": "2024-12-14T17:00:00.000Z",
* "partySize": 2
* },
* "revision": "1",
* "migrationNotes": [],
* "tablesWithReservationConflicts": [],
* "_id": "26bf7609-8bf4-45ac-aef0-dbb3e54f69ad",
* "_createdDate": "2024-01-17T10:07:56.966Z"
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.