Unable to create new booking

Hi,

Unable to create a new booking, I followed below steps, 

- Created item of  slip
- Created  a session of item
- Passed created session-id to booking/create API

Getting response 

{"headers":{},"body":"{\"version\":\"3.0\",\"account_id\":0,\"host_id\":\"xxxxxxxxx.checkfront.com\",\"name\":\"company namexxxx\",\"locale\":{\"id\":\"en_US\",\"lang\":\"en\",\"currency\":\"USD\"},\"request\":{\"status\":\"ERROR\",\"resource\":\"booking\",\"id\":\"create\",\"records\":0,\"limit\":0,\"page\":1,\"pages\":1,\"time\":0.0577,\"timestamp\":1565793123.789201,\"method\":\"post\",\"error\":{\"id\":\"validation_error\",\"title\":\"Booking contains no items\",\"details\":\"Your booking appears to be empty. Ensure it contains at least one item to be booked\",\"data\":\"\"}},\"booking\":{\"session\":{\"id\":\"crhh7egdm5v7oc8hm2avhngl22\",\"age\":0,\"summary\":\"\",\"date_desc\":\"Wed Aug 14, 2019\",\"time_desc\":\"\",\"account_id\":0,\"partner_id\":0,\"currency_id\":\"USD\",\"sub_total\":\"0.00\",\"tax_total\":\"0.00\",\"tax_inc_total\":\"0.00\",\"discount\":\"0.00\",\"total\":\"0.00\",\"due\":\"0.00\",\"paid_total\":\"0.00\",\"flat_discount\":{\"total\":0,\"total_pretax\":0},\"deposit\":null,\"tax\":{\"1\":{\"name\":\"GET\",\"amount\":\"4.167\",\"type\":\"P\",\"reach\":\"A\",\"options\":{\"opt-in\":false,\"pos\":\"1\"},\"total\":0},\"2\":{\"name\":\"HSRT\",\"amount\":\"4.5000\",\"type\":\"Q\",\"reach\":\"A\",\"options\":{\"opt-in\":false,\"pos\":\"2\"},\"total\":0},\"3\":{\"name\":\"Kihei Boat Ramp Tax\",\"amount\":\"3\",\"type\":\"P\",\"reach\":\"A\",\"options\":{\"opt-in\":true,\"pos\":\"3\"},\"total\":0},\"4\":{\"name\":\"Fed Airport Tax\",\"amount\":\"7.164\",\"type\":\"P\",\"reach\":\"A\",\"options\":{\"opt-in\":true,\"pos\":\"4\"},\"total\":0}},\"qty\":0,\"guest_qty\":0,\"start_date\":1565793123,\"end_date\":1565793123,\"item\":[]}}}","response":{"code":200,"message":"OK"},"cookies":[{"name":"api","value":"crhh7egdm5v7oc8hm2avhngl22","expires":null,"path":"\/","domain":"xxxxxxxxx.checkfront.com","host_only":true}],"filename":null,"http_response":{"data":null,"headers":null,"status":null}}

Please correct me what am i missing?

Comments

  • Hi Taliv,

    Thank you very much for reaching out to us, I hope you're doing well today! My name is Jay and I will be helping you with your API question.

    It looks like the booking session is empty when the booking is being created. You can double-check that the item is being added to the session by querying booking/session (http://api.checkfront.com/ref/booking/session.html) before creating the booking. 

    If the item is not being correctly added it is possible the headers of your query are missing a "content-type". If there is no "Content-type: application/json" on your POST query, then the body will be ignored when being added to the session, resulting in no item being in the session.

    I hope this helps! If you need further help, feel free to let us know and we can investigate further. You can also email us at support@checkfront.com with any questions you may have.


    Jay Coughlan

    Technical Support Specialist

    Checkfront | www.checkfront.com/contact | Email: support@checkfront.com


  • Hi Jay,

    I am passing session id which is got from API  'GET /api/3.0/booking/session' which is correct as per the reponse of API 'GET /api/3.0/booking/session'. 

    Let me share below code for create booking

    $wp_request_headers = array(                             'Content-Type' => 'application/json', 'Authorization' => 'Basic ' . base64_encode( '181f7d9c0121bcf1568xxxxxxxxxxxxxxxx:49edd184a94d8aca5476d0bd3c0xxxxxxxxxxxxxxxxxxxxxxxx' ) );
    $itemResponse = wp_remote_post ( hosturl.'booking/create', array(   'session_id'=>$_POST['itemSessin'],   'customer_email'=>$_POST['email'],    'customer_name'=>$_POST['name'],   'customer_phone'=>$_POST['phoneNumber'],           'customer_address'=>$_POST['address'],           'customer_city'=>$_POST['city'],           'customer_country'=>$_POST['country'],           'customer_region'=>$_POST['region'],           'customer_postal_zip'=>$_POST['zipcode'],   array('header' => $wp_request_headers)));

    Please correct me or code whrere i am doing wrong.
  • Hi Taliv,

    Thank you for getting back to me. The only thing I'm able to see immediately is 'session_id'=>$_POST['itemSessin'] may be misspelled. I would recommend double-checking to make sure that itemSessin matches the variable being used.

    If that is correct, would you be able to email in to support@checkfront.com with your account details? I would love to take a deeper look and debug this further for you. 

    I look forward to your email!


    Jay Coughlan

    Technical Support Specialist

    Checkfront | www.checkfront.com/contact | Email: support@checkfront.com

  • Hi Jay,

    Thanks for your reply,  Please check your email inbox.
  • Thanks, Jay,

    Now able to create booking successfully for specific or multiple items.
Sign In or Register to comment.