Search.../

onBookingConfirmed( )

An event that fires when a booking request is confirmed.

Description

The onBookingConfirmed() event handler runs when a new booking request is confirmed.

The event object includes a trigger property that describes the action that triggered the event. The trigger value is one of:

  • "BOOKING_AUTO_CONFIRMED": A new booking was made for a service that is configured for automatic confirmation.
  • "OWNER_CONFIRMED_BOOKING_REQUEST": A booking was confirmed by the business.
  • "OWNER_BOOKED": The owner made a booking directly from the calendar.

Note: Backend events don't work when previewing your site.

Syntax

function onBookingConfirmed(event: BookingEvent): void

onBookingConfirmed Parameters

NAME
TYPE
DESCRIPTION
event
BookingEvent

Information about a confirmed booking.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

An event when a booking is confirmed

Copy Code
1// Place this code in the events.js file
2// of your site's Backend section.
3export function wixBookings_onBookingConfirmed(event) {
4 const eventTrigger = event.trigger;
5 const bookingId = event.booking._id;
6}
7
8/* Full event object
9 * {
10 * "trigger": "BOOKING_AUTO_CONFIRMED",
11 * "booking": {
12 * "_id": "99a406e7-cbce-4765-a4cd-ff0d2d9fb8c2",
13 * "bookedResources": [
14 * {
15 * "id": "5fe118a5-d4b2-464e-9334-268be4422908",
16 * "name": "Sam Slade",
17 * "email": "sams@gmail.com"
18 * }
19 * ],
20 * "status": "CONFIRMED",
21 * "createdDate": "2021-02-23T16:47:36.403Z",
22 * "bookingSource": {
23 * "platform": "WEB",
24 * "actor": "CUSTOMER",
25 * "appDefId": "13d21c63-b5ec-5912-8397-c3a5ddb27a97",
26 * "appName": "Wix Bookings"
27 * },
28 * "bookedEntity": {
29 * "serviceId": "b71df756-309f-468e-aec2-f82b9a9a9441",
30 * "scheduleId": "53616b1f-0c3c-45a1-b282-675acd248179",
31 * "singleSession": {
32 * "sessionId": * "193ZPR9ppP9emJUCLevcLf6orynNEIDt5nc0520xjGQILnPPaF5s62yK3BWz7ExgIRM1HunZjEPUQ0IeScwcTFJNXEmLG2g6Q8tvUJQZrPhU6XKhVrlLZraC3YcVfygADF * iCPyyy5IVhgtDpF30FnPznyrtkyH5fPewLT28aPO3bYaUZcXnNWumH3AaEAb8eyvUVbvkBxGSsv9RZXCgcMTjnhXUNwTBUGGxULnv2i5O933JqU3MACfQ6DUFaws9ufRJUc * RZwhmKpRIwWNmd0NtCD7ZlKaLkhu41yYjkZ4Z7YnqdBStzobnKjwbPbzPbVw4rXF8n47h8MTF",
33 * "start": "2021-02-25T23:30:00Z",
34 * "end": "2021-02-26T00:30:00Z"
35 * },
36 * "title": "Yoga Class",
37 * "rate": {
38 * "labeledPriceOptions": {
39 * "general": {
40 * "amount": "50",
41 * "currency": "USD",
42 * "downPayAmount": "0"
43 * }
44 * }
45 * },
46 * "tags": [
47 * "GROUP"
48 * ],
49 * "location": {
50 * "locationType": "OWNER_BUSINESS"
51 * }
52 * },
53 * "paymentDetails": {
54 * "balance": {
55 * "finalPrice": {
56 * "amount": "50",
57 * "currency": "USD",
58 * "downPayAmount": "0"
59 * },
60 * "amountReceived": "0"
61 * },
62 * "state": "PENDING_MARK_AS_PAID",
63 * "wixPayMultipleDetails": [
64 * {
65 * "txId": "f86bdab0-bd12-4128-85cd-e24f82dc38b8",
66 * "orderId": "5e65776f-ac54-4dc7-b94e-f2b887ba06e3",
67 * "orderAmount": "50",
68 * "paymentVendorName": "offline"
69 * }
70 * ]
71 * },
72 * "formInfo": {
73 * "paymentSelection": [
74 * {
75 * "rateLabel": "general",
76 * "numberOfParticipants": 1
77 * }
78 * ],
79 * "additionalFields": [
80 * {
81 * "id": "00000000-0000-0000-0000-000000000008",
82 * "label": "Add Your Message",
83 * "valueType": "LONG_TEXT"
84 * }
85 * ],
86 * "contactDetails": {
87 * "contactId": "eef94a55-8309-4927-ab6f-d91711e5484a",
88 * "firstName": "Andrew Brown",
89 * "email": "abrown@gmail.com",
90 * "phone": "555 3456",
91 * "timeZone": "America/New_York",
92 * "countryCode": "US"
93 * }
94 * }
95 * },
96 * "previousBooking": {
97 * "bookedEntity": {
98 * "location": { }
99 * },
100 * "paymentDetails": { },
101 * "formInfo": {
102 * "contactDetails": { }
103 * }
104 * }
105 * }
106 */