Search...
onBookingCanceled( )
An event that fires when a booking is canceled.
Description
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.
Syntax
function onBookingCanceled(event: BookingEvent): void
onBookingCanceled Parameters
NAME
TYPE
DESCRIPTION
event
BookingEvent
Information about a canceled booking.
Returns
This function does not return anything.
Return Type:
void
Was this helpful?
An event when a booking is canceled
Copy Code
1// Place this code in the events.js file2// of your site's Backend section.3export function wixBookings_onBookingCanceled(event) {4 const eventTrigger = event.trigger;5 const bookingId = event.booking._id;6}78/* Full event object9 * {10 * "trigger": "OWNER_CANCELED",11 * "booking": {12 * "id": "23c9c0e1-345e-48e6-8d8f-30fd7249521e",13 * "bookedResources": [{14 * "id": "76570209-101f-409b-af97-b445bdb63125",15 * "name": "John Smith",16 * "email": "jsmith@gmail.com"17 * }],18 * "status": "CANCELED",19 * "createdDate": "2021-02-24T10:15:22.485Z",20 * "bookingSource": {21 * "platform": "WEB",22 * "actor": "CUSTOMER",23 * "appDefId": "13d21c63-b5ec-5912-8397-c3a5ddb27a97",24 * "appName": "Wix Bookings"25 * },26 * "bookedEntity": {27 * "serviceId": "b71df756-309f-468e-aec2-f82b9a9a9441",28 * "scheduleId": "53616b1f-0c3c-45a1-b282-675acd248179",29 * "singleSession": {30 * "sessionId":193ZPR9ppP9emJUCLevcLf6orynNEIDt5nc0520xjGQILnPPaF5s62yK3BWz7Ex31 * gIRM1HunZjEPUQ0IeScwcTFJNXEmLG2g6 * Q8tvUJQZrPhU6XKhVrlLZraC3YcVfygADFiCPyy32 * y5IVhgtDpF30FnQoG8I60n21QAlhok4LHNlkBszoGZ67jGMeDOqxS8PXZgJx87ByXwfgsN3AfXb33 * ndYxESrFnttLnRSFzcsolQicMTHTo5lYkhTLLlW8g5lcg1nWBohx2JkDABUO7SXWvqSkQZBmgXo34 * aZqiD1TBONPzIF84Vryelr1iTTzNl1cc6uJkhqo7DeSwWL",35 * "start": "2021-03-12T17:30:00Z",36 * "end": "2021-03-12T18:00:00Z"37 * },38 * "title": "Yoga Class",39 * "rate": {40 * "labeledPriceOptions": {41 * "general": {42 * "amount": "50",43 * "currency": "USD",44 * "downPayAmount": "0"45 * }46 * }47 * },48 * "tags": ["GROUP"],49 * "location": { "locationType": "OWNER_BUSINESS" }50 * },51 * "paymentDetails": {52 * "balance": {53 * "finalPrice": {54 * "amount": "50",55 * "currency": "USD",56 * "downPayAmount": "0"57 * },58 * "amountReceived": "0"59 * },60 * "state": "CANCELED",61 * "wixPayMultipleDetails": [{62 * "txId": "76c8f02b-b530-433b-9fb2-ee5e3483418c",63 * "orderId": "93e44e16-17d1-48de-837c-53ed55132405",64 * "orderAmount": "50",65 * "paymentVendorName": "offline"66 * }]67 * },68 * "formInfo": {69 * "paymentSelection": [{70 * "rateLabel": "general",71 * "numberOfParticipants": 172 * }],73 * "additionalFields": [{74 * "id": "00000000-0000-0000-0000-000000000008",75 * "label": "Add Your Message",76 * "valueType": "LONG_TEXT"77 * }],78 * "contactDetails": {79 * "contactId": "156b86e2-0cee-4586-aac8-f434c919e14c",80 * "firstName": "Michael White",81 * "email": "mwhite@gmail.com",82 * "phone": "555 3456",83 * "timeZone": "America/New_York",84 * "countryCode": "US"85 * }86 * }87 * },88 * "previousBooking": {89 * "id": "23c9c0e1-345e-48e6-8d8f-30fd7249521e",90 * "bookedResources": [{91 * "id": "76570209-101f-409b-af97-b445bdb63125",92 * "name": "John Smith",93 * "email": "jsmith@gmail.com"94 * }],95 * "status": "CONFIRMED",96 * "createdDate": "2021-02-24T10:15:22.485Z",97 * "bookingSource": {98 * "platform": "WEB",99 * "actor": "CUSTOMER",100 * "appDefId": "13d21c63-b5ec-5912-8397-c3a5ddb27a97",101 * "appName": "Wix Bookings"102 * },103 * "bookedEntity": {104 * "serviceId": "b71df756-309f-468e-aec2-f82b9a9a9441",105 * "scheduleId": "53616b1f-0c3c-45a1-b282-675acd248179",106 * "singleSession": {107 * "sessionId":193ZPR9ppP9emJUCLevcLf6orynNEIDt5nc0520xjGQILnPPaF5s62yK3BWz7Ex108 * gIRM1HunZjEPUQ0IeScwcTFJNXEmLG2g6 * Q8tvUJQZrPhU6XKhVrlLZraC3YcVfygADFiCPyy109 * y5IVhgtDpF30FnQoG8I60n21QAlhok4LHNlkBszoGZ67jGMeDOqxS8PXZgJx87ByXwfgsN3AfXb110 * ndYxESrFnttLnRSFzcsolQicMTHTo5lYkhTLLlW8g5lcg1nWBohx2JkDABUO7SXWvqSkQZBmgXo111 * aZqiD1TBONPzIF84Vryelr1iTTzNl1cc6uJkhqo7DeSwWL",112 * "start": "2021-03-12T17:30:00Z",113 * "end": "2021-03-12T18:00:00Z"114 * },115 * "title": "Yoga Class",116 * "rate": {117 * "labeledPriceOptions": {118 * "general": {119 * "amount": "50",120 * "currency": "USD",121 * "downPayAmount": "0"122 * }123 * }124 * },125 * "tags": ["GROUP"],126 * "location": { "locationType": "OWNER_BUSINESS" }127 * },128 * "paymentDetails": {129 * "balance": {130 * "finalPrice": {131 * "amount": "50",132 * "currency": "USD",133 * "downPayAmount": "0"134 * },135 * "amountReceived": "0"136 * },137 * "state": "PENDING_MARK_AS_PAID",138 * "wixPayMultipleDetails": [{139 * "txId": "76c8f02b-b530-433b-9fb2-ee5e3483418c",140 * "orderId": "93e44e16-17d1-48de-837c-53ed55132405",141 * "orderAmount": "50",142 * "paymentVendorName": "offline"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 * "contactDetails": {156 * "contactId": "156b86e2-0cee-4586-aac8-f434c919e14c",157 * "firstName": "Michael White",158 * "email": "mwhite@gmail.com",159 * "phone": "555 3456",160 * "timeZone": "America/New_York",161 * "countryCode": "US"162 * }163 * }164 * }165 * }166 */