> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Sample Flows

## Article: Sample Flows

## Article Link: https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/delivery-orders/sample-flows.md

## Article Content:

# Delivery Order API: Sample Flows

This article presents possible use cases and corresponding sample flows that you can support. It provides a useful starting point as you plan your implementation.

## Schedule a delivery for a new order

When a customer places a delivery order on a restaurant's site, your app can send the order to the restaurant's delivery provider, so a courier picks it up when the food is ready.

To schedule a delivery for a new order:

1. Listen for new orders from the [eCommerce Orders API](https://dev.wix.com/docs/rest/business-solutions/e-commerce/orders/orders/introduction.md). Use the orders whose delivery method uses the delivery provider.
1. Call [List Delivery Providers](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/delivery-orders/list-delivery-providers.md), and specify the order's business location ID as `businessLocationId`. Make sure the provider's `activationStatus` is `ACTIVE`, and save its `appId`.
1. Call [Schedule Delivery](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/delivery-orders/schedule-delivery.md) with the order ID as `wixOrderId`, the provider's `appId` as `providerAppDefId`, and the time the food is ready as `pickupTime`.
1. Show the restaurant the estimated `pickupTime` and `dropOffTime` from the response.
1. If the call returns a `DELIVERY_REJECTED` error, check the `reasons` in the error details. For example, for `OUTSIDE_OF_DELIVERY_TIME`, call [Schedule Delivery](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/delivery-orders/schedule-delivery.md) again with a different time.

## Show delivery providers in your app

A restaurant management app can show the restaurant which delivery providers it can use at each location, and send it to the provider's dashboard to finish setting one up.

To show delivery providers in your app:

1. Retrieve the restaurant's [business locations](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/about-business-locations.md).
1. For each location, call [List Delivery Providers](https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/delivery-orders/list-delivery-providers.md) and specify the location's ID as `businessLocationId`.
1. Show each provider's `name` and `iconUrl`, together with its `activationStatus`.
1. For providers whose `activationStatus` is `INACTIVE`, tell the restaurant to complete the setup in the site dashboard, such as online payments and tips. Show a link to `dashboardUrl` for managing the provider account, and a link to `supportUrl` for help.