Sample Flows

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.

Book an appointment

To create a booking for an appointment:

  1. Identify the business time zone and relevant service ID. For example, as described in End-to-End Booking Flows.
  2. Call List Availability Time Slots specifying serviceId, timeZone, fromLocalDate, and toLocalDate as filters. Save the relevant time slot details.
  3. To obtain the selected slot's full capacity and booking-policy status, call Get Availability Time Slot. Specify the selected slot's localStartDate and localEndDate.
  4. Call Create Booking. Specify the slot's 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.

Book a class session

To create a booking for a class session:

  1. Identify the business time zone and relevant service ID. For example, as described in End-to-End Booking Flows.
  2. Call List Event Time Slots specifying serviceId, timeZone, fromLocalDate, toLocalDate, and the number of openSpots the customer intends to book as filters. Save the eventId from the selected time slot.
  3. To obtain the selected slot's full capacity and booking-policy status, call Get Event Time Slot. Specify eventId to get detailed information about the class session.
  4. Call Create Booking specifying the event ID in 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.

Book a course

To create a booking for a course:

  1. Identify the relevant business time zone, service ID, service default capacity, and service schedule ID. For example, as described in End-to-End Booking Flows.
  2. Retrieve all bookings for this service with Query Extended Bookings and calculate how many people are already booked for the course.
  3. Make sure the intended numberOfParticipants doesn't exceed the remaining places.
  4. Call Create Booking specifying the relevant schedule ID as 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.

Create a multi-service booking

To create a multi-service booking (for example, a spa package with massage, facial, and manicure):

  1. Identify the business time zone and relevant service IDs for each service in the package. For example, as described in the single-service appointment end-to-end booking flow.
  2. Call List Multi Service Availability Time Slots specifying services with serviceId for each service, fromLocalDate, toLocalDate, timeZone, and location with locationType.
  3. Call Create Multi Service Booking with an array of 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.

Reschedule a multi-service booking and add a single-service booking

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):

  1. Call Get Multi Service Booking to retrieve the current multi-service booking details, including all single-service booking IDs and their current revision numbers.
  2. For each service you want to reschedule, identify the new slot details (scheduleId, startDate, endDate, resource, and location). For example, as described in the single-service appointment end-to-end booking flow.
  3. Call List Multi Service Availability Time Slots specifying 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.
  4. To obtain the selected multi-service slot's full capacity and booking-policy status, call Get Multi Service Availability Time Slot. Specify the exact localStartDate and localEndDate values from the selected slot.
  5. Call Reschedule Multi Service Booking specifying the ID of the multi-service booking and an array of 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.
  6. Make sure you have an independent single-service booking to add to the package. For example, by following the single-service appointment end-to-end booking flow. Ensure the booking timing is compatible with the multi-service booking's sequential schedule and the booking has a compatible status.
  7. Call Add Bookings to Multi Service Booking specifying the 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.

Handle payments

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.

Did this help?