Search.../

declineBooking( )

Developer Preview

Declines a PENDING booking request and changes the booking status to DECLINED.

Description

Calling this method also changes the session's participants.approvalStatus to DECLINED.

You can only decline bookings for services that require the owner's manual approval for bookings and that have a status of PENDING.

You can pass a participantNotification.message to notify the customer of the decline. You also need to pass participantNotification.notifyParticipants as true to actually send the message.

This function is not a universal function and runs only on the backend.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

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

declineBooking Parameters

NAME
TYPE
DESCRIPTION
bookingId
string

ID of the booking to decline.

revision
string

Revision number, which increments by 1 each time the booking is updated. To prevent conflicting changes, the current revision must be passed when managing the booking.

options
Optional
DeclineBookingOptions

An object representing the available options for declining a booking.

Returns

Return Type:

Promise<
DeclineBookingResponse
>
NAME
TYPE
DESCRIPTION
booking
Booking

eclined booking

Was this helpful?

declineBooking example

Copy Code
1import { bookings } from 'wix-bookings.v2';
2
3 async function declineBooking(bookingId, revision, options) {
4 try {
5 const result = await bookings.declineBooking(bookingId, revision, options);
6
7 return result;
8 } catch (error) {
9 console.error(error);
10 // Handle the error
11 }
12 }
13