How To…

List Items

You can query a list of available items based on search critera supplied in an API call to item.

When no dates are passed in the API call, a full list of enabled items in the inventory. When a date is passed, the API will return a “rated” response that includes pricing and availablity, as well as a “SLIP” that will be used to add the item to a session.

In order to build bookings, you’ll need to first retrieve “rated” item details (by declaring the booking length and any additional parameters in an item call, see above), which will return a “SLIP” – effectively a token encoding the necessary information to book that item in that time period with the options you’ve selected.

Example rated request to a specific item:

GET /api/3.0/item/17?start_date=20141224&end_date=20150101&param[guests]=2 HTTP/1.1
Host: your-company.checkfront.com

Add Items to a Booking Session

Once you have the SLIP for your desired item (or items), this can be passed in to create a new booking/session. The session can be thought of as your “cart”, and can be modified until you are ready to submit your booking.

If you have collected multiple items to be added, you can also add them in a batch by sending them as an array.

Example of adding a SLIP to a new session:

POST /api/3.0/booking/session HTTP/1.1
Host: your-company.checkfront.com

slip[]=17.20141224X8-guests.2&slip[]=18.20141224X8-guests.2

Note

For parent/child grouped items, the parent item functions as a container for the child items. As such, the request to obtain the SLIP must be made directly to the child item, rather than the parent.

Once the SLIP has been obtained, it can be added to the booking session as outlined above.

Alter Items in the Session

To alter regular items in a booking/session make a new rated query for the item, using the altered parameter values and the desired opt-in or out settings for package add-ons . This will provide an updated SLIP for the item with the desired quantity. You can then replace the old SLIP by referring to the line_id you want it to replace.

POST /api/3.0/booking/session HTTP/1.1
Host: your-company.checkfront.com

/booking/session?session_id={session_id}&line_id={line_id}&slip={new_slip}

If you need to alter simple items in a booking/session, such as changing quantities, or you need to remove any item, you can use the ‘alter’ query parameter of a booking/session call to an existing session.

To change the selected quantity of an added session simple items, pass the quantity in to the alter array entry for the selected line (which will be part of each session response).

To remove an item from the session, use the alter array to specify that the line item should be removed from the order.

GET /api/3.0/booking/session HTTP/1.1
Host: your-company.checkfront.com

session_id=rtdv4osethqurlmqgi55mcrkm4&alter[3]=4&alter[2.1]=optin&alter[1]=remove
POST /api/3.0/booking/session HTTP/1.1
Host: your-company.checkfront.com

{
        "session_id": "rtdv4osethqurlmqgi55mcrkm4",
        "alter": {
                "3": "4",
                "2.1": "optin",
                "1": "remove"
        }
}

Create a New Booking

After you’ve added SLIPs to your session, your application should then capture the customer information needed to make a booking. The fields required for checkout on your account can be retrieved with a GET request to booking/form.

To submit a booking to the system, you’ll then pass your session_id along with the required customer information to a booking/create call, which will return data relating to your booking, such as the booking/customer IDs (which could be recorded in your system) and an invoice/payment URL (if applicable).