booking/session

While creating a booking, the details of the proposed booking are stored in an API session. This allows you to add multiple items to a booking, remove items and inform the server of your intent to book the item(s) in order to prevent over-bookings.

Each session call will return the session_id of the active session, and any attached session information. Your application must use the session_id in order to further modify the session or submit the booking beyond this point, and can pass it back to the API either as a cookie or a request parameter.

To start a new session, you simply pass in the booking SLIPs returned when from earlier “rated” inventory item queries.

Public API

If the Public API is enabled, unauthenticated users can make requests to the /booking/sessions endpoint. This is the same functionality as a customer adding an item to a booking through the UI on the Hosted Booking Page.

POST /api/3.0/booking/session

Create or return information about and stored in the current server session. Once initiated, you can fetch the details of a proposed booking by accessing the session again with the session_id found in the response. The item details for the session will be returned with your request.

Form Parameters:
  • string session_id – The session ID to be loaded or written to. Can also be sent as a cookie.

  • string/array slip – A SLIP, or multiple SLIPs to be added to a session. If need to add or remove more of the same item to a session, use alter below.

  • array alter – Alterations to be made on the current session, based on the line_id of items in the session and actions to be taken. To change the qty of an item in the session, send an alter for the line_id of that item with the integer value you need to set (e.g alter[3]=5 sets item 3 to a qty of 5). To remove an item, use alter ‘remove’; and to opt-in or out of listed package items use ‘optin’ or ‘optout’ respectively.

GET /api/3.0/booking/session
Query Parameters:
  • session_id (string) – The session ID to read information from. Can also be sent as a cookie.

  1{
  2    "version": "3.0",
  3    "account_id": 1,
  4    "host_id": "your-company.checkfront.com",
  5    "name": "Your Company",
  6    "locale": {
  7        "id": "en_US",
  8        "lang": "en",
  9        "currency": "CAD"
 10    },
 11    "request": {
 12        "status": "OK",
 13        "resource": "booking",
 14        "id": "session",
 15        "records": 4,
 16        "limit": 0,
 17        "page": 1,
 18        "pages": 1,
 19        "time": 0.0132,
 20        "method": "get"
 21    },
 22    "booking": {
 23        "session": {
 24            "id": "60rq7eme0tmhlmpkeg2fb2p287",
 25            "age": 0,
 26            "summary": "Bungee Jumping from the Top of the O2 Arena",
 27            "start_date": 1507186800,
 28            "end_date": 1507186800,
 29            "date_desc": "Thu Oct 5, 2017",
 30            "time_desc": "",
 31            "account_id": 1,
 32            "partner_id": 0,
 33            "currency_id": "CAD",
 34            "sub_total": "130.00",
 35            "tax_total": "0.00",
 36            "tax_inc_total": "0.00",
 37            "discount": "0.00",
 38            "total": "130.00",
 39            "due": "130.00",
 40            "paid_total": "0.00",
 41            "flat_discount": {
 42                "total": 0,
 43                "total_pretax": 0
 44            },
 45            "deposit": null,
 46            "tax": [],
 47            "qty": 1,
 48            "item": {
 49                "1": {
 50                    "sku": "bungeejumpingfromthetopoftheo2arena",
 51                    "item_id": 18,
 52                    "name": "Bungee Jumping from the Top of the O2 Arena",
 53                    "unit": "D",
 54                    "rate": {
 55                        "total": "130.00",
 56                        "item_total": "130.00",
 57                        "qty": 1,
 58                        "summary": "<strong title="Adults">Adults:</strong> 1 Day @ $130.00"
 59                    },
 60                    "date": {
 61                        "summary": "Thu Oct 5, 2017",
 62                        "start_date": 1507186800,
 63                        "end_date": 1507186800
 64                    },
 65                    "slip": "18.20171005X1-adults.1-children.0",
 66                    "available": 9
 67                },
 68                "1.1": {
 69                    "sku": "memorabiliaphoto",
 70                    "item_id": 21,
 71                    "name": "Memorabilia - Photo Package",
 72                    "unit": "D",
 73                    "rate": {
 74                        "total": "18.00",
 75                        "item_total": "0.00",
 76                        "qty": 1,
 77                        "summary": "$18.00"
 78                    },
 79                    "date": {
 80                        "summary": "Thu Oct 5, 2017",
 81                        "start_date": 1507186800,
 82                        "end_date": 1507186800
 83                    },
 84                    "slip": "21.20171005X1-1",
 85                    "available": 1000000000,
 86                    "optin": "O",
 87                    "opt": "out"
 88                },
 89                "1.2": {
 90                    "sku": "thelondonexperiencet-hat",
 91                    "item_id": 20,
 92                    "name": "The London Experience Hat",
 93                    "unit": "D",
 94                    "rate": {
 95                        "total": "15.00",
 96                        "item_total": "0.00",
 97                        "qty": 1,
 98                        "summary": "$15.00"
 99                    },
100                    "date": {
101                        "summary": "Thu Oct 5, 2017",
102                        "start_date": 1507186800,
103                        "end_date": 1507186800
104                    },
105                    "slip": "20.20171005X1-1",
106                    "available": 1000000000,
107                    "optin": "O",
108                    "opt": "out"
109                },
110                "1.3": {
111                    "sku": "thelondonexperiencet-shirt",
112                    "item_id": 19,
113                    "name": "The London Experience Mini-Bus",
114                    "unit": "D",
115                    "rate": {
116                        "total": "25.00",
117                        "item_total": "0.00",
118                        "qty": 1,
119                        "summary": "$25.00"
120                    },
121                    "date": {
122                        "summary": "Thu Oct 5, 2017",
123                        "start_date": 1507186800,
124                        "end_date": 1507186800
125                    },
126                    "slip": "19.20171005X1-1",
127                    "available": 1000000000,
128                    "optin": "O",
129                    "opt": "out"
130                }
131            }
132        }
133    }
134}
POST /api/3.0/booking/session/clear
POST /api/3.0/booking/session/end
Query Parameters:
  • session_id (string) – The session ID to empty or close. Can also be sent as a cookie.