getCheckoutOptions( )
Gets the valid checkout options for a service's slot.
Description
The getCheckoutOptions()
function returns a Promise that resolves to the valid checkout options for the given service's slot.
To understand how getCheckoutOptions()
is used in a typical booking lifecycle,
see Typical Booking Lifecycle.
The passed checkoutOptionOptions
object contains the slot ID for the service. Typically, you retrieve the slot ID with the getServiceAvailability()
function.
getCheckoutOptions()
returns the options available for the specified user. For example, if the user has not
purchased any pricing plans, pricing plans are not returned even if there are pricing plans associated with the service.
Authorization
Request
This endpoint does not take any parameters
Response Object
Fulfilled - The available payment options for the service and the logged-in user. Rejected - Checkout payment options error object.
NAME
TYPE
DESCRIPTION
Type of the available payment option. Valid options are:
"wixPay_Online"
for online collections"wixPay_Offline"
for offline collections"package"
for a package-type pricing plan"membership"
for a membership-type pricing plan
Name of the plan package or membership. For booking with pricing plans only.
Order ID of the plan package or membership. For booking with pricing plans only.
ID of the benefit provided by the plan package. For booking with package-type pricing plans only.
Number of sessions remaining in the plan package. For booking with package-type pricing plans only.
Number of sessions initially provided with the plan package. For booking with package-type pricing plans only.
Date by which the plan package or membership expires. For booking with pricing plans only.
Status/Error Codes
Was this helpful?
Get the checkout options for a service that are available to the logged-in user
1import wixBookings from 'wix-bookings';2import wixUsers from 'wix-users';345// ...67let user = wixUsers.currentUser;8let currentUserId = user.id;910// get available slot with `getServiceAvailability()`1112let options = {13 "slotId": slot._id,14 "userId": currentUserId15}1617wixBookings.getCheckoutOptions(options)18 .then((checkoutOptions) => {19 let firstOptionType = checkoutOptions[0].type;20 });2122/* An object containing checkout options:23 * {24 * [25 * {26 * "type":"wixPay_Online"27 * },28 * {29 * "type":"wixPay_Offline"30 * },31 * {32 * "type":"membership",33 * "planName":"Frequent Flier",34 * "planOrderId":"b1a75-...-a236",35 * "planExpiration":"2021-01-08T11:39:29.218Z",36 * "benefitId":"93de9c-...-48e6"37 * },38 * {39 * "type":"package",40 * "planName":"Repeat Customer",41 * "planOrderId":"9551f-...-1b8039",42 * "planExpiration":"2020-07-08T11:39:11.340Z",43 * "benefitId":"8b11cc-...-67a49e",44 * "remainingCredits":58,45 * "totalCredits":6046 * }47 * ]48 * }49 */