This guide provides sample flows focusing on the technical details of creating appointment, class session, and course bookings using Create Booking (SDK | REST). 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 (SDK | REST).
To create a booking for an appointment:
serviceId
, timezone
, startDate
, and endDate
as filters. Save the relevant availabilityEntries.slot
.startDate
, endDate
, resource
and location
in booking.bookedEntity.slot
. If the slot's availability hasn't changed since calling Query Availability, the call succeeds and the status of the booking is CREATED
.To create a booking for a class session:
serviceId
, timezone
, startDate
, endDate
, and the number of openSpots
the customer intends to book as filters.
Save the eventId
from availabilityEntries.slot.eventId
for the selected session.booking.bookedEntity.slot.eventId
.
If the class session's availability hasn't changed since calling Query Availability, 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 (SDK | REST) 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.
Once you've created a booking, handle payments using Wix eCommerce (SDK | REST) or your own custom checkout flow. For step-by-step instructions for payment processing, see the Sample Booking Flows article (SDK | REST).