> 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/e-commerce/orders/orders/sample-flows.md

## Article Content:

# Orders: 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.

## Use an order ID across different eCommerce APIs

Some eCommerce functionality is accessible by using an order's ID and passing it to other eCommerce APIs.

1. To retrieve transaction details, including payment IDs, pass the order ID to [List Transactions For Single Order](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-transactions/list-transactions-for-single-order.md).
2. To add a payment record, pass the order ID and payment details to [Add Payments](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-transactions/add-payments.md).
3. To modify the payment status, pass the order ID along with the payment ID to [Update Payment Status](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-transactions/update-payment-status.md).
4. To retrieve fulfillment details, pass the order ID to [List Fulfillments For Single Order](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-fulfillments/list-fulfillments-for-single-order.md).

## Search for orders by customer

You can retrieve all orders placed by a specific customer using their email address, their contact ID, or the billing contact's name.

1. Call [Search Orders](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/orders/search-orders.md) with a filter on `buyerInfo.email`. For example:

    ```json
    {
      "search": {
        "filter": {
          "buyerInfo.email": "customer@example.com"
        }
      }
    }
    ```

    To search by contact ID instead, retrieve the customer's contact ID with the [Contacts API](https://dev.wix.com/docs/api-reference/crm/members-contacts/contacts/contacts/contact-v4/introduction.md) and filter by `buyerInfo.contactId`. If the customer has more than one contact, filter with `$in` and all their contact IDs.

    To search by the billing contact's name, filter by `billingInfo.contactDetails.fullName` with `$eq` and the full name, or with `$startsWith`. The full name is the first name, a space, and the last name. Filtering by `billingInfo.contactDetails.firstName` or `billingInfo.contactDetails.lastName` isn't supported. Don't use `$contains` to filter by name. It runs a text search over several order fields, such as the customer's email address, location names, and product names, so the results can include other customers' orders.

2. The response contains an array of orders matching the filter. Use the `metadata.cursors` object to paginate through results if needed.
3. To get transaction details for a specific order, pass the order `id` to [List Transactions For Single Order](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-transactions/list-transactions-for-single-order.md).

## Search for orders in a date range

You can retrieve the orders created in a date range, for example, for a monthly report.

To retrieve the orders created in a date range:

1. Call [Search Orders](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/orders/search-orders.md) and combine two conditions on `createdDate` with `$and`. For example:

    ```json
    {
      "search": {
        "filter": {
          "$and": [
            { "createdDate": { "$gte": "2026-11-01T00:00:00.000Z" } },
            { "createdDate": { "$lt": "2026-12-01T00:00:00.000Z" } }
          ]
        }
      }
    }
    ```

    Specify dates in UTC, in ISO 8601 format, as in the example above.

2. To retrieve the next page, call Search Orders again and specify `metadata.cursors.next` from the previous response in `cursorPaging.cursor`.

## Search for orders by total

You can retrieve orders by their total, for example, to list large orders.

To retrieve orders by their total:

1. Call [Search Orders](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/orders/search-orders.md) with a filter on `priceSummary.total`. For example:

    ```json
    {
      "search": {
        "filter": {
          "priceSummary.total": { "$gte": 100 }
        }
      }
    }
    ```

    To sort by the order total, also use `priceSummary.total`.

2. To retrieve the next page, call Search Orders again and specify `metadata.cursors.next` from the previous response in `cursorPaging.cursor`.

## Create an order with restricted edit access

If you want to ensure that only your app can edit orders it creates, you can restrict edit access at creation time. This is useful, for example, to prevent other apps from modifying imported orders.

To create an order that only your app can edit:

1. Call [Create Order](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/orders/create-order.md) and add the following to the request body's `settings` field:

    ```json
    {
      "editableByOwnerApps": {
        "appIds": ["<your-app-id>"]
      }
    }
    ```

2. The order is created with edit access restricted to your app. Any other app that attempts to edit the order receives an `ORDER_CANNOT_BE_EDITED` error.

## Track fulfillment status

You can retrieve fulfillment details for an order and update tracking information. An order that was manually marked as fulfilled has no fulfillments. To find when it was fulfilled, see [Get the date an order was fulfilled](#get-the-date-an-order-was-fulfilled).

1. Call [List Fulfillments For Single Order](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-fulfillments/list-fulfillments-for-single-order.md) with the order ID to get existing fulfillments.
2. To add a new fulfillment with tracking information, call [Create Fulfillment](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-fulfillments/create-fulfillment.md). For example:

    ```json
    {
      "fulfillment": {
        "lineItems": [
          {
            "id": "line-item-id",
            "quantity": 1
          }
        ],
        "trackingInfo": {
          "trackingNumber": "1Z999AA10123456784",
          "shippingProvider": "ups",
          "trackingLink": "https://www.ups.com/track?tracknum=1Z999AA10123456784"
        }
      }
    }
    ```

3. To update tracking information on an existing fulfillment, call [Update Fulfillment](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-fulfillments/update-fulfillment.md) with the order ID, fulfillment ID, and updated tracking details.

## Get the date an order was fulfilled

You can build a report of orders based on the date they were fulfilled. Where the date is stored depends on how the order was fulfilled:

- When an order is manually marked as fulfilled, for example, in the site dashboard, an `ORDER_FULFILLED` activity is added to the order. No fulfillment is created.
- When order items are fulfilled with fulfillments, each fulfillment has its own `createdDate`.

When a paid order has no shipping info, it's fulfilled automatically and the date isn't recorded. Don't use an order's `updatedDate` as the fulfillment date, because it changes with every update to the order.

To get the date each order was fulfilled:

1. Call [Search Orders](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/orders/search-orders.md) with a filter on `fulfillmentStatus`. For example:

    ```json
    {
      "search": {
        "filter": {
          "fulfillmentStatus": "FULFILLED"
        }
      }
    }
    ```

    Use `metadata.cursors.next` to page through all results.

2. For each order in the response, find the most recent activity in `activities` with an `activityType` of `ORDER_FULFILLED`. Its `createdDate` is the date and time the order was marked as fulfilled.
3. Call [List Fulfillments For Multiple Orders](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-fulfillments/list-fulfillments-for-multiple-orders.md) with the IDs of the orders that have no `ORDER_FULFILLED` activity. You can specify up to 100 order IDs per call. For each order, use the `createdDate` of its most recent fulfillment.
4. Filter or group the orders by these dates in your code. [Search Orders](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/orders/search-orders.md) doesn't support filtering or sorting by `activities`.

## Skip test orders when syncing orders

If your app syncs orders to an external system, such as an accounting or fulfillment tool, you usually don't want test orders there. Test orders can reach your app through [Search Orders](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/orders/search-orders.md) and through [Order Created](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/orders/order-created.md) and some [Order Updated](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/orders/order-updated.md) events. For more information, see [Test Orders](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/orders/test-orders.md).

To skip test orders when syncing orders:

1. Call [Search Orders](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/orders/search-orders.md) with a filter that excludes test orders. For example:

    ```json
    {
      "search": {
        "filter": {
          "demo": { "$ne": true }
        }
      }
    }
    ```

    Use `metadata.cursors.next` to page through all results.

2. Sync the orders in the response to your external system.
3. Listen to [Order Created](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/orders/order-created.md) and [Order Updated](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/orders/order-updated.md) to keep your system up to date. Skip any order in these events whose `demo` field is `true`.