Booking Engine Guide
  • Mews Booking Engine Guide
  • Booking Engine Standalone
    • Getting started
    • Deeplinks
  • Booking Engine Widget
    • Getting started
    • Use cases
      • Prerequisites
      • Testing in the Demo environment
      • Using your own Date inputs
      • Multiple enterprises and pre-selected locations
      • Disabling widget caching
    • Advanced guide
    • Reference
    • Troubleshooting
  • Booking Engine API
    • Usage guidelines
      • Authentication
      • Requests
      • Responses
      • Environments
      • Images
      • Supported currency codes
      • Supported language codes
    • Use cases
      • Availability blocks
      • On session payments
      • Payment card authorization
      • Supporting payment cards
    • API Operations
      • Availability blocks
      • Configuration
      • Hotels
      • Payment cards
      • Reservations
      • Reservation groups
      • Services
      • Vouchers
    • Deprecations
  • Integrations
    • Google Tag Manager
    • Google Triggers Reference
    • Google Tag Manager Configuration
    • Google Analytics cross-domain tracking
  • FAQ
    • Ways to integrate
    • Migration off the mews.li domain
  • Changelog
    • Changelog 2024
    • Changelog 2023
    • Changelog 2022
    • Changelog 2021
    • Changelog 2020
Powered by GitBook
On this page
  • Options reference
  • Javascript API reference
  • Common API functions
  • Single Mode API functions
  • Chain Mode API functions
  • Advanced configuration (optional)

Was this helpful?

  1. Booking Engine Widget

Reference

Options reference

Note: Direct configuration of the booking engine through the options has been deprecated and will be disabled in future. Instead use Booking Engine Configuration in Mews Operations. The only supported options now are configurationIds and openElements.

Option
Type
Contract
Description

configurationIds

array ofstring

required

openElements

string

optional

Javascript API reference

Javascript API calls are defined on the booking engine instance, which is created with the initialization call. This instance is returned to you as an argument of a callback function that you can pass as the second parameter to the initialization call. The following simple example shows how to use the calls to set up start and end dates, and then open the booking engine:

<!-- Example of use of an instance to call the API -->
<script>
Mews.Distributor({
    configurationIds: ['aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee'],
}, function(distributor) {
   $('.booking-button').click(function() {
     var start = new Date();
     var end = new Date();
     end.setDate(start.getDate() + 2);

     distributor.setStartDate(start);
     distributor.setEndDate(end);
     distributor.open();
   });
});
</script>

The API functions supported are listed below. Some functions are common to both Single Mode and Chain Mode, while some are specific to one mode or the other.

Common API functions

open()

  • Opens the booking engine in its overlay

close()

  • Closes the booking engine and its overlay (note: even though the booking engine is closed, it still responds to API calls)

setLanguageCode(languageCode)

setCurrencyCode(currencyCode)

setStartDate(date)

  • date Type: Date Description: The start date to set

Correct - for 18 January 2019:

distributor.setStartDate(new Date(2019, 0, 18))

Incorrect - DO NOT DO THIS:

distributor.setStartDate("2019-01-18")

setEndDate(date)

  • date Type: Date Description: The end date to set

Correct - for 18 December 2019:

distributor.setEndDate(new Date(2019, 11, 18))

Incorrect - DO NOT DO THIS:

distributor.setEndDate("2019-12-18")

setVoucherCode(code)

  • code Type: string Description: The voucher code to set

  • Sets a new voucher code value.

setAdultCount(adultCount)

  • adultCount Type: number Description: The number of adults to set

  • Sets the number of adults that should be selected by default. Space occupancy for adults on the rate screen will be pre-filled according to this value.

setChildCount(childCount)

  • childCount Type: number Description: The number of children to set

  • Sets the number of children that should be selected by default. Space occupancy for children on the rate screen will be pre-filled according to this value.

disableTracking()

enableTracking()

Single Mode API functions

showRooms()

  • Sets the booking engine to the Rooms step.

showRates(roomId)

  • roomId Type: string Description: ID of a room or space to be selected

  • Sets the booking engine to the third step (Rates) as if you had selected a room on the second screen.

Chain Mode API functions

showHotels()

  • Sets the booking engine to the Hotels step.

showRooms(hotelId)

  • hotelId Type: string Description: ID of a hotel or other property whose rooms you want to display

  • Sets the booking engine to the Rooms step.

setCity(cityId)

  • cityId Type: string Description: ID of a city whose hotels you want to display

Advanced configuration (optional)

As the third parameter, Mews.Distributor accepts optional configuration.

Mews.Distributor(
    { configurationIds: ['aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee'] },
    function (api) {
        api.open();
    },
    { dataBaseUrl: 'https://api.mews-demo.com' }
);

string dataBaseUrl

  • Allows you to define a custom URL which is used for booking engine API calls and static assets. In the example above, the booking engine will be run against our Demo environment.

PreviousAdvanced guideNextTroubleshooting

Last updated 1 year ago

Was this helpful?

Set of booking engine unique identifiers. You can get the unique identifier of a configuration from its details page in Mews Operations - see .

A list of comma-separated CSS selectors of elements, which will automatically get attached to click event listeners for opening the Booking Engine Widget. The string is given as an argument to the document.querySelectorAll function, you can get more information about it . The click event is being delegated, meaning that each element is being looked up on a website dynamically after the click happens. This way you can pass a selector to the elements that don’t exist yet during the initialization.

languageCode Type: string Description: The language code to be set, in format en-US.

Sets the language of the booking engine’s localization. The language code should be in the format language-countryCode, e.g. en-US, as a variant of . If languageCode is not in the valid format, nothing happens.

currencyCode Type: string Description: The currency code to be set, in format, e.g. EUR.

Sets the currency of the booking engine’s localization. The currency code should be in format. If currencyCode is not in the valid format, nothing happens.

Sets the start date for a new availability query, the currently loaded availability list is not affected. If date is not a valid Date object or its value isn’t allowed as a start date, nothing happens. Note: monthIndex starts runs from 0 for January to 11 for December ().

Sets the end date for a new availability query, the currently loaded availability list is not affected. If date is not a valid Date object, nothing happens. Note: monthIndex starts runs from 0 for January to 11 for December ().

Sets all tracking consents to false (see ).

Sets all tracking consents to true (see ).

Supported language codes
IETF tag
ISO 4217
Supported currency codes
ISO 4217
click here for more details
click here for more details
Integrations
Integrations
here
Where can I get Configuration ID?