Search.../

declineBooking( )

Declines a pending booking request.

Description

The declineBooking() function returns a Promise that resolves when the specified booking is declined.

A service can be set to "Automatically accept all bookings when staff are available" or "Manually approve or decline booking requests" in the Online Booking Preferences page under "Additional Settings". When set to manual, the business must confirm or decline each request.

When a booking is declined, the following events occur:

  • The booking status changes from PENDING_APPROVAL to DECLINED.
  • The participant status on the session changes to DECLINED.
  • The corresponding session or participant is deleted from the calendar.
  • An email notification is sent to the participant according to the participantNotification properties.

Note: Only users with Bookings Admin permissions can decline a booking. You can override the permissions by setting the suppressAuth options to true.

Syntax

function declineBooking(bookingId: string, options: DeclineBookingOptions): Promise<DeclineBookingResult>

declineBooking Parameters

NAME
TYPE
DESCRIPTION
bookingId
string

ID of the booking to be declined.

options
DeclineBookingOptions

An object representing the available options for declining a booking.

Returns

Return Type:

Promise<DeclineBookingResult>
NAME
TYPE
DESCRIPTION
bookingId
string

ID of the declined booking.

Was this helpful?

Decline a booking request

Copy Code
1import { Permissions, webMethod } from "wix-web-module";
2import { bookings } from "wix-bookings-backend";
3
4export const declineBooking = webMethod(Permissions.Anyone, (bookingId) => {
5 const declineBookingOptions = {
6 participantNotification: {
7 notifyParticipants: true,
8 message: "Sorry, but your booking request has been declined.",
9 },
10 };
11
12 return bookings
13 .declineBooking(bookingId, declineBookingOptions)
14 .then((result) => {
15 return result;
16 })
17 .catch((error) => {
18 return error;
19 });
20});
21
22/* Returns a promise that resolves to:
23 *
24 * {
25 * "bookingId": "001c0674-d7c9-4c77-acb5-b492b427b201"
26 * }
27 */