cancelReservation( )


Developer Preview

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.

Permissions
Manage Reservations (Basic)
Manage Reservations (Full)
Manage Reservations (Medium)
Manage Restaurants - all permissions
Learn more about app permissions.
Method Declaration
Copy
function cancelReservation(
  reservationId: string,
  revision: string,
  options: CancelReservationOptions,
): Promise<CancelReservationResponse>;
Method Parameters
reservationIdstringRequired

Reservation ID.


revisionstringRequired

Revision number.

Specify the existing revision to prevent conflicting updates to reservations.


optionsCancelReservationOptions

Options for canceling the reservation.

Returns
Return Type:Promise<CancelReservationResponse>
JavaScript
import { reservations } from "@wix/table-reservations"; /* * Sample reservationId value: "36b144c4-9cb5-4c92-96c1-5027301cac05" * Sample revision value: "1" */ reservations .cancelReservation(reservationId, revision) .then((canceledReservation) => { const updatedRevision = canceledReservation.reservation.revision; const status = canceledReservation.reservation.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" * } * } */
Errors
428Failed Precondition

There are 2 errors with this status code.

This method may also return standard errors. Learn more about standard Wix errors.

Did this help?