Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Node<Graph.Cart>
    • Cart

Index

Properties

advanceGratuity

advanceGratuity: CartAdvanceGratuity

Optional gratuity defined in advance for bookable items.

bookingQuestions

bookingQuestions: CartBookingQuestion[]

clientInformation

clientInformation: CartClientInformation

Optional client information supplied when checking out on behalf of someone else than the current user.

clientMessage

clientMessage: string

Optional message from the client to the business.

completedAt

completedAt: any

Timestamp of when the cart was completed.

This field cannot be edited and once completed cannot be changed.

endTime

endTime: any

When the cart has reserved bookable items, the end time of the latest item. This value is null when there are no reservations.

errors

errors: CartError[]

Current validation errors.

expiresAt

expiresAt: any

When the cart has reserved bookable items, the timestamp when reservations (e.g. service time selections) expire and need to be selected again. This value is null when there are no reservations and is reset into the future whenever a new reservation is added.

id

id: string

The ID of an object

insertedAt

insertedAt: any

Timestamp when the cart was created.

startTime

startTime: any

When the cart has reserved bookable items, the starting time of the earliest item. This value is null when there are no reservations.

summary

summary: CartSummary

Summary of the cart, including e.g. line item totals.

updatedAt

updatedAt: any

Timestamp when the cart was last updated.

Appointments Methods

addAppointmentTags

  • addAppointmentTags(appointmentId: string, tagIds: string[]): Promise<Map<string, Boolean>>
  • Adds tags to the appointment booked within a cart.

    async

    Parameters

    • appointmentId: string
    • tagIds: string[]

    Returns Promise<Map<string, Boolean>>

    A map with a Boolean success key or an error if one of the tags doesn't exist.

Bookable Items Methods

addBookableItem

  • Add a bookable item to a cart

    async

    Parameters

    • item: CartAvailableBookableItem

      The bookable item

    • Optional opts: { discountCode?: string; guest?: CartGuest; options?: CartAvailableBookableItemOption[]; staffVariant?: CartAvailableBookableItemStaffVariant }
      • Optional discountCode?: string

        Optional discount code applied to the item. Invalid discount codes are ignored without an error, check discountCode on the selected item to see if the code was valid.

      • Optional guest?: CartGuest

        The guest this item is booked for. A null value indicates the cart owner, or current client. When finding available times for bookable items, it's assumed that two items having different guests can be booked simultaneously.

      • Optional options?: CartAvailableBookableItemOption[]

        Selected bookable item options. Note that the selections must conform to the option group requirements, e.g. limits on the number of options. Otherwise an error is returned.

      • Optional staffVariant?: CartAvailableBookableItemStaffVariant

        The selected bookable item staff variant.

    Returns Promise<Cart>

    Promise containing the updated cart

getBookableDates

  • getBookableDates(opts?: { limit?: number; location?: Location; searchRangeLower?: any; searchRangeUpper?: any; timezone?: string }): Promise<CartBookableDate[]>
  • Retrieves available dates for all bookable cart items.

    async

    Parameters

    • Optional opts: { limit?: number; location?: Location; searchRangeLower?: any; searchRangeUpper?: any; timezone?: string }
      • Optional limit?: number
      • Optional location?: Location
      • Optional searchRangeLower?: any

        Lower (inclusive) search range bound. When null, the current date plus the location's minimum booking lead time (i.e. the earliest possible date to book) is used.

      • Optional searchRangeUpper?: any

        Upper (inclusive) search range bound. When null, the lower bound plus one week is used.

      • Optional timezone?: string

        Optional override for the timezone set in Carts.create

    Returns Promise<CartBookableDate[]>

    Promise containing the list of Bookable Dates

getBookableStaffVariants

  • Retrieves available staff variants for a specific bookable cart item, given a time that was retrieved earlier using cartBookableTimes. In other words, returns all variants that can be selected for the item while still keeping the overall starting time.

    Caveats

    Because this query assumes that variants of other items stay constant, variants of multiple items must be updated separately by retrieving the variants for one item first, updating that item, and then retrieving the variants for another item.

    Timing of an item is affected when the variant is updated, which is why any existing reservations are invalidated and the times must be reserved again using reserveCartBookableItems.

    async

    Parameters

    Returns Promise<CartAvailableBookableItemStaffVariant[]>

    Promise containing the list of Bookable Item Staff Variants

getBookableTimes

  • Retrieves available times for all bookable cart items, given a date that was retrieved earlier using getDates.

    async

    Parameters

    Returns Promise<CartBookableTime[]>

    Promise containing the list of Bookable Times

reserveBookableItems

  • Reserve one starting time for bookable cart items, i.e. all bookable items are to be performed starting at this time. Note that this call may fail if the time is no longer available.

    async

    Parameters

    Returns Promise<Cart>

    Promise containing the updated cart

updateSelectedBookableItem

  • Update a cart's selected bookable item.

    This invalidates existing reservations when the guest, staff variant, or options are updated.

    async
    deprecated

    See CartBookableItem.update instead

    Parameters

    • item: CartBookableItem

      The bookable item

    • Optional opts: { discountCode?: string; guest?: CartGuest; options?: CartAvailableBookableItemOption[]; staffVariant?: CartAvailableBookableItemStaffVariant }
      • Optional discountCode?: string

        Optional discount code applied to the item. Invalid discount codes are ignored without an error, check discountCode on the selected item to see if the code was valid.

      • Optional guest?: CartGuest

        The guest this item is booked for. A null value indicates the cart owner, or current client. When finding available times for bookable items, it's assumed that two items having different guests can be booked simultaneously.

      • Optional options?: CartAvailableBookableItemOption[]

        Selected bookable item options. Note that the selections must conform to the option group requirements, e.g. limits on the number of options. Otherwise an error is returned.

      • Optional staffVariant?: CartAvailableBookableItemStaffVariant

        The selected bookable item staff variant.

    Returns Promise<Cart>

    Promise containing the updated cart

Checkout & Payment Methods

addCardPaymentMethod

  • addCardPaymentMethod(details: { card: { address_postal_code: string; cvv: string; exp_month: number; exp_year: number; name: string; number: string } } | { token: string }, opts?: { select?: boolean }): Promise<Cart>
  • Add a credit card payment method to a cart.

    async

    Parameters

    • details: { card: { address_postal_code: string; cvv: string; exp_month: number; exp_year: number; name: string; number: string } } | { token: string }
    • Optional opts: { select?: boolean }
      • Optional select?: boolean

    Returns Promise<Cart>

    Promise containing the updated cart

checkout

  • Completes the checkout process.

    This will first check for any errors in the cart, aborting if any errors exist. Then, it will lock the cart, proceed to attempt to charge the card for any purchaseable items, book all appointments, send relevant email receipts and confirmations, and then mark the cart as completed.

    async

    Returns Promise<CheckoutCartPayload>

    Promise containing the updated cart and the appointments

selectPaymentMethod

  • Select an available payment method to be used with all selected cart items. Note that this call may fail if the payment method is not compatible with all items.

    This is currently the only way to associate payment methods with cart items. Other mutations may be added later in order to support more complex payment scenarios.

    async

    Parameters

    Returns Promise<Cart>

    Promise containing the updated cart

Details Methods

update

  • Update a cart. Only some fields can be updated, there are other operations available to update more fields.

    async

    Parameters

    Returns Promise<Cart>

    Promise containing the updated cart

Gift Card Items Methods

updateSelectedGiftCardItem

  • updateSelectedGiftCardItem(item: CartGiftCardItem, opts?: { design?: GiftCardDesign; price?: any }): Promise<Cart>
  • Update a cart's selected gift card item.

    async

    Parameters

    • item: CartGiftCardItem

      The gift card item

    • Optional opts: { design?: GiftCardDesign; price?: any }
      • Optional design?: GiftCardDesign
      • Optional price?: any

        Price applied to the gift card item

    Returns Promise<Cart>

    Promise containing the updated cart

Gift Cards Methods

addGiftCardItem

  • Add a gift card item to a cart

    async

    Parameters

    Returns Promise<Cart>

    Promise containing the updated cart

createGiftCardItemEmailFulfillment

  • createGiftCardItemEmailFulfillment(item: CartGiftCardItem, sender: string, deliveryDate: any, recipient: { email: any; name: string }, opts?: { message?: string }): Promise<{ cart: Cart; emailFulfillment: CartItemEmailFulfillment }>
  • Create an email fulfillment for a gift card item. A digital copy of the gift card will be sent to the recipient after the order is completed.

    async

    Parameters

    • item: CartGiftCardItem

      The CartGiftCardItem.

    • sender: string

      The name of the person sending the item.

    • deliveryDate: any
    • recipient: { email: any; name: string }
      • email: any

        The email of the person receiving the item

      • name: string

        The name of the person receiving the item

    • Optional opts: { message?: string }
      • Optional message?: string

        A message to include from the sender

    Returns Promise<{ cart: Cart; emailFulfillment: CartItemEmailFulfillment }>

deleteGiftCardItemEmailFulfillment

  • Delete a gift card item email fulfillment.

    async

    Parameters

    Returns Promise<Cart>

    Promise containing the updated cart

updateGiftCardItemEmailFulfillment

  • updateGiftCardItemEmailFulfillment(item: CartGiftCardItem, opts?: { deliveryDate?: any; message?: string; recipient: { email?: any; name?: string }; sender?: { name?: string } }): Promise<{ cart: Cart; emailFulfillment: CartItemEmailFulfillment }>
  • Update a gift card item email fulfillment.

    async

    Parameters

    • item: CartGiftCardItem
    • Optional opts: { deliveryDate?: any; message?: string; recipient: { email?: any; name?: string }; sender?: { name?: string } }
      • Optional deliveryDate?: any
      • Optional message?: string

        A message to include from the sender

      • recipient: { email?: any; name?: string }
        • Optional email?: any
        • Optional name?: string
      • Optional sender?: { name?: string }
        • Optional name?: string

    Returns Promise<{ cart: Cart; emailFulfillment: CartItemEmailFulfillment }>

Guests Methods

createGuest

  • createGuest(opts: { email?: any; firstName?: string; lastName?: string; phoneNumber?: any }): Promise<{ cart: Cart; guest: CartGuest }>
  • Add a guest to a cart.

    async

    Parameters

    • opts: { email?: any; firstName?: string; lastName?: string; phoneNumber?: any }
      • Optional email?: any
      • Optional firstName?: string
      • Optional lastName?: string
      • Optional phoneNumber?: any

    Returns Promise<{ cart: Cart; guest: CartGuest }>

deleteGuest

  • Delete a cart's guest. Using this invalidates existing reservations.

    async

    Parameters

    Returns Promise<Cart>

    Promise containing the updated cart

getGuests

updateGuest

  • updateGuest(guest: CartGuest, opts?: { email?: any; firstName?: string; lastName?: string; phoneNumber?: any }): Promise<{ cart: Cart; guest: CartGuest }>
  • Update a cart's guest.

    async
    todo

    Determine return type

    Parameters

    • guest: CartGuest
    • Optional opts: { email?: any; firstName?: string; lastName?: string; phoneNumber?: any }
      • Optional email?: any
      • Optional firstName?: string
      • Optional lastName?: string
      • Optional phoneNumber?: any

    Returns Promise<{ cart: Cart; guest: CartGuest }>

Offers Methods

addOffer

  • addOffer(offerCode: string): Promise<{ cart: Cart; offer: CartOffer }>
  • Add an offer to a cart.

    When the offer code exists, it's possible that it's not applicable to any items in the cart, in which case the offer is accepted but pricing doesn't change. This status can be checked on each offer. When applicable items are added later, their pricing is updated then.

    When the offer code doesn't exist, a CART_OFFER_CODE_INVALID error is returned.

    async

    Parameters

    • offerCode: string

      The offer code identifier

    Returns Promise<{ cart: Cart; offer: CartOffer }>

removeOffer

  • removeOffer(offer: CartOffer): Promise<Cart>
  • Remove an offer from the cart.

    async

    Parameters

    • offer: CartOffer

      The Offer code

    Returns Promise<Cart>

    Promise containing the updated cart

Other Methods

getAvailableCategories

  • Categories of items available to be checked out.

    Note that this list updates as the cart changes. For instance, some incompatible items may be disabled after others are added to the cart.

    Clients should retrieve this list again after mutations or make sure errors are handled when items cannot be added.

    async

    Returns Promise<CartAvailableCategory[]>

    Promise containing the list of available categories

getAvailablePaymentMethods

  • Payment methods available for this cart. Some methods may already be present, for instance when the current user is authenticated. Additional methods can be added using the addCart...PaymentMethod mutations.

    Note that not all of these payment methods can be used with every cart item. Subsets of supported payment methods are available through the item objects instead.

    Returns Promise<CartItemPaymentMethod[]>

getFeatures

  • getFeatures(): Promise<CartFeatures>
  • Features available to the cart.

    Returns Promise<CartFeatures>

getLocation

getOffers

  • getOffers(): Promise<CartOffer[]>
  • A list of offers applied to the cart.

    Offers can be applied manually using addCartOffer and an offer code, but it's also possible for offers to be auto-applied. At this time auto-applied offers cannot be removed from the cart.

    Returns Promise<CartOffer[]>

getSelectedItems

  • getSelectedItems(): Promise<CartItem[]>
  • All selected items pending checkout.

    Note that the ordering of this list is not stable, and may change depending on the current state of the cart.

    Returns Promise<CartItem[]>

removeSelectedItem

sendOwnershipCodeByEmail

  • sendOwnershipCodeByEmail(email: string): Promise<string>
  • Sends an cart ownership code to the user via email. See takeOwnershipByCode({cartId, codeId, codeValue}) for next step.

    async

    Parameters

    • email: string

      The email address that the client has on their account

    Returns Promise<string>

    The cart ownership codeId - see takeOwnershipByCode({cartId, codeId, codeValue})

sendOwnershipCodeBySms

  • sendOwnershipCodeBySms(mobilePhone: string): Promise<string>
  • Sends a cart ownership code to the user via SMS. See takeOwnershipByCode({cartId, codeId, codeValue}) for next step.

    async

    Parameters

    • mobilePhone: string

      The mobile phone number that the client has on their account

    Returns Promise<string>

    The cart ownership codeId - see takeOwnershipByCode({cartId, codeId, codeValue})

setLocation

  • Sets a location for the cart.

    Alternative methods for setting a location is passing a locationId argument when creating a cart or when adding a first item to an existing cart.

    Note that the location can only be set once and cannot be changed. When a location is already present on the cart, this mutation returns a CART_LOCATION_ALREADY_SET error.

    Parameters

    Returns Promise<Cart>

takeOwnershipByCode

  • takeOwnershipByCode(codeId: string, codeValue: number): Promise<Cart>
  • Take ownership of a cart, linking the client to this cart.

    async

    Parameters

    • codeId: string

      The ownership code id returned by sendOwnershipCodeByEmail/sendOwnershipCodeBySms

    • codeValue: number

      The ownership code value from the email/SMS

    Returns Promise<Cart>

    The updated cart

Purchasable Items Methods

addPurchasableItem

  • Add a purchasable item to a cart

    async

    Parameters

    • item: CartAvailablePurchasableItem

      The purchasable item

    • Optional opts: { discountCode?: string }
      • Optional discountCode?: string

        Discount code applied to the item. Invalid discount codes are ignored without an error, check discountCode on the selected item to see if the code was valid.

    Returns Promise<Cart>

    Promise containing the updated cart

addToWaitlist

  • addToWaitlist(preferredTimeLower?: any, preferredTimeUpper?: any, opts?: { timezone?: string }): Promise<Cart>
  • Creates a waitlist entry for the cart with the specified date and time ranges as the boundary for the preferred bookable time. Only selected bookable items will be included in the waitlist entry for the cart.

    This mutation marks the cart as completed, it can no longer be modified.

    async

    Parameters

    • Optional preferredTimeLower: any

      The preferred lower bound date and time of the bookable items.

    • Optional preferredTimeUpper: any

      The preferred upper bound date and time of the bookable items.

    • Optional opts: { timezone?: string }
      • Optional timezone?: string

        Optional override for the timezone set in Carts.create

    Returns Promise<Cart>

    Promise containing the updated cart

updateSelectedPurchasableItem

  • Update a cart's selected purchasable item.

    async

    Parameters

    • item: CartPurchasableItem
    • Optional opts: { discountCode?: string }
      • Optional discountCode?: string

        Optional discount code applied to the item. Invalid discount codes are ignored without an error, check discountCode on the selected item to see if the code was valid.

    Returns Promise<Cart>

    Promise containing the updated cart

Generated using TypeDoc