Search.../

onBookingUpdated( )

An event that fires when a booking's details are updated.

Description

The onBookingUpdated() event handler runs when a booking's details are updated.

The event object includes a trigger property that describes the action that triggered the event. The trigger value for this event is "OWNER_UPDATED_ATTENDANCE" when the business updates the booking's attendance information.

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

Syntax

function onBookingUpdated(event: BookingEvent): void

onBookingUpdated Parameters

NAME
TYPE
DESCRIPTION
event
BookingEvent

Information about an updated booking.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

An event when a booking is updated

Copy Code
1// Place this code in the events.js file
2// of your site's Backend section.
3export function wixBookings_onBookingUpdated(event) {
4 const eventTrigger = event.trigger;
5 const bookingId = event.booking._id;
6}
7
8/* Full event object
9 * {
10 * "trigger": "OWNER_UPDATED_ATTENDANCE",
11 * "booking": {
12 * "_id": "9f5a05d6-2fb4-4de8-990d-12db585d25c5",
13 * "bookedResources": [{
14 * "_id": "6dd5e48d-9e6d-4e74-bf61-e103e8d52575",
15 * "name": "Jane Doe",
16 * "email": "Doe"
17 * }],
18 * "status": "CONFIRMED",
19 * "_createdDate": "2021-02-28T18:11:56.177Z",
20 * "attendanceInfo": {
21 * "attendanceStatus": true,
22 * "numberOfAttendees": 3
23 * },
24 * "bookingSource": {
25 * "platform": "WEB",
26 * "actor": "BUSINESS",
27 * "appDefId": "13d21c63-b5ec-5912-8397-c3a5ddb27a97",
28 * "appName": "Wix Bookings"
29 * },
30 * "bookedEntity": {
31 * "serviceId": "2e80e5e0-2385-49c7-9f9f-2e59a3566809",
32 * "scheduleId": "f1945fde-d567-4ebc-85ef-dd1d52327c11",
33 * "singleSession": {
34 * "sessionId": "2mmoW0vwKcSFyxtOfCdMhFC1gAivXqAQVAQP0hHoOUADs242fBtwKRY3sHLMmbVxJ75TQ4G6BkCe6z1E1fVT6gUPWDDNF4WX2S6P",
35 * "start": "2021-03-18T19:00:00.000Z",
36 * "end": "2021-03-18T20:00:00.000Z"
37 * },
38 * "title": "Appointment service",
39 * "rate": {
40 * "labeledPriceOptions": {
41 * "general": {
42 * "amount": "10",
43 * "currency": "USD",
44 * "downPayAmount": "0"
45 * }
46 * }
47 * },
48 * "tags": ["INDIVIDUAL"],
49 * "location": { "locationType": "OWNER_BUSINESS" }
50 * },
51 * "paymentDetails": {
52 * "balance": {
53 * "finalPrice": {
54 * "amount": "10",
55 * "currency": "USD",
56 * "downPayAmount": "0"
57 * },
58 * "amountReceived": "0"
59 * },
60 * "state": "PENDING_MARK_AS_PAID",
61 * "wixPayMultipleDetails": [{
62 * "txId": "c1cef510-e382-4c1c-aeec-4300cfea219a",
63 * "orderId": "179c361c-8a04-4f78-b28f-065b62cf4806",
64 * "orderAmount": "10",
65 * "paymentVendorName": "inPerson",
66 * "orderApprovalTime": null
67 * }]
68 * },
69 * "formInfo": {
70 * "paymentSelection": [{
71 * "rateLabel": "general",
72 * "numberOfParticipants": 1
73 * }],
74 * "additionalFields": [{
75 * "_id": "00000000-0000-0000-0000-000000000008",
76 * "label": "Add Your Message",
77 * "valueType": "LONG_TEXT"
78 * }],
79 * "contactDetails": {
80 * "contactId": "baf3cd37-c32c-4f01-9e1a-c8ab152af490",
81 * "firstName": "Adam Smith ",
82 * "email": "asmith@amail.com",
83 * "phone": "9998765",
84 * "timeZone": "America/New_York",
85 * "countryCode": "US"
86 * }
87 * }
88 * },
89 * "previousBooking": {
90 * "_id": "9f5a05d6-2fb4-4de8-990d-12db585d25c5",
91 * "bookedResources": [{
92 * "_id": "6dd5e48d-9e6d-4e74-bf61-e103e8d52575",
93 * "name": "Jane Doe",
94 * "email": "Doe"
95 * }],
96 * "status": "CONFIRMED",
97 * "_createdDate": "2021-02-28T18:11:56.177Z",
98 * "attendanceInfo": {
99 * "attendanceStatus": true,
100 * "numberOfAttendees": 1
101 * },
102 * "bookingSource": {
103 * "platform": "WEB",
104 * "actor": "BUSINESS",
105 * "appDefId": "13d21c63-b5ec-5912-8397-c3a5ddb27a97",
106 * "appName": "Wix Bookings"
107 * },
108 * "bookedEntity": {
109 * "serviceId": "2e80e5e0-2385-49c7-9f9f-2e59a3566809",
110 * "scheduleId": "f1945fde-d567-4ebc-85ef-dd1d52327c11",
111 * "singleSession": {
112 * "sessionId": "2mmoW0vwKcSFyxtOfCdMhFC1gAivXqAQVAQP0hHoOUADs242fBtwKRY3sHLMmbVxJ75TQ4G6BkCe6z1E1fVT6gUPWDDNF4WX2S6P",
113 * "start": "2021-03-18T19:00:00.000Z",
114 * "end": "2021-03-18T20:00:00.000Z"
115 * },
116 * "title": "Appointment service",
117 * "rate": {
118 * "labeledPriceOptions": {
119 * "general": {
120 * "amount": "10",
121 * "currency": "USD",
122 * "downPayAmount": "0"
123 * }
124 * }
125 * },
126 * "tags": ["INDIVIDUAL"],
127 * "location": { "locationType": "OWNER_BUSINESS" }
128 * },
129 * "paymentDetails": {
130 * "balance": {
131 * "finalPrice": {
132 * "amount": "10",
133 * "currency": "USD",
134 * "downPayAmount": "0"
135 * },
136 * "amountReceived": "0"
137 * },
138 * "state": "PENDING_MARK_AS_PAID",
139 * "wixPayMultipleDetails": [{
140 * "txId": "c1cef510-e382-4c1c-aeec-4300cfea219a",
141 * "orderId": "179c361c-8a04-4f78-b28f-065b62cf4806",
142 * "orderAmount": "10",
143 * "paymentVendorName": "inPerson",
144 * "orderApprovalTime": null
145 * }]
146 * },
147 * "formInfo": {
148 * "paymentSelection": [{
149 * "rateLabel": "general",
150 * "numberOfParticipants": 1
151 * }],
152 * "additionalFields": [{
153 * "_id": "00000000-0000-0000-0000-000000000008",
154 * "label": "Add Your Message",
155 * "valueType": "LONG_TEXT"
156 * }],
157 * "contactDetails": {
158 * "contactId": "baf3cd37-c32c-4f01-9e1a-c8ab152af490",
159 * "firstName": "Adam Smith ",
160 * "email": "asmith@amail.com",
161 * "phone": "9998765",
162 * "timeZone": "America/New_York",
163 * "countryCode": "US"
164 * }
165 * }
166 * }
167 * }
168 */