# Booking Engine Overview The following guide is to assist you in building a booking engine using the Resharmonics API. The booking engine will allow you to search for availablity, booking a unit, mark invoices as paid, and more. The guide is written in TypeScript and is a step-by-step guide to building a booking engine using the Resharmonics API. ## Source Code The source code for the example is available at our [public api examples](https://bitbucket.org/resharmonics-ondemand/public-api-examples) ## Introduction The example assumes you are building a website and will have a content management systems (CMS) in place, or use the Resharmonics API to manage your content. The majority of the content that is static, such a property information should be cached to reduce the number of API calls. ## The process The example authenticates using client credentials with the OAuth server, before each call the access token is checked to see if it has expired, if it has a new token is requested. ![Overview of the process](/assets/booking_engine_sequence.503261f277837e1c3bbebdabc656cac5847b1f9c8b1129e3fcfcbab9f1249d9c.9f7daa38.svg) 1. Iterate through the properties to build the property cache 2. Select a billing frequency which determines how the invoices will be created 3. Select a booking type which determines the booking behavior and characteristics 4. Select a booking channel which determines the source of the booking 5. Iterates through the buildings to find an available unit type for the dates 6. Create a contact for the booking 7. Combine the contact, unit type and availability information to create a booking enquiry, the enquiry holds availability whilst the contact fills in payment details. 8. The expection is that you then use a payment gateway to process the payment 9. Once the payment is successful, convert the enquiry to a pending status booking, this creates invoices etc on the booking 10. Create the payment on the booking 11. Convert the booking to a confirmed status, which will cause booking emails and tasks to be scheduled.