Search...
onBookingDeclined( )
An event that fires when a booking request is declined.
Description
The onBookingDeclined()
event handler runs when a booking request is declined by the business.
The event
object includes a trigger
property that describes the action that triggered the event. The trigger
value for this event is "OWNER_DECLINED_BOOKING_REQUEST"
.
Note: Backend events don't work when previewing your site.
Syntax
function onBookingDeclined(event: BookingEvent): void
onBookingDeclined Parameters
NAME
TYPE
DESCRIPTION
event
BookingEvent
Information about a declined booking.
Returns
This function does not return anything.
Return Type:
void
Was this helpful?
An event when a booking request is declined
Copy Code
1// Place this code in the events.js file2// of your site's Backend section.3export function wixBookings_onBookingDeclined(event) {4 const eventTrigger = event.trigger;5 const bookingId = event.booking._id;6}78/* Full event object9 * {10 * "trigger": "OWNER_DECLINED_BOOKING_REQUEST",11 * "booking": {12 * "_id": "d939f806-bb01-4472-a366-c0e136592531",13 * "bookedResources": [{14 * "id": "dc19d7db-6996-494b-8d6d-943d64e1f32a",15 * "name": "Tom Jones",16 * "email": "tom@yoga.com"17 * }],18 * "status": "DECLINED",19 * "createdDate": "2021-02-28T17:32:18.310Z",20 * "bookingSource": {21 * "platform": "WEB",22 * "actor": "CUSTOMER",23 * "appDefId": "13d21c63-b5ec-5912-8397-c3a5ddb27a97",24 * "appName": "Wix Bookings"25 * },26 * "bookedEntity": {27 * "serviceId": "49c7fac5-227c-44d0-a4f3-c1a5c511edf1",28 * "scheduleId": "4b21a5af-3b69-42ce-a3ba-9cf60d7b4422",29 * "singleSession": {30 * "sessionId":"2mmoW0vwKcSFyxtOfCdMkutTlCGjD2Zol12Xf8oBKd3JBbarU31 * KabZB1NL1R17TsQtpgpCg6eScmLnAtlwEzi7IiungZ45aRewhjR",32 * "start": "2021-03-05T15:00:00.000Z",33 * "end": "2021-03-05T16:00:00.000Z"34 * },35 * "title": "Meditation Tutorial",36 * "rate": {37 * "labeledPriceOptions": {38 * "general": {39 * "amount": "100",40 * "currency": "USD",41 * "downPayAmount": "0"42 * }43 * }44 * },45 * "tags": ["INDIVIDUAL"],46 * "location": {47 * "address": "105 West Street, Apt. 321, New York, New York",48 * "customAddress": {49 * "formatted": "105 West Street, Apt. 321, New York, New York"50 * },51 * "locationType": "CUSTOM"52 * }53 * },54 * "paymentDetails": {55 * "balance": {56 * "finalPrice": {57 * "amount": "100",58 * "currency": "USD",59 * "downPayAmount": "0"60 * },61 * "amountReceived": "0"62 * }63 * },64 * "formInfo": {65 * "paymentSelection": [{66 * "rateLabel": "general",67 * "numberOfParticipants": 168 * }],69 * "additionalFields": [{70 * "id": "00000000-0000-0000-0000-000000000008",71 * "label": "Add Your Message",72 * "valueType": "LONG_TEXT"73 * },74 * {75 * "id": "1b1ee05f-aa4d-4a9e-9086-aef1d9d98a49",76 * "label": "Agree to terms",77 * "valueType": "CHECK_BOX"78 * }],79 * "contactDetails": {80 * "contactId": "53013366-1ff2-419f-ac58-2c82a7a3abdb",81 * "firstName": "John Walker",82 * "email": "jw@test.com",83 * "phone": "5557321",84 * "timeZone": "America/New_York",85 * "countryCode": "US",86 * "address": {87 * "formatted": "105 West Street, Apt. 321, New York,New York"88 * }89 * }90 * }91 * },92 * "previousBooking": {93 * "_id": "d939f806-bb01-4472-a366-c0e136592531",94 * "bookedResources": [{95 * "id": "dc19d7db-6996-494b-8d6d-943d64e1f32a",96 * "name": "Tom Jones",97 * "email": "tom@yoga.com"98 * }],99 * "status": "PENDING_APPROVAL",100 * "createdDate": "2021-02-28T17:32:18.310Z",101 * "bookingSource": {102 * "platform": "WEB",103 * "actor": "CUSTOMER",104 * "appDefId": "13d21c63-b5ec-5912-8397-c3a5ddb27a97",105 * "appName": "Wix Bookings"106 * },107 * "bookedEntity": {108 * "serviceId": "49c7fac5-227c-44d0-a4f3-c1a5c511edf1",109 * "scheduleId": "4b21a5af-3b69-42ce-a3ba-9cf60d7b4422",110 * "singleSession": {111 * "sessionId":"2mmoW0vwKcSFyxtOfCdMkutTlCGjD2Zol12Xf8oBKd3JBbarU112 * KabZB1NL1R17TsQtpgpCg6eScmLnAtlwEzi7IiungZ45aRewhjR",113 * "start": "2021-03-05T15:00:00.000Z",114 * "end": "2021-03-05T16:00:00.000Z"115 * },116 * "title": "Meditation Tutorial",117 * "rate": {118 * "labeledPriceOptions": {119 * "general": {120 * "amount": "100",121 * "currency": "USD",122 * "downPayAmount": "0"123 * }124 * }125 * },126 * "tags": ["INDIVIDUAL"],127 * "location": {128 * "address": "105 West Street, Apt. 321, New York, New York",129 * "customAddress": {130 * "formatted": "105 West Street, Apt. 321, New York, New York"131 * },132 * "locationType": "CUSTOM"133 * }134 * },135 * "paymentDetails": {136 * "balance": {137 * "finalPrice": {138 * "amount": "100",139 * "currency": "USD",140 * "downPayAmount": "0"141 * },142 * "amountReceived": "0"143 * }144 * },145 * "formInfo": {146 * "paymentSelection": [{147 * "rateLabel": "general",148 * "numberOfParticipants": 1149 * }],150 * "additionalFields": [{151 * "id": "00000000-0000-0000-0000-000000000008",152 * "label": "Add Your Message",153 * "valueType": "LONG_TEXT"154 * },155 * {156 * "id": "1b1ee05f-aa4d-4a9e-9086-aef1d9d98a49",157 * "label": "Agree to terms",158 * "valueType": "CHECK_BOX"159 * }],160 * "contactDetails": {161 * "contactId": "53013366-1ff2-419f-ac58-2c82a7a3abdb",162 * "firstName": "John Walker",163 * "email": "jw@test.com",164 * "phone": "5557321",165 * "timeZone": "America/New_York",166 * "countryCode": "US",167 * "address": {168 * "formatted": "105 West Street, Apt. 321, New York, New York"169 * }170 * }171 * }172 * }173 * }174 */