An event that fires when a booking request is confirmed.
The onBookingConfirmed()
event handler runs when a new booking request is confirmed.
The event
object includes a trigger
property that describes the action that triggered the event.
The trigger
value is one of:
"BOOKING_AUTO_CONFIRMED"
: A new booking was made for a service that is configured for automatic confirmation."OWNER_CONFIRMED_BOOKING_REQUEST"
: A booking was confirmed by the business."OWNER_BOOKED"
: The owner made a booking directly from the calendar.Note: Backend events don't work when previewing your site.
function onBookingConfirmed(event: BookingEvent): void;
Information about a confirmed booking.
// Place this code in the events.js file
// of your site's Backend section.
export function wixBookings_onBookingConfirmed(event) {
const eventTrigger = event.trigger;
const bookingId = event.booking._id;
}
/* Full event object
* {
* "trigger": "BOOKING_AUTO_CONFIRMED",
* "booking": {
* "_id": "99a406e7-cbce-4765-a4cd-ff0d2d9fb8c2",
* "bookedResources": [
* {
* "id": "5fe118a5-d4b2-464e-9334-268be4422908",
* "name": "Sam Slade",
* "email": "sams@gmail.com"
* }
* ],
* "status": "CONFIRMED",
* "createdDate": "2021-02-23T16:47:36.403Z",
* "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": * "193ZPR9ppP9emJUCLevcLf6orynNEIDt5nc0520xjGQILnPPaF5s62yK3BWz7ExgIRM1HunZjEPUQ0IeScwcTFJNXEmLG2g6Q8tvUJQZrPhU6XKhVrlLZraC3YcVfygADF * iCPyyy5IVhgtDpF30FnPznyrtkyH5fPewLT28aPO3bYaUZcXnNWumH3AaEAb8eyvUVbvkBxGSsv9RZXCgcMTjnhXUNwTBUGGxULnv2i5O933JqU3MACfQ6DUFaws9ufRJUc * RZwhmKpRIwWNmd0NtCD7ZlKaLkhu41yYjkZ4Z7YnqdBStzobnKjwbPbzPbVw4rXF8n47h8MTF",
* "start": "2021-02-25T23:30:00Z",
* "end": "2021-02-26T00:30: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": "f86bdab0-bd12-4128-85cd-e24f82dc38b8",
* "orderId": "5e65776f-ac54-4dc7-b94e-f2b887ba06e3",
* "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": "eef94a55-8309-4927-ab6f-d91711e5484a",
* "firstName": "Andrew Brown",
* "email": "abrown@gmail.com",
* "phone": "555 3456",
* "timeZone": "America/New_York",
* "countryCode": "US"
* }
* }
* },
* "previousBooking": {
* "bookedEntity": {
* "location": { }
* },
* "paymentDetails": { },
* "formInfo": {
* "contactDetails": { }
* }
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.