Search.../

confirmOrDeclineBooking( )

Developer Preview

Use confirmOrDeclineBooking() to determine if the booking is valid, payment is received, and the booking can be processed. Call confirmOrDeclineBooking() after checkout or after calling createBooking() to verify the booking.

Description

  • If a session is valid and payment is received, the booking is visible on the calendar.
  • If a session is double booked, confirmOrDeclineBooking() can catch this and decline the duplicate booking, the booking is not visible on the calendar.
Admin Method

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

Syntax

function confirmOrDeclineBooking(bookingId: string, options: ConfirmOrDeclineBookingOptions): Promise<ConfirmOrDeclineBookingResponse>

confirmOrDeclineBooking Parameters

NAME
TYPE
DESCRIPTION
bookingId
string

ID of the booking to confirm or decline.

options
Optional
ConfirmOrDeclineBookingOptions

Returns

Return Type:

Promise<
ConfirmOrDeclineBookingResponse
>
NAME
TYPE
DESCRIPTION
booking
Booking

Was this helpful?

confirmOrDeclineBooking example

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