This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Cancels a reservation.
Sets the reservation status to CANCELED
.
function cancelReservation(
reservationId: string,
revision: string,
options: CancelReservationOptions,
): Promise<CancelReservationResponse>;
Reservation ID.
Revision number.
Include the existing revision
to prevent conflicting updates to reservations.
Options for canceling the reservation.
import { reservations } from "wix-table-reservations.v2";
/* Sample reservationId value: "36b144c4-9cb5-4c92-96c1-5027301cac05"
* Sample revision value: 1
*/
reservations
.cancelReservation(reservationId, revision)
.then((canceledReservation) => {
const updatedRevision = canceledReservation.revision;
const status = canceledReservation.status;
console.log("Success! Canceled the reservation:", canceledReservation);
return canceledReservation;
})
.catch((error) => {
console.error(error);
// Handle the error
});
/* Promise resolves to:
* {
* "reservation": {
* "status": "CANCELED",
* "source": "UNKNOWN",
* "details": {
* "reservationLocationId": "fab8cc1f-31cf-462f-b5bb-392594624bf2",
* "tableIds": [],
* "startDate": "2024-12-06T14:30:00.000Z",
* "endDate": "2024-12-06T16:00:00.000Z",
* "partySize": 2
* },
* "revision": "2",
* "migrationNotes": [],
* "tablesWithReservationConflicts": [],
* "_id": "36b144c4-9cb5-4c92-96c1-5027301cac05",
* "_createdDate": "2024-01-22T11:20:02.781Z"
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.