Last updated

In-App SDK Integration Guide

Learn how to integrate the In-App SDK into your native app, the mandatory and optional parameters you need to pass when calling the SDK and which starting points the SDK offers.


IOS

The format for the iOS In-App SDK is XCFramework. The BookingInApp.xcframework is designed to help Affiliate partners integrate a comprehensive stays booking experience into their iOS apps. This guide will walk you through the steps required to implement the framework in your mobile project.

Prerequisites

  • Xcode 12.0 or later
  • Swift 5.0 or later
  • An existing iOS project

IOS installation

Step 1: Download the framework

Download the BookingInApp.xcframework package from the provided link.

Step 2: Add the framework to your project

  1. Open your iOS project in Xcode.
  2. Drag and drop the BookingInApp.xcframework into your project’s file navigator.
  3. Ensure that, in the dialog that appears, the framework is added to the target of the app where you want to use the In-App SDK.

Add framework

Step 3: Update build settings

  1. Go to your project’s target settings.
  2. Under the General tab, find the Frameworks, Libraries, and Embedded Content section.
  3. Ensure that BookingInApp.xcframework is listed and set to Embed & Sign.

Build settings

Step 4: Add required permissions

  1. Go to your project’s target settings.
  2. Under the Info tab, find the Custon iOS Target Properties section.
  3. Add a new key to the list, with the name Privacy - Location When In Use Usage Description (NSLocationWhenInUseUsageDescription). And add a value with a text that the app needs access to the location to find accommodations around the current location.

Location permission

Usage

Step 1: Import the framework

In the files where you want to use the SDK, import the framework:

import BookingInApp

Step 2: Load the Booking view

To present the booking view, you can use the following code snippet:

import SwiftUI
import BookingInApp

struct ContentView: View {
	
    var body: some View {
        NavigationView {
            NavigationLink {
                BookingInApp.showIndexPage(aid: "your-affiliate-id", label: "your-label") 
            } label: {
                Text("Find a hotel")
            }
        }
    }
}

The parameters to open the Booking view are:

ParameterTypeRequiredDescription
aidStringRequiredThe Affiliate ID that is provided to you by Booking.com for using the In-App SDK
labelStringRequiredThe Affiliate label, which is used for tracking purposes
langStringOptionalISO 639-1 standard language code
currencyCodeStringOptional3 Character ASCII code representing currency e.g. EUR, INR, USD, etc.
loyaltyIDStringOptionalThe Loyalty/membership ID of the user

An example to perform a search with the optional parameters included:

    BookingInApp.showIndexPage(
        aid: "2284749", 
        label: "LabelForTracking",
        lang: "es",
        currencyCode: "EUR",
        loyaltyID: "123456789")

Customisation

Show the search results

To display search results according to a search request:

    BookingInApp.showSearchResultsPage(aid: "your-affiliate-id", label: "your-label", destination: "Amsterdam")

The parameters to perform a search are:

ParameterTypeRequiredDescription
aidStringRequiredThe Affiliate ID that is provided to you by Booking.com for using the In-App SDK
labelStringRequiredThe Affiliate label, which is used for tracking purposes
destinationStringRequiredDestination name
checkinDateDateOptionalDate for the checkin
checkoutDateDateOptionalDate for the checkout
numberOfAdultsIntegerOptionalAmount of adult guests
numberOfRoomsIntegerOptionalAmount of rooms
numberOfChildrenIntegerOptionalAmount of children
agesChildrenArray of integersOptionalFor the ages of the children
langStringOptionalISO 639-1 standard language code
currencyCodeStringOptional3 Character ASCII code representing currency e.g. EUR, INR, USD, etc.
loyaltyIDStringOptionalThe Loyalty/membership ID of the user

An example to perform a search with the optional parameters included:

    BookingInApp.showSearchResultsPage(
        aid: "2284749", 
        label: "LabelForTracking", 
        destination: "Amsterdam",
        checkinDate: Calendar.current.startOfDay(for: Date()),
        checkoutDate: Calendar.current.date(byAdding: .day, value: 1, to: Calendar.current.startOfDay(for: Date())),
        numberOfAdults: 2,
        numberOfRooms: 1,
        numberOfChildren: 2,
        agesChildren: [5, 3],
        lang: "es",
        currencyCode: "EUR",
        loyaltyID: "123456789")

Android installation

Prerequisites

  • minSdk = 16

Step 1: Setup dependency

Since distribution at the MVP stage is done manually (not via Maven or Artifactory), the two dependencies below need to be included:

    implementation(files("libs/inapplibrary-release.aar"))
    implementation("com.google.androidbrowserhelper:androidbrowserhelper:2.5.0")

Step 2: Load Booking.com pages

Present index page

To present the index page, you can use the following code snippet:

import com.booking.inapplibrary.BookingInApp

BookingInApp.showIndexPage(
        context = context,
        aid = "your-affiliate-id",
        label = "your-label",
        lang = "en-us"
    )

Show the search results

To open the Search Results directly based on a search query. This can be done as follows:

    BookingInApp.showIndexPage(
        context = context,
        aid = "your-affiliate-id",
        label = "your-label",
        destination = "Amsterdam",
        lang = "en-us"
    )

The additional parameters to perform a search are:

ParameterTypeRequiredDescription
checkinDateLongOptionalDate for the checkin
checkoutDateLongOptionalDate for the checkout
numberOfAdultsIntegerOptionalAmount of adult guests
numberOfRoomsIntegerOptionalAmount of rooms
numberOfChildrenIntegerOptionalAmount of children
agesChildrenArray of integersOptionalFor the ages of the children
langStringOptionalISO 639-1 standard language code

Support

Self-managed partners: use the contact form within the Booking.com Partner Center.
Managed partners: contact your account manager. Include as much information as possible when reporting a bug, including:

  • Provide the Affiliate ID.
  • Include the time and date of the issue.
  • Include the entrypoint of the issue, either IndexPage or SearchResults.
  • Include the impact of the issue.