onBookingDeclined( )


An event that fires when a booking request is declined.

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.

Method Declaration
Copy
function onBookingDeclined(event: BookingEvent): void;
Method Parameters
eventBookingEventRequired

Information about a declined booking.

An event when a booking request is declined
JavaScript
// Place this code in the events.js file // of your site's Backend section. export function wixBookings_onBookingDeclined(event) { const eventTrigger = event.trigger; const bookingId = event.booking._id; } /* Full event object * { * "trigger": "OWNER_DECLINED_BOOKING_REQUEST", * "booking": { * "_id": "d939f806-bb01-4472-a366-c0e136592531", * "bookedResources": [{ * "id": "dc19d7db-6996-494b-8d6d-943d64e1f32a", * "name": "Tom Jones", * "email": "tom@yoga.com" * }], * "status": "DECLINED", * "createdDate": "2021-02-28T17:32:18.310Z", * "bookingSource": { * "platform": "WEB", * "actor": "CUSTOMER", * "appDefId": "13d21c63-b5ec-5912-8397-c3a5ddb27a97", * "appName": "Wix Bookings" * }, * "bookedEntity": { * "serviceId": "49c7fac5-227c-44d0-a4f3-c1a5c511edf1", * "scheduleId": "4b21a5af-3b69-42ce-a3ba-9cf60d7b4422", * "singleSession": { * "sessionId":"2mmoW0vwKcSFyxtOfCdMkutTlCGjD2Zol12Xf8oBKd3JBbarU * KabZB1NL1R17TsQtpgpCg6eScmLnAtlwEzi7IiungZ45aRewhjR", * "start": "2021-03-05T15:00:00.000Z", * "end": "2021-03-05T16:00:00.000Z" * }, * "title": "Meditation Tutorial", * "rate": { * "labeledPriceOptions": { * "general": { * "amount": "100", * "currency": "USD", * "downPayAmount": "0" * } * } * }, * "tags": ["INDIVIDUAL"], * "location": { * "address": "105 West Street, Apt. 321, New York, New York", * "customAddress": { * "formatted": "105 West Street, Apt. 321, New York, New York" * }, * "locationType": "CUSTOM" * } * }, * "paymentDetails": { * "balance": { * "finalPrice": { * "amount": "100", * "currency": "USD", * "downPayAmount": "0" * }, * "amountReceived": "0" * } * }, * "formInfo": { * "paymentSelection": [{ * "rateLabel": "general", * "numberOfParticipants": 1 * }], * "additionalFields": [{ * "id": "00000000-0000-0000-0000-000000000008", * "label": "Add Your Message", * "valueType": "LONG_TEXT" * }, * { * "id": "1b1ee05f-aa4d-4a9e-9086-aef1d9d98a49", * "label": "Agree to terms", * "valueType": "CHECK_BOX" * }], * "contactDetails": { * "contactId": "53013366-1ff2-419f-ac58-2c82a7a3abdb", * "firstName": "John Walker", * "email": "jw@test.com", * "phone": "5557321", * "timeZone": "America/New_York", * "countryCode": "US", * "address": { * "formatted": "105 West Street, Apt. 321, New York,New York" * } * } * } * }, * "previousBooking": { * "_id": "d939f806-bb01-4472-a366-c0e136592531", * "bookedResources": [{ * "id": "dc19d7db-6996-494b-8d6d-943d64e1f32a", * "name": "Tom Jones", * "email": "tom@yoga.com" * }], * "status": "PENDING_APPROVAL", * "createdDate": "2021-02-28T17:32:18.310Z", * "bookingSource": { * "platform": "WEB", * "actor": "CUSTOMER", * "appDefId": "13d21c63-b5ec-5912-8397-c3a5ddb27a97", * "appName": "Wix Bookings" * }, * "bookedEntity": { * "serviceId": "49c7fac5-227c-44d0-a4f3-c1a5c511edf1", * "scheduleId": "4b21a5af-3b69-42ce-a3ba-9cf60d7b4422", * "singleSession": { * "sessionId":"2mmoW0vwKcSFyxtOfCdMkutTlCGjD2Zol12Xf8oBKd3JBbarU * KabZB1NL1R17TsQtpgpCg6eScmLnAtlwEzi7IiungZ45aRewhjR", * "start": "2021-03-05T15:00:00.000Z", * "end": "2021-03-05T16:00:00.000Z" * }, * "title": "Meditation Tutorial", * "rate": { * "labeledPriceOptions": { * "general": { * "amount": "100", * "currency": "USD", * "downPayAmount": "0" * } * } * }, * "tags": ["INDIVIDUAL"], * "location": { * "address": "105 West Street, Apt. 321, New York, New York", * "customAddress": { * "formatted": "105 West Street, Apt. 321, New York, New York" * }, * "locationType": "CUSTOM" * } * }, * "paymentDetails": { * "balance": { * "finalPrice": { * "amount": "100", * "currency": "USD", * "downPayAmount": "0" * }, * "amountReceived": "0" * } * }, * "formInfo": { * "paymentSelection": [{ * "rateLabel": "general", * "numberOfParticipants": 1 * }], * "additionalFields": [{ * "id": "00000000-0000-0000-0000-000000000008", * "label": "Add Your Message", * "valueType": "LONG_TEXT" * }, * { * "id": "1b1ee05f-aa4d-4a9e-9086-aef1d9d98a49", * "label": "Agree to terms", * "valueType": "CHECK_BOX" * }], * "contactDetails": { * "contactId": "53013366-1ff2-419f-ac58-2c82a7a3abdb", * "firstName": "John Walker", * "email": "jw@test.com", * "phone": "5557321", * "timeZone": "America/New_York", * "countryCode": "US", * "address": { * "formatted": "105 West Street, Apt. 321, New York, New York" * } * } * } * } * } */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?