This article provides sample flows focusing on the technical details of creating appointment, class session, and course bookings using Create Booking. It also shows how to create and reschedule multi-service bookings. For a complete step-by-step overview of the full booking process (including service selection, availability checks, and payment), see End-to-End Booking Flows.
To create a booking for an appointment:
serviceId, timeZone, fromLocalDate, and toLocalDate as filters. Save the relevant time slot details.localStartDate and localEndDate.startDate, endDate, resource and location in booking.bookedEntity.slot. If the slot's availability hasn't changed since calling List Availability Time Slots, the call succeeds and the status of the booking is CREATED.To create a booking for a class session:
serviceId, timeZone, fromLocalDate, toLocalDate, and the number of openSpots the customer intends to book as filters. Save the eventId from the selected time slot.eventId to get detailed information about the class session.booking.bookedEntity.slot.eventId.
If the class session's availability hasn't changed since calling List Event Time Slots, the call succeeds and the status of the booking is CREATED.To create a booking for a course:
numberOfParticipants doesn't exceed the remaining places.booking.bookedEntity.scheduleId. If the course's availability hasn't changed since calling Query Extended Bookings, the call succeeds and the status of the booking is CREATED.Important:
Calling Create Booking can fail if the service is no longer available.
To ensure success, for example if you want to create a booking on behalf of the business owner, call Create Booking with options.flowControlSettings.skipAvailabilityValidation set to true.
Using other flowControlSettings lets you override the maximum number of participants per session, or allow payment methods that aren't supported for the service.
To create a multi-service booking (for example, a spa package with massage, facial, and manicure):
services with serviceId for each service, fromLocalDate, toLocalDate, timeZone, and location with locationType.bookings (minimum 2, maximum 8) and multiServiceBookingType set to SEQUENTIAL_BOOKINGS. You must specify individual slot timing for each service with no gaps between bookings. If availability hasn't changed, the call succeeds and each single-service booking has a status of CREATED.To reschedule a multi-service booking and then add an additional single-service booking (for example, moving a spa package to a different time and adding a pedicure that couldn't be scheduled at the original end time):
scheduleId, startDate, endDate, resource, and location).
For example, as described in the single-service appointment end-to-end booking flow.services with serviceId for each service, fromLocalDate, toLocalDate, timeZone, and location with locationType to verify availability for the new timing, ensuring all services can still be scheduled sequentially.localStartDate and localEndDate values from the selected slot.rescheduleBookingsInfo. For each single-service booking to reschedule, include the bookingId, current revision number, and new slot details with exact timing to maintain sequential scheduling with all services back-to-back and no gaps or overlaps.multiServiceBookingId and an array of bookings containing the bookingId and revision number.
The existing timing of the added booking must be compatible with the multi-service booking's sequential schedule for successful integration.Once you've created a booking, handle payments using Wix eCommerce or your own custom checkout flow. For step-by-step instructions for payment processing, see the End-to-End Booking Flows article.
When scheduling conflicts occur and a booking's doubleBooked flag is set to true, you can follow this flow to resolve the conflict and handle necessary refunds.
To detect and resolve double booking conflicts:
Detect conflicts by listening for these events:
booking.doubleBooked is true.booking.doubleBooked is true.Important:
Only start conflict resolution for events where booking.flowControlSettings.skipAvailabilityValidation is false or undefined. Events with skipAvailabilityValidation: true indicate that force resolution was already applied, so processing them again would create an infinite loop.
Determine resolution options by calling Bulk Calculate Allowed Actions, specifying the relevant booking ID.
If both cancel and reschedule flags are false, standard resolution isn't available and you'll need to force resolution.
Choose a resolution approach:
Notify the customer and business about the conflict resolution.
Move an appointment or class booking to a different available time slot that works for the customer. Course bookings can't be rescheduled.
PENDING and used a custom checkout, call Confirm Or Decline Booking to finalize the booking status after rescheduling.Cancel the conflicted booking and process any necessary refunds.
withRefund: true to ensure customers receive refunds for pricing plans payments since the conflict wasn't their fault.waiveCancellationFee: true to waive the cancellation fee as the customer shouldn't be penalized for a booking conflict.Override availability validation to confirm or decline the booking when standard options aren't available. Force resolution options differ significantly between checkout types:
slot and flowControlSettings: { skipAvailabilityValidation: true }.
If the service requires manual approval, also specify skipBusinessConfirmation: true.withRefund: true instead of force declining. Use ignoreCancellationPolicy: true if you need to override timing restrictions.status to REFUNDED.flowControlSettings: { skipAvailabilityValidation: true } to confirm regardless of conflicts.REFUNDED.