Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into gal-test
Browse files Browse the repository at this point in the history
  • Loading branch information
wix-docs-feds committed Dec 5, 2022
2 parents 6c5adfe + 63001c8 commit 20b4557
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 60 deletions.
131 changes: 71 additions & 60 deletions wixcode-bookings/wix-bookings.service.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,58 +8,68 @@
"docs":
{ "summary": "The wix-bookings module contains functionality for working with\n bookings from client-side code.",
"description":
[ "Using the Bookings API, you can build a customized bookings experience.",
[ "Using the Bookings API, you can build a customized bookings experience ",
" for customers to book and check out a service.",
"",
" To process bookings on your site, first set up your site to accept bookings",
" as described in [About Wix Bookings](https://support.wix.com/en/article/about-wix-bookings).",
" With the Bookings API, you can:",
" + See the available slots and payment options for a service.",
" + Book a service and process payment. ",
"",
"You must upgrade your site to a [Premium Business Plan](https://support.wix.com/en/article/upgrading-wix-bookings) in order to accept bookings and receive payments.",
" Learn more by reviewing this [sample flow](wix-bookings.html#sample-flow). ",
"",
" ### Typical Booking Lifecycle",
" To use the Bookings API, import `wixBookings` from the `wix-bookings` module:",
"",
" The following list outlines the data flow in a typical booking lifecycle:",
" ```javascript",
" import wixBookings from 'wix-bookings';",
" ```",
"",
" 1. Get a list of services from one of:",
" + A dataset connected to the **Bookings/Services** collection.",
" + A [query](wix-data.html#query) on the **Bookings/Services** collection.",
" 1. A service is selected.",
" 1. Get available slots by calling the [`getServiceAvailability()`](#getServiceAvailability) function",
" using the selected service's **Service ID** (`_id`) value. (Optionally,",
" you can pass a `AvailabilityOptions`",
" object to change the limits on the slots that are returned.)",
" 1. You can match the returned slots to their related staff member items using",
" the **Bookings/Staff** collection.",
" 1. A slot is selected.",
" 1. Gather values for the selected service's form fields, if there are any.",
" The list of form fields is found in the **form** property of the items",
" in the **Bookings/Services** collection.",
" 1. Get the available payment options for the currently logged-in user and",
" the selected service with the",
" [`getCheckoutOptions()`](#getCheckoutOptions) function.",
" 1. A payment option is selected (offline, online, a pricing plan package, or a",
" pricing plan membership).",
" 1. Call the [`checkoutBooking()`](#checkoutBooking) function. Pass the",
" selected slot object, the values for the form fields, and the payment type",
" if necessary. Note, the specified payment type must match the service's",
" configuration in your site's **Dashboard**. You cannot book a paid service",
" as if it were free.",
" ## Before you begin ",
"",
" + If the service is free, you do not need to pass a `paymentOptions`",
" object.",
" + If the service is not free and you pass a `paymentOptions`",
" object indicating the payment should be online, a payment popup is presented",
" for the user to enter payment information, such as credit card information.",
" + If the service is not free and you pass a `paymentOptions`",
" object indicating the payment should be offline, the payment popup is not",
" presented to the user.",
" It's important to note the following points before starting to code: ",
"",
" + You must upgrade your site to a [Premium Business Plan](https://support.wix.com/en/article/upgrading-wix-bookings) in order to accept bookings and receive payments.",
"",
" + To process bookings on your site, first set up your site to accept bookings",
" as described in [About Wix Bookings](https://support.wix.com/en/article/about-wix-bookings).",
"",
" To use the Bookings API, import `wixBookings` from the `wix-bookings` module:",
" ## Terminology",
"",
" ```javascript",
" import wixBookings from 'wix-bookings';",
" ```" ],
" + **Resource**: A business asset like a staff member, a room, ",
" or equipment needed to provide a service.",
" ",
" + **Booking**: Information about an order placed by a customer for a service or ",
" series of services. Includes details about the time, location, participants, and price.",
"",
" + **Service**: A business offering that you can book. For example, ",
" a fitness studio may offer a 1-hour yoga class, a 45 minute HIIT ",
" training session, and a 30 minute 1-on-1 personal training. Wix Bookings ",
" offers 3 types of services: ",
"",
" + [**Appointment**](https://support.wix.com/en/article/creating-the-right-booking-service-for-your-business#appointments): A specific time slot that a customer can book in a calendar.",
"",
" + [**Class**](https://support.wix.com/en/article/creating-the-right-booking-service-for-your-business#classes): A single session or a set of sessions that are offered on specific days and at specific times.",
"",
" + [**Course**](https://support.wix.com/en/article/creating-the-right-booking-service-for-your-business#courses): A multi-session course, or a workshop that starts and ends on a particular day. Customers sign up for the entire course and not one session.",
" ",
" + **Sessions**: A reserved period of time for an appointment, class, ",
" or course, or a period of availability for a resource.",
"",
" + **Schedule**: A collection of sessions and the information needed ",
" to calculate availability. ",
"",
" + **Slot**: An available period of time in a schedule that can be booked ",
" by a customer. While this includes existing sessions that are available ",
" for booking, it can also represent a period of time that can be booked ",
" based on the availability of a resource (for example, a barber with ",
" appointments of 30 minutes each that are open for booking every weekday ",
" between 8:00 - 17:00). These slots are calculated by the constraints of ",
" the schedule.",
"",
" + [**Calendar**](https://support.wix.com/en/article/wix-bookings-about-the-wix-booking-calendar): Where you schedule appointments, classes, and courses.",
"",
" + [**Membership plans with Wix Pricing Plans**](https://support.wix.com/en/article/wix-bookings-about-wix-bookings#selling-membership-plans-and-packages): A prepaid bundle of services, or a membership ",
" including access to certain services. Access a member's pricing plans with APIs by ",
" calling the [`checkoutBooking()`](wix-bookings/checkoutBooking) function." ],
"links": [],
"examples": [],
"extra":
Expand All @@ -84,7 +94,7 @@
[ "wix-bookings.BookingResult" ] },
"doc": "Fulfilled - Results of the booking checkout." },
"locations":
[ { "lineno": 245,
[ { "lineno": 256,
"filename": "bookings.js" } ],
"docs":
{ "summary": "Books a service and processes payment for the service.",
Expand Down Expand Up @@ -298,7 +308,7 @@
[ "wix-bookings.CheckoutOption" ] } ] },
"doc": "Fulfilled - The available payment options for the service and the logged-in user.\nRejected - Checkout payment options error object." },
"locations":
[ { "lineno": 377,
[ { "lineno": 388,
"filename": "bookings.js" } ],
"docs":
{ "summary": "Gets the valid checkout options for a service's slot.",
Expand Down Expand Up @@ -390,7 +400,7 @@
[ "wix-bookings.ServiceAvailability" ] },
"doc": "Fulfilled - A list of available slots.\nRejected - Bookings error object." },
"locations":
[ { "lineno": 311,
[ { "lineno": 322,
"filename": "bookings.js" } ],
"docs":
{ "summary": "Gets the available slots for a specific service.",
Expand Down Expand Up @@ -646,7 +656,8 @@
"messages":
[ { "name": "Address",
"locations":
[ { "lineno": 119,
[ { "lineno": 130,

"filename": "bookings.js" } ],
"docs":
{ "summary": "An object that contains address information.",
Expand Down Expand Up @@ -681,7 +692,7 @@
"labels": [] },
{ "name": "AddressCoordinates",
"locations":
[ { "lineno": 131,
[ { "lineno": 142,
"filename": "bookings.js" } ],
"docs":
{ "summary": "An object that contains the geographic coordinates of the address.",
Expand Down Expand Up @@ -722,7 +733,7 @@
[ "removed" ] },
{ "name": "AvailabilityOptions",
"locations":
[ { "lineno": 61,
[ { "lineno": 72,
"filename": "bookings.js" } ],
"docs":
{ "summary": "An object used when calling [`getServiceAvailability()`](#getServiceAvailability)\n containing options for which slots should be returned.",
Expand Down Expand Up @@ -810,7 +821,7 @@
"labels": [] },
{ "name": "BookingInfo",
"locations":
[ { "lineno": 153,
[ { "lineno": 164,
"filename": "bookings.js" } ],
"docs":
{ "summary": "An object used when calling [`checkoutBooking()`](#checkoutBooking)\n containing information about the slot to be booked.",
Expand Down Expand Up @@ -867,7 +878,7 @@
"labels": [] },
{ "name": "BookingResult",
"locations":
[ { "lineno": 232,
[ { "lineno": 243,
"filename": "bookings.js" } ],
"docs":
{ "summary": "An object representing the result of a call to [`checkoutBooking()`](#checkoutBooking).",
Expand Down Expand Up @@ -922,7 +933,7 @@
"labels": [] },
{ "name": "BusinessLocation",
"locations":
[ { "lineno": 110,
[ { "lineno": 121,
"filename": "bookings.js" } ],
"docs":
{ "summary": "An object describing the business location.",
Expand All @@ -948,7 +959,7 @@
"labels": [] },
{ "name": "CheckoutOption",
"locations":
[ { "lineno": 205,
[ { "lineno": 216,
"filename": "bookings.js" } ],
"docs":
{ "summary": "An object returned after calling [`getCheckoutOptions()`](#getCheckoutOptions)\n containing information about the available payment options for the service and the logged-in user.",
Expand Down Expand Up @@ -1114,7 +1125,7 @@
"labels": [] },
{ "name": "CheckoutOptionOptions",
"locations":
[ { "lineno": 145,
[ { "lineno": 156,
"filename": "bookings.js" } ],
"docs":
{ "summary": "An object used to request checkout options for the service. Currently, you can request the checkout options using the ID of a slot.",
Expand Down Expand Up @@ -1187,7 +1198,7 @@
"labels": [] },
{ "name": "Constraints",
"locations":
[ { "lineno": 164,
[ { "lineno": 175,
"filename": "bookings.js" } ],
"docs":
{ "summary": "An object that defines a booking window for limiting when a member can book a slot. For example,\n you can prevent members from booking a service too far in advance, because perhaps the service might\n be discontinued by then. Or, you can prevent members from booking a service right before it starts, as\n this would make it hard to schedule resources.",
Expand All @@ -1207,7 +1218,7 @@
"labels": [] },
{ "name": "FormField",
"locations":
[ { "lineno": 175,
[ { "lineno": 186,
"filename": "bookings.js" } ],
"docs":
{ "summary": "An object used when calling [`checkoutBooking()`](#checkoutBooking)\n containing values for form fields required to book the session.",
Expand Down Expand Up @@ -1257,7 +1268,7 @@
"labels": [] },
{ "name": "Location",
"locations":
[ { "lineno": 99,
[ { "lineno": 110,
"filename": "bookings.js" } ],
"docs":
{ "summary": "The location where a service is offered.",
Expand All @@ -1280,7 +1291,7 @@
"labels": [] },
{ "name": "PaymentOptions",
"locations":
[ { "lineno": 184,
[ { "lineno": 195,
"filename": "bookings.js" } ],
"docs":
{ "summary": "An object used when calling [`checkoutBooking()`](#checkoutBooking)\n containing information about the payment options.",
Expand Down Expand Up @@ -1408,7 +1419,7 @@
"labels": [] },
{ "name": "ServiceAvailability",
"locations":
[ { "lineno": 73,
[ { "lineno": 84,
"filename": "bookings.js" } ],
"docs":
{ "summary": "An object returned from [`getServiceAvailability()`](#getServiceAvailability)\n containing the available bookings slots.",
Expand Down Expand Up @@ -1484,7 +1495,7 @@
[ "changed" ] },
{ "name": "Slot",
"locations":
[ { "lineno": 83,
[ { "lineno": 94,
"filename": "bookings.js" } ],
"docs":
{ "summary": "An object representing a booking slot.",
Expand Down Expand Up @@ -1583,7 +1594,7 @@
"labels": [] },
{ "name": "StreetAddress",
"locations":
[ { "lineno": 138,
[ { "lineno": 149,
"filename": "bookings.js" } ],
"docs":
{ "summary": "An object representing information about the street name and street number of an address.",
Expand Down
40 changes: 40 additions & 0 deletions wixcode-bookings/wix-bookings/guides/Sample Flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Typical Booking Sample Flow

The following list outlines a sample flow in a typical booking lifecycle:

1. Get a list of services from one of:
+ A dataset connected to the **Bookings/Services** collection.
+ A [query](wix-data.html#query) on the **Bookings/Services** collection.


1. A service is selected.
1. Get available slots by calling the [`getServiceAvailability()`](wix-bookings/getServiceAvailability) function
using the selected service's **Service ID** (`_id`) value. (Optionally,
you can pass a `AvailabilityOptions`
object to change the limits on the slots that are returned.)
1. You can match the returned slots to their related staff member items using
the **Bookings/Staff** collection.
1. A slot is selected.
1. Gather values for the selected service's form fields, if there are any.
The list of form fields is found in the **form** property of the items
in the **Bookings/Services** collection.
1. Get the available payment options for the currently logged-in user and
the selected service with the
[`getCheckoutOptions()`](wix-bookings/getCheckoutOptions) function.
1. A payment option is selected (offline, online, a pricing plan package, or a
pricing plan membership).
1. Call the [`checkoutBooking()`](wix-bookings/checkoutBooking)
function. Pass the
selected slot object, the values for the form fields, and the payment type
if necessary. Note that the specified payment type must match the service's
configuration in your site's **Dashboard**. You cannot book a paid service
as if it were free.

+ If the service is free, you do not need to pass a `paymentOptions`
object.
+ If the service is not free and you pass a `paymentOptions`
object indicating the payment should be online, a payment popup is presented
for the user to enter payment information, such as credit card details.
+ If the service is not free and you pass a `paymentOptions`
object indicating the payment should be offline, the payment popup is not
presented to the user.

0 comments on commit 20b4557

Please sign in to comment.