End-to-End Booking Flows

This guide provides step-by-step examples for creating custom booking flows using the Wix Bookings APIs. These flows cover appointments, class sessions, and courses. You'll also learn how to handle payments using Wix eCommerce or a custom checkout. Use these flows as a starting point to implement tailored booking experiences.

Book an appointment

You can display available time slots for appointment-based services to customers, let them choose a slot, and create the booking.

To book an appointment:

  1. Call Get Site Properties (SDK | REST) and save properties.timeZone.
  2. Call Query Services (SDK | REST) and specify {"type": "APPOINTMENT"} as a filter to retrieve all appointment-based services.
  3. Display all services to the customer and save the ID of the chosen service.
  4. Call Query Availability (SDK | REST) specifying serviceId, timezone, startDate, and endDate as filters.
  5. Display available time slots to the customer and let them select a preferred slot.
  6. Call Create Booking (SDK | REST). Learn more about required parameters and status outcomes (SDK | REST).

To handle payments, refer to the Handle Payments section.

Book a class session

You could display available class sessions to customers, let them choose the session, and create the booking.

To book a class session:

  1. Call Get Site Properties (SDK | REST) to retrieve the timeZone of the business location.
  2. Call Query Services (SDK | REST) and specify {"type": "CLASS"} as a filter to retrieve all classes.
  3. Display all classes to the customer and save the ID of the chosen service.
  4. Call Query Availability (SDK | REST). As filters, specify the serviceId, business timezone, startDate, endDate, and the number of openSpots the customer intends to book.
  5. Display the retrieved class sessions to the customer and let them select their preferred session. Save the eventId from availabilityEntries.slot.eventId for the selected session.
  6. Call Create Booking (SDK | REST). Learn more about required parameters and status outcomes (SDK | REST).

To handle payments, refer to the Handle Payments section.

Book a course

You could display available courses to customers, let them choose a service, and create the booking.

To book a course:

  1. Call Query Services (SDK | REST) and specify {"type": "COURSE"} as a filter to retrieve all courses.
  2. Display all courses to the customer. For the chosen service, save id, defaultCapacity, and schedule.id.
  3. Retrieve all bookings for this service with Query Extended Bookings (SDK | REST) and specify bookedEntity.item.schedule.serviceId as a filter.
  4. Calculate the total number of participants already booked by adding up the attendance.numberOfAttendees from all extended bookings. Then, subtract this total from the service's defaultCapacity to determine the number of remaining spots.
  5. Let the customer choose how many participants to book, ensuring numberOfParticipants doesn't exceed the remaining places.
  6. Call Create Booking (SDK | REST). Learn more about required parameters and status outcomes (SDK | REST).

To handle payments, refer to the Handle Payments section.

Handle payments

Once you've created a booking, you can handle payments using one of the following methods:

  1. Wix eCommerce (SDK | REST): Automates payment handling and order creation.
  2. Custom checkout: Use your own checkout flow to collect payments.

Handle payments with Wix eCommerce

  1. Call Create Checkout (SDK | REST). Make sure to specify the Wix Bookings app ID as catalogReference.appId and the relevant booking ID as catalogReference.catalogItemId. Save the checkout ID and totalAfterGiftCard.amount.
  2. Call Get Checkout URL (SDK | REST) and redirect the customer.
  3. After the customer completes checkout, Wix eCommerce creates an order (SDK | REST) and charges the customer.

Handle payments with a custom checkout

  1. Implement your custom checkout and display the checkout page to the customer.
  2. Once the customer completes the checkout, call Confirm Or Decline Booking (SDK | REST). Set options.paymentStatus to PAID to update the booking status to CONFIRMED.
  3. Call Create Order (SDK | REST) with your custom payment details.
Did this help?
OSZAR »