Search.../

confirmBooking( )

Developer Preview

Confirms a booking request and changes the booking status to CONFIRMED.

Description

Calling this method doesn't check whether a slot or schedule is still available at this time.

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

For appointment services the slot may become unavailable, depending on the service's policy.bookingApprovalPolicy.requestsAffectsAvailability.

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

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

Bookings are automatically confirmed when the service is configured to automatically confirm bookings and the eCommerce order has been approved. The slot's or schedule's availability is checked just before confirming the booking as part of the automatic flow.

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 confirmBooking(bookingId: string, revision: string, options: ConfirmBookingOptions): Promise<ConfirmBookingResponse>

confirmBooking Parameters

NAME
TYPE
DESCRIPTION
bookingId
string

ID of the booking to confirm.

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
ConfirmBookingOptions

An object representing the available options for canceling a booking.

Returns

Return Type:

Promise<
ConfirmBookingResponse
>
NAME
TYPE
DESCRIPTION
booking
Booking

Was this helpful?

confirmBooking example

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