Skip to content
Billzova Developers

Guides

Website ordering, end to end

Menu → cart → quote → order → status → tracking, the way Billzova websites do it.

  1. Show open / closed

    On page load call GET /v1/restaurant. If ordering.acceptingNow is false, show status.label (e.g. “Closed · opens 11:00 AM”) and hide checkout.

  2. Render the menu

    GET /v1/menu (cache it; refresh with If-None-Match). For items with sizes let the customer pick a variant; respect each add-on group's max. Hide or grey out available: false.

  3. Quote the cart

    On the checkout page POST /v1/orders/quote and show its lines, GST and total — never your own maths.

  4. Place the order

    POST /v1/orders with the customer's name and phone, payment, an Idempotency-Key, and expectedTotal set to the quote's total.amount. On PRICE_CHANGED, show the new quote from the error.

  5. Show status

    Show the order page and poll GET /v1/orders/{id} every 10–20 seconds until COMPLETED, REJECTED or CANCELLED. Or send the customer the trackingUrl.

What each status means

StatusMeaningShow the customer
PENDINGWaiting for the restaurant“Sent to the restaurant…”
ACCEPTEDAccepted“Accepted — ready in about N min”
PREPARING / READYIn the kitchen / ready“Being prepared” / “Ready for pickup”
OUT_FOR_DELIVERYOn the wayDelivery person's name + call button
COMPLETEDDone“Enjoy your meal”
REJECTEDRestaurant declinedrejectionReason
CANCELLEDCancelled (customer, or not accepted in time)rejectionReason

Keep the key on your server

Next.js route handler — app/api/order/route.ts
export async function POST(req) {
  const order = await req.json();
  const res = await fetch('https://api.billzova.com/v1/orders', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.BILLZOVA_KEY}`, // server-only env var
      'Content-Type': 'application/json',
      'Idempotency-Key': order.checkoutId,
    },
    body: JSON.stringify(order.payload),
  });
  return new Response(await res.text(), { status: res.status, headers: { 'Content-Type': 'application/json' } });
}