The can-deliver endpoint takes in a restaurant_id and address object and returns a response as to whether or not the address is within the delivery zone of the given restaurant.
In the request, you will need to send an address consisting of a street address, city, state, and zipcode, and Bbot will make a call to the integration associated with that restaurant to check if the address is within the delivery zone. This should be done during the ordering stage, likely before the guest orders.
The address object should be constructed with the following attributes:
Attribute | Type | Description |
---|---|---|
street | string | Full street address. Ex. "123 Main St." |
city | string | City Name. Ex. "Winchestertonfieldville" |
state | string | Two-character state abbreviation. Ex. "NY" |
zip | string | Five digit postal code. Ex. "90210" |
In the event that you have an integration set up with DoorDash, Stuart, or Relay for the given restaurant. The endpoint will return a true or false response at the key of "definite".
If the restaurant has self delivery set up, you will receive a response at the key of "conditional" giving the parameters set up including "max_delivery_miles" and "allowed_zip_codes". You can then use methods on the front end to determine if the provided address falls within the returned parameters.
The definite response always returns a true or false.
The conditional response is as follows:
Attribute | Type | Description |
---|---|---|
max_delivery_miles | float | A float representing the number of miles the restaurant has set delivery to. Can be used on the front end to determine if an address is within radius. |
allowed_zip_codes | list of strings | A list of allowed zip codes as strings which can be used on the front end to determine if an address is deliverable. |