This method is used to book a new trip

book(tripBooking: TripBooking) : Call<TripInfo>

This method accepts TripBooking as a parameter. This can be created with a quoteId and optional flightNumber. TripBooking also contains an optional paymentNonce string. This nonce represents the payment method for booking the trip. It is optional for invoice bookings where no payment method is required from the user. Otherwise, this payment nonce comes from Braintree Payment SDK. More information on integrating payment SDKs can be found here:

QuoteService needs to be used in order to get a quoteId .


  • tripBooking: TripBooking






let tripService = Karhoo.getTripService()

let quoteId = "1234" // you can get this ID from the quotes service.
let passengers = Passengers(
                additionalPassengers: 0,
                passengerDetails: [PassengerDetails(
                        firstName: "John",
                        lastName: "Smith",
                        phoneNumber: "+441234567890",
                        email: "[email protected]",
                        locale: "gb"

let tripBooking = TripBooking(quoteId: quoteId,
                              passengers: passengers,
                              flightNumber: nil) tripBooking).execute { result in
    switch result {
    case .success(let trip):
        print("Trip: \(trip)")
    case .failure(let error):
        print("error: \(error.code) \(error.message)")


val tripService = KarhooApi.tripService

val quoteId = "1234" // you can get this ID from the quotes service.
val passengers = Passengers(
                additionalPassengers = 0,
                passengerDetails = listOf(PassengerDetails(
                        firstName = "John",
                        lastName = "Smith",
                        phoneNumber = "+441234567890",
                        email = "[email protected]",
                        locale = "gb"
val flightNumber = "BOE747"

val tripBooking = TripBooking(
        quoteId = quoteId,
        passengers = passengers,
        flightNumber = flightNumber))
        .execute { result ->
            when (result) {
                is Resource.Success -> print( //Handle data
                is Resource.Failure -> print(result.error) //Handle error