onBookingCanceled( )


An event that fires when a booking is canceled.

The onBookingCanceled() event handler runs when a booking is canceled.

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

  • "OWNER_CANCELED": The booking was canceled by the business.
  • "MEMBER_CANCELED": The booking was canceled by the member.

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

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

Information about a canceled booking.

An event when a booking is canceled
JavaScript
// Place this code in the events.js file // of your site's Backend section. export function wixBookings_onBookingCanceled(event) { const eventTrigger = event.trigger; const bookingId = event.booking._id; } /* Full event object * { * "trigger": "OWNER_CANCELED", * "booking": { * "id": "23c9c0e1-345e-48e6-8d8f-30fd7249521e", * "bookedResources": [{ * "id": "76570209-101f-409b-af97-b445bdb63125", * "name": "John Smith", * "email": "jsmith@gmail.com" * }], * "status": "CANCELED", * "createdDate": "2021-02-24T10:15:22.485Z", * "bookingSource": { * "platform": "WEB", * "actor": "CUSTOMER", * "appDefId": "13d21c63-b5ec-5912-8397-c3a5ddb27a97", * "appName": "Wix Bookings" * }, * "bookedEntity": { * "serviceId": "b71df756-309f-468e-aec2-f82b9a9a9441", * "scheduleId": "53616b1f-0c3c-45a1-b282-675acd248179", * "singleSession": { * "sessionId":193ZPR9ppP9emJUCLevcLf6orynNEIDt5nc0520xjGQILnPPaF5s62yK3BWz7Ex * gIRM1HunZjEPUQ0IeScwcTFJNXEmLG2g6 * Q8tvUJQZrPhU6XKhVrlLZraC3YcVfygADFiCPyy * y5IVhgtDpF30FnQoG8I60n21QAlhok4LHNlkBszoGZ67jGMeDOqxS8PXZgJx87ByXwfgsN3AfXb * ndYxESrFnttLnRSFzcsolQicMTHTo5lYkhTLLlW8g5lcg1nWBohx2JkDABUO7SXWvqSkQZBmgXo * aZqiD1TBONPzIF84Vryelr1iTTzNl1cc6uJkhqo7DeSwWL", * "start": "2021-03-12T17:30:00Z", * "end": "2021-03-12T18:00:00Z" * }, * "title": "Yoga Class", * "rate": { * "labeledPriceOptions": { * "general": { * "amount": "50", * "currency": "USD", * "downPayAmount": "0" * } * } * }, * "tags": ["GROUP"], * "location": { "locationType": "OWNER_BUSINESS" } * }, * "paymentDetails": { * "balance": { * "finalPrice": { * "amount": "50", * "currency": "USD", * "downPayAmount": "0" * }, * "amountReceived": "0" * }, * "state": "CANCELED", * "wixPayMultipleDetails": [{ * "txId": "76c8f02b-b530-433b-9fb2-ee5e3483418c", * "orderId": "93e44e16-17d1-48de-837c-53ed55132405", * "orderAmount": "50", * "paymentVendorName": "offline" * }] * }, * "formInfo": { * "paymentSelection": [{ * "rateLabel": "general", * "numberOfParticipants": 1 * }], * "additionalFields": [{ * "id": "00000000-0000-0000-0000-000000000008", * "label": "Add Your Message", * "valueType": "LONG_TEXT" * }], * "contactDetails": { * "contactId": "156b86e2-0cee-4586-aac8-f434c919e14c", * "firstName": "Michael White", * "email": "mwhite@gmail.com", * "phone": "555 3456", * "timeZone": "America/New_York", * "countryCode": "US" * } * } * }, * "previousBooking": { * "id": "23c9c0e1-345e-48e6-8d8f-30fd7249521e", * "bookedResources": [{ * "id": "76570209-101f-409b-af97-b445bdb63125", * "name": "John Smith", * "email": "jsmith@gmail.com" * }], * "status": "CONFIRMED", * "createdDate": "2021-02-24T10:15:22.485Z", * "bookingSource": { * "platform": "WEB", * "actor": "CUSTOMER", * "appDefId": "13d21c63-b5ec-5912-8397-c3a5ddb27a97", * "appName": "Wix Bookings" * }, * "bookedEntity": { * "serviceId": "b71df756-309f-468e-aec2-f82b9a9a9441", * "scheduleId": "53616b1f-0c3c-45a1-b282-675acd248179", * "singleSession": { * "sessionId":193ZPR9ppP9emJUCLevcLf6orynNEIDt5nc0520xjGQILnPPaF5s62yK3BWz7Ex * gIRM1HunZjEPUQ0IeScwcTFJNXEmLG2g6 * Q8tvUJQZrPhU6XKhVrlLZraC3YcVfygADFiCPyy * y5IVhgtDpF30FnQoG8I60n21QAlhok4LHNlkBszoGZ67jGMeDOqxS8PXZgJx87ByXwfgsN3AfXb * ndYxESrFnttLnRSFzcsolQicMTHTo5lYkhTLLlW8g5lcg1nWBohx2JkDABUO7SXWvqSkQZBmgXo * aZqiD1TBONPzIF84Vryelr1iTTzNl1cc6uJkhqo7DeSwWL", * "start": "2021-03-12T17:30:00Z", * "end": "2021-03-12T18:00:00Z" * }, * "title": "Yoga Class", * "rate": { * "labeledPriceOptions": { * "general": { * "amount": "50", * "currency": "USD", * "downPayAmount": "0" * } * } * }, * "tags": ["GROUP"], * "location": { "locationType": "OWNER_BUSINESS" } * }, * "paymentDetails": { * "balance": { * "finalPrice": { * "amount": "50", * "currency": "USD", * "downPayAmount": "0" * }, * "amountReceived": "0" * }, * "state": "PENDING_MARK_AS_PAID", * "wixPayMultipleDetails": [{ * "txId": "76c8f02b-b530-433b-9fb2-ee5e3483418c", * "orderId": "93e44e16-17d1-48de-837c-53ed55132405", * "orderAmount": "50", * "paymentVendorName": "offline" * }] * }, * "formInfo": { * "paymentSelection": [{ * "rateLabel": "general", * "numberOfParticipants": 1 * }], * "additionalFields": [{ * "id": "00000000-0000-0000-0000-000000000008", * "label": "Add Your Message", * "valueType": "LONG_TEXT" * }], * "contactDetails": { * "contactId": "156b86e2-0cee-4586-aac8-f434c919e14c", * "firstName": "Michael White", * "email": "mwhite@gmail.com", * "phone": "555 3456", * "timeZone": "America/New_York", * "countryCode": "US" * } * } * } * } */
Errors

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

Did this help?