Sample 1 - Search and book

This sample document is designed to provide you with a sample journey that would allow you to use the API to make a booking.
Please note the products defined in the journey are imaginary products and will not work in the test system, this journey is for illustrative purposes only.

A typical booking journey


Diagram of Sample 1 flow - Search and Book

A travel booking journey in any system typically involves the same process: search, find products, add them to a basket and buy them and Erin is no different as this sample shows.

With Erin the main areas here are to make sure you retain the encoded search request identifier, pricing information and type for each item you want to purchase. You then have the option of using Erin's basket to store each item in or creating a basket at the end with all the product in one go. The method you choose does not alter the result.

One key factor to point out is that until you price the basket you cannot be sure the products are still available and more to the point available at the given price, if a price has changed you will get a price jump error at this point. The same is true at the final stage of converting a basket to a booking which is why we recommend pricing the basket just before purchasing it to all our clients.

The other concept that you need to be aware of is the use of passenger RPH values in the purchase process. In the example below you will see one passenger and we have given him an RPH of 1. If a second passenger were introduced we would have given the second passenger an RPH of 2 and so on. Irrespective of whether a passenger is an adult, child or infant.

We then ask that you flag each purchase item with the passenger RPH's of the passenger to whom we should allocate the purchase to. This is quite simply to allow you to purchase a basket of product without going through an iterative process of adding the passengers one at a time and generating an id for them as a reference to use.

Example messaging

In the example flow set out below we have not shown the search process, you will find an example of that in Sample 2 by clicking here. Please click on any of the messages below to expand them and view sample JSON requests and responses.

For each product we find in the search process we execute a search for prices message

{
    "timeStamp": "2022-07-06T12:44:06",
    "channel": 1,
    "searchType" : "PRICE_BREAKDOWN",
    "id" : 4318,
    "from" : "2022-09-10",
    "noAdults" : 2,
    "durations" : [7]
}
                                

This will give you the details you need to add the item to the basket. encodedSearchRequest, identifier, type and the price values will be used in the basket create message.

{
    "timeStamp": "2022-07-06T12:44:06",
    "channel": 1,
    "success": true,
    "encodedSearchRequest": "eyJzZWFyY2hUeXBlIjoiR0VORVJBTCIsImxhbmd1YWdlIjoiRU4iLCJjaGFubmVsIjo5LCJnZW9ncmFwaGljYWxJZCI6bnVsbCwiZ2VvZ3JhcGhpY0FyZWEiOm51bGwsInN1cHBsaWVyQ29udHJhY3RTdG9ja0l0ZW1JZCI6NDMxOCwiZnJvbSI6WzIwMjIsOSwxMF0sInRvIjpudWxsLCJwaWNrdXBUaW1lIjpudWxsLCJkcm9wT2ZmVGltZSI6bnVsbCwiZHVyYXRpb25zIjpbN10sImR1cmF0aW9uT2ZFeHRyYSI6bnVsbCwibWF0Y2hTdGFydERhdGUiOm51bGwsIm5vQWR1bHRzIjoyLCJub0NoaWxkcmVuIjpudWxsLCJub0luZmFudHMiOm51bGwsInBlcm1pdEFwaURldGFpbCI6ZmFsc2UsInN1cHBsaWVySWQiOm51bGwsImNhclNpemUiOm51bGwsImNhclR5cGUiOm51bGx9",
    "leadInPrices": [],
    "priceBreakDowns": [
        {
            "refreshTime": "2022-07-06T01:45:34",
            "id": 4318,
            "identifier": 392839972,
            "description": "Villa Vica",
            "supplierContractPriceDescription": "2022",
            "type": "Villa",
            "noAdults": 2,
            "noChildren": 0,
            "noInfants": 0,
            "dateValue": "2022-09-10",
            "duration": 7,
            "occupancy": 2,
            "facets": [],
            "availableStock": 1,
            "priceLines": [
                {
                    "type": "UNIT_PRICE",
                    "description": "Unit price",
                    "quantity": 1,
                    "value": 2238.19,
                    "total": 2238.19
                }
            ],
            "stockTypeId": 77
        }
    ]
}

As you can see this is where passenger details are added. passengerRPH is used so that the items in the basket can be assigned to specific passengers

{
    "timeStamp": "2022-07-06T12:44:06",
    "channel": 1,
    "basketDetails": {
        "quote": false,
        "passengers": [
            {
                "lead": true,
                "passengerRph": 1,
                "title" : "Mr",
                "givenName" : "TBC",
                "familyName" : "TBC",
                "dateOfBirth" : "1970-01-01",
                "gender" : "Male",
                "type" : "ADULT",
                "email" : "tbc@gmail.com"
            }
        ],
        "items": [
            {
                "sortOrder": 1,
                "stockItemId": 4318,
                "identifier": 392839972,
                "encodedSearchRequest": "eyJzZWFyY2hUeXBlIjoiR0VORVJBTCIsImxhbmd1YWdlIjoiRU4iLCJjaGFubmVsIjo5LCJnZW9ncmFwaGljYWxJZCI6bnVsbCwiZ2VvZ3JhcGhpY0FyZWEiOm51bGwsInN1cHBsaWVyQ29udHJhY3RTdG9ja0l0ZW1JZCI6NDMxOCwiZnJvbSI6WzIwMjIsOSwxMF0sInRvIjpudWxsLCJwaWNrdXBUaW1lIjpudWxsLCJkcm9wT2ZmVGltZSI6bnVsbCwiZHVyYXRpb25zIjpbN10sImR1cmF0aW9uT2ZFeHRyYSI6bnVsbCwibWF0Y2hTdGFydERhdGUiOm51bGwsIm5vQWR1bHRzIjoyLCJub0NoaWxkcmVuIjpudWxsLCJub0luZmFudHMiOm51bGwsInBlcm1pdEFwaURldGFpbCI6ZmFsc2UsInN1cHBsaWVySWQiOm51bGwsImNhclNpemUiOm51bGwsImNhclR5cGUiOm51bGx9",
                "passengerRphs": [
                    1
                ],
                "totalPrice" :2238.19,
                "totalSupplements" : 0.0,
                "totalDiscount" : 0.0
            }
        ]
    }
}
                                

This will return you the id of the basket that has been created. If you are adding items to the basket one at a time you will use this id in subsequent requests to ensure that the purchases are all in the same basket. Alternatively, you can manage this process yourself and add the items you wish to purchase in one go.

It is worth noting that the creation of a basket does not do any checks on the content they are only done once a basket is priced, validated or converted into a booking

{
    "timeStamp": "2022-07-06T13:47:22",
    "success": true,
    "affectedIds": [
        39393
    ]
}
                                

{
    "timeStamp": "2022-07-06T12:44:06",
    "channel": 1,
    "id": 39393
}

                                

The response indicated the booking id of the created booking

{
  "timeStamp": "2022-11-01T14:21:39.092Z",
  "transactionIdentifier": "Transaction 1",
  "success": true,
  "basketDetails": {
        "quote": false,
        "passengers": [
            {
                "lead": true,
                "passengerRph": 1,
                "title" : "Mr",
                "givenName" : "TBC",
                "familyName" : "TBC",
                "dateOfBirth" : "1970-01-01",
                "gender" : "Male",
                "type" : "ADULT",
                "email" : "tbc@gmail.com"
            }
        ],
        "items": [
            {
                "sortOrder": 1,
                "stockItemId": 4318,
                "identifier": 392839972,
                "encodedSearchRequest": "eyJzZWFyY2hUeXBlIjoiR0VORVJBTCIsImxhbmd1YWdlIjoiRU4iLCJjaGFubmVsIjo5LCJnZW9ncmFwaGljYWxJZCI6bnVsbCwiZ2VvZ3JhcGhpY0FyZWEiOm51bGwsInN1cHBsaWVyQ29udHJhY3RTdG9ja0l0ZW1JZCI6NDMxOCwiZnJvbSI6WzIwMjIsOSwxMF0sInRvIjpudWxsLCJwaWNrdXBUaW1lIjpudWxsLCJkcm9wT2ZmVGltZSI6bnVsbCwiZHVyYXRpb25zIjpbN10sImR1cmF0aW9uT2ZFeHRyYSI6bnVsbCwibWF0Y2hTdGFydERhdGUiOm51bGwsIm5vQWR1bHRzIjoyLCJub0NoaWxkcmVuIjpudWxsLCJub0luZmFudHMiOm51bGwsInBlcm1pdEFwaURldGFpbCI6ZmFsc2UsInN1cHBsaWVySWQiOm51bGwsImNhclNpemUiOm51bGwsImNhclR5cGUiOm51bGx9",
                "passengerRphs": [
                    1
                ],
                "totalPrice" :2238.19,
                "totalSupplements" : 0.0,
                "totalDiscount" : 0.0
            }
        ]
    }
  "encodedSearchRequest": "string",
  "leadInPrices": [],
    "priceBreakDowns": [
        {
            "refreshTime": "2022-07-06T01:45:34",
            "id": 4318,
            "identifier": 392839972,
            "description": "Villa Vica",
            "supplierContractPriceDescription": "2022",
            "type": "Villa",
            "noAdults": 2,
            "noChildren": 0,
            "noInfants": 0,
            "dateValue": "2022-09-10",
            "duration": 7,
            "occupancy": 2,
            "facets": [],
            "availableStock": 1,
            "priceLines": [
                {
                    "type": "UNIT_PRICE",
                    "description": "Unit price",
                    "quantity": 1,
                    "value": 2238.19,
                    "total": 2238.19
                }
            ],
            "stockTypeId": 77
        }
    ],
  "paymentSchedule": [
    {
      "date": "2022-11-01",
      "breakdownElements": [
        {
          "relatesTo": "ACCOMMODATION",
          "description": "Full payment",
          "value": 2238.19
        }
      ],
      "totalValue": 2238.19
    }
  ],
  "cancellationCharges": [],
  "loyaltyScheme": {
    "pointsEarnedForThisBooking": 223
  }
}

                                

The final stage is to convert a basket into a booking

{
    "transactionType": "STORE",
    "customerBasketBookingDetails": {
        "termsAndConditionsAccepted": true
    },
    "id": 39393,
    "salesAgent": "escapefreaks@test.com"
}

                                

The response indicated the booking id of the created booking

{
    "timeStamp": "2022-07-06T13:47:22",
    "success": true,
    "affectedIds": [
        39393
    ]
}