Wiki
Clone wikiAPI-2.0 / Estimate booking price
API method DEPRECATED, please use Price estimation for booking instead
Method: POST
Path: /api/bookings/estimate
Estimate price and discounts for a new booking. It accepts the same JSON as 'create booking' and returns booking price estimation.
Without customer login
If request does not contain X-Authentication header, request JSON must have "user" object with user email, first and last names.
Example request JSON
{"booking":{ "service_date":"2015-08-15T13:00", "services":[{ "id":1, "extras":[{ "extra_id":1, "quantity":1 }], "pricing_parameters":[{ "pricing_parameter_id":1, "quantity":1 }] },{ "id":2, "extras":[], "pricing_parameters":[] }], "flexibility":0, "address":"595 Market St", "city":"San Francisco", "state":"CA", "zip":"94105", "phone":"462-485-0790", "payment_method":"stripe", "discount_code":null, "customer_comments":null, "sms_notifications":false, "frequency_id":1 }, "user":{ "email":"ned_marvin@lockman.info", "first_name":"Candelario", "last_name":"Kutch" }}
Example response JSON
{"estimate":{ "subtotal":202.0, "discount":0.0, "sales_tax":0.0, "final_price":202.0 }}
Example request:
For production, replace https://acme-sandbox.l27.co
with https://<your subdomain>.launch27.com
curl -H "X-API-Key: test_8kBFkhmf8TA7TZyQBh" \ -H "Content-Type: application/json" \ -H "Accept: application/launch27.v2" \ -X POST -k \ -d '{"booking":{"service_date":"2015-08-15T13:00", "services":[{"id":1, "extras":[{"extra_id":1, "quantity":1 }], "pricing_parameters":[{"pricing_parameter_id":1, "quantity":1 }] },{"id":2, "extras":[], "pricing_parameters":[] }], "flexibility":0, "address":"595 Market St", "city":"San Francisco", "state":"CA", "zip":"94105", "phone":"462-485-0790", "payment_method":"stripe", "discount_code":null, "customer_comments":null, "sms_notifications":false, "frequency_id":1, "custom_fields":{"custom_text":"text", "custom_dropdown":{"values":"1"}, "custom_radio":{"values":"2"}}}, "user":{"email":"ned_marvin@lockman.info", "first_name":"Candelario", "last_name":"Kutch"}, "stripe":{"token":"XXXXXX"}}' \ https://acme-sandbox.l27.co/api/bookings/estimate
With customer login
If request contains X-Authentication header, it should have valid email and single_access_token of existing active and confirmed Customer (returned by Login endpoint). WIth auth info, "user" object is not required (and will be ignored if provided).
Example request JSON
{"booking":{ "service_date":"2015-08-15T13:00", "services":[{ "id":1, "extras":[{ "extra_id":1, "quantity":1 }], "pricing_parameters":[{ "pricing_parameter_id":1, "quantity":1 }] },{ "id":2, "extras":[], "pricing_parameters":[] }], "flexibility":0, "address":"595 Market St", "city":"San Francisco", "state":"CA", "zip":"94105", "phone":"462-485-0790", "payment_method":"stripe", "discount_code":null, "customer_comments":null, "sms_notifications":false, "frequency_id":1 }}
Example response JSON
{"estimate":{ "subtotal":202.0, "discount":0.0, "sales_tax":0.0, "final_price":202.0 }}
Example requests:
For production, replace https://acme-sandbox.l27.co
with https://<your subdomain>.launch27.com
(1) First, get auth token for user@email.com:
curl -H "X-API-Key: test_8kBFkhmf8TA7TZyQBh" \ -H "Content-Type: application/json" \ -X POST -k \ -d '{"auth": {"email": "user@email.com", "password":"trustno1"}}' \ https://acme-sandbox.l27.co/api/auth
{"user":{ "id":2, "email":"user@email.com", "single_access_token":"JZR39nBOtg89JyyqmeI", "first_name":"First", "last_name":"Last" }}
curl -H "X-API-Key: test_8kBFkhmf8TA7TZyQBh" \ -H "X-Authentication: user@email.com:JZR39nBOtg89JyyqmeI" \ -H "Content-Type: application/json" \ -H "Accept: application/launch27.v2" \ -X POST -k \ -d '{"booking":{"service_date":"2015-08-15T13:00", "services":[{"id":1, "extras":[{"extra_id":1, "quantity":1 }], "pricing_parameters":[{"pricing_parameter_id":1, "quantity":1 }] },{"id":2, "extras":[], "pricing_parameters":[] }], "flexibility":0, "address":"595 Market St", "city":"San Francisco", "state":"CA", "zip":"94105", "phone":"462-485-0790", "payment_method":"stripe", "discount_code":null, "customer_comments":null, "sms_notifications":false, "frequency_id":1, "custom_fields":{"custom_text":"text", "custom_dropdown":{"values":"1"}, "custom_radio":{"values":"2"}}}, "stripe":{"token":"XXXXXX"}}' \ https://acme-sandbox.l27.co/api/bookings/estimate
Updated