a webhook for receiving changes about an order, like refunds
This webhook is sent on a new order, and also whenever the order's fulfillment status is changed (for example, when items are marked "Ready for Driver").
## This is a sample of what the order status change webhook from Bbot will look like ##
import requests
url = "https://api.yourcompaniessite.com/api-ext/2_2/orders/bbot_notification" # Arbitrary URL determined by you
payload = {
"restaurant_id": "<customer_id>",
"order_id": "<order_id>",
"order": {
"id": "bc960165-aa17-4506-abdc-0b1c26e44ff9",
"restaurant_id": "ecde3351-606c-4971-ab5a-792bccb0e5e2",
"table": {
"id": "dfda1479-b19e-40e9-accc-18d62c6ceaed",
"display_name": "Barge",
"short_id": "barge",
"hostname": "bbot.menu"
},
"fulfillment_method": "runner_with_cc",
"orderNumberToday": 233,
"items": [
{
"id": "bc961912-26c0-43ef-b3f3-af6bbce9a3e9",
"menuitem_id": "5100d13b-05dc-4908-ae66-c2d9d63e704d",
"name_when_purchased": "Ceviche",
"mods": [
{
"id": "bc7ba7fd-55cd-4f03-8bfb-af8bbf63b9bf",
"name": "Èclairs",
"tax_cents": 8,
"pretax_cents": 92,
"orig_pretax_cents": 92
}
],
"special_instructions": "",
"pretax_cents": 1194,
"tags": [],
"tax_cents": 106,
"tip_in_cents": 239,
"status": "waiting",
"orderitempromotions": [],
"order_id": "bc960165-aa17-4506-abdc-0b1c26e44ff9"
},
{
"id": "bc9625cf-ecac-4511-b932-269ac23848ee",
"menuitem_id": "5100d13b-05dc-4908-ae66-c2d9d63e704d",
"name_when_purchased": "Ceviche",
"mods": [
{
"id": "bc7ba7fd-55cd-4f03-8bfb-af8bbf63b9bf",
"name": "Èclairs",
"tax_cents": 8,
"pretax_cents": 92,
"orig_pretax_cents": 92
}
],
"special_instructions": "",
"pretax_cents": 1194,
"tags": [],
"tax_cents": 106,
"tip_in_cents": 239,
"status": "waiting",
"orderitempromotions": [],
"order_id": "bc960165-aa17-4506-abdc-0b1c26e44ff9"
}
],
"time": "2021-12-08T00:53:52.057350Z",
"last_modified": "2021-12-08T00:53:52.057361Z",
"time_closed": null,
"bartending_station_id": "e23abae8-5de1-4b2f-a182-1911708d7a63",
"extra_checkout_info": {},
"user_desired_time": null,
"checkout_id": "5f52f359-0d48-41a3-a7f4-d79c4cdb5c97",
"mobile": “5555555555”,
"deliveryAddress": null,
"integrations": {},
"guest_id": "0b686860-9807-491f-8ac3-1f9187ef1438",
"guest_email": “[email protected]”,
"guest_name": “Eric Wang”,
"guest_first_name": "Eric",
"guest_last_name": "Wang",
"guest_special_offers": null,
"pretax_cents": 2388,
"tip_cents": 478,
"fee_pretax_cents": 0,
"tax_cents": 212,
"total_cents": 3078,
"snooze_till": "1900-01-01T00:00:00Z",
"delivery_provider": null,
"fees_on_my_receipt": [],
"loyalty_webhook_discounts": [
{
"promotion": {
"id": "bc953976-51a2-4b08-a80e-c1aef6258184",
"name_for_owner": "Eric Discount",
"promo_type": "loyalty",
"cents_to_add_per_cart_effect": 0,
"fraction_multiplier_effect": 1
},
"final_webhook_post": {},
"final_webhook_response": {}
}
],
"charge": {
"id": "card_1K4EPsIcxGvm2q58DBTHloL1",
"name": null,
"brand": "Visa",
"last4": "0077",
"object": "card",
"country": "US",
"funding": "credit",
"customer": "cus_KjhpXyZbdsDonT",
"exp_year": 2022,
"metadata": {},
"cvc_check": null,
"exp_month": 12,
"address_zip": null,
"fingerprint": "Iy87l5vKi0ZhHTFl",
"address_city": null,
"address_line1": null,
"address_line2": null,
"address_state": null,
"dynamic_last4": null,
"address_country": null,
"address_zip_check": null,
"address_line1_check": null,
"tokenization_method": null,
"amount": 3078,
"created": 1638924833
}
}
}
headers = {
'Content-Type': 'application/json',
'Authorization': 'Basic <base64 credentials>', #you can provide these to Bbot and we'll send them with the webhook
}
response = requests.request("POST", url, headers=headers, data=payload)