> ## Documentation Index
> Fetch the complete documentation index at: https://afrizon-admin.tunzaa.co.tz/llms.txt
> Use this file to discover all available pages before exploring further.

# Order management and fulfillment lifecycle in Meneja

> Understand how orders are structured, track their status through the full lifecycle, search and filter the order list, and access support tickets.

Orders are the core of your Meneja dashboard. Each order captures everything related to a customer's purchase: the items they bought, the shipping address, payment details, totals, and the current status in the fulfillment lifecycle. From the Orders section you can search and filter your entire order history, drill into individual order detail views, update statuses, and respond to any linked support tickets.

## Order structure

An order contains the following top-level data:

| Field              | Description                                                                       |
| ------------------ | --------------------------------------------------------------------------------- |
| `order_id`         | Unique identifier for the order                                                   |
| `order_number`     | Human-readable order reference shown to customers                                 |
| `user_id`          | The customer who placed the order                                                 |
| `items`            | List of `OrderItem` objects (see below)                                           |
| `shipping_address` | Delivery `Address` with name, lines, city, postal code, country, phone, and email |
| `totals`           | `OrderTotals` object: subtotal, discount, tax, shipping, and total                |
| `currency`         | ISO currency code                                                                 |
| `payment_details`  | `PaymentDetails` object (see below)                                               |
| `payment_status`   | Current `PaymentStatus` value                                                     |
| `status`           | Current `OrderStatus` value                                                       |
| `refunds`          | Array of `Refund` objects applied to this order                                   |
| `delivery_details` | Optional `DeliveryDetails` object when a delivery has been assigned               |
| `support_ticket`   | Optional `SupportTicket` object if a support conversation exists                  |
| `notes`            | Free-text notes on the order                                                      |
| `discount_code`    | Applied discount code, or `null`                                                  |

### Order items

Each item in the `items` array includes:

| Field               | Description                           |
| ------------------- | ------------------------------------- |
| `item_id`           | Unique item identifier                |
| `product_id`        | Product reference                     |
| `variant_id`        | Optional variant reference            |
| `vendor_id`         | Vendor fulfilling this item           |
| `store_id`          | Store the item belongs to             |
| `name`              | Product name                          |
| `sku`               | Stock-keeping unit                    |
| `quantity`          | Number of units ordered               |
| `unit_price`        | Price per unit                        |
| `subtotal`          | Line subtotal before discount and tax |
| `discount`          | Discount applied to this line         |
| `tax`               | Tax applied to this line              |
| `total`             | Final line total                      |
| `refunded_quantity` | Units refunded, if any                |
| `refunded_amount`   | Amount refunded for this item, if any |

### Payment details

The `payment_details` object contains:

| Field             | Description                                |
| ----------------- | ------------------------------------------ |
| `payment_id`      | Unique payment identifier                  |
| `method`          | `PaymentMethod` value                      |
| `status`          | `PaymentStatus` value                      |
| `amount`          | Amount charged                             |
| `currency`        | Payment currency                           |
| `transaction_id`  | Gateway transaction reference              |
| `payment_gateway` | Name of the payment gateway used           |
| `paid_at`         | Timestamp of successful payment, or `null` |

## Order statuses

Orders move through the following statuses during their lifecycle:

| Status               | Meaning                                      |
| -------------------- | -------------------------------------------- |
| `pending`            | Order created but not yet processed          |
| `processing`         | Order is being reviewed or prepared          |
| `confirmed`          | Order confirmed and accepted for fulfillment |
| `shipped`            | Order has been dispatched                    |
| `delivered`          | Order has been delivered to the customer     |
| `completed`          | Order is fully fulfilled and closed          |
| `cancelled`          | Order was cancelled before fulfillment       |
| `refunded`           | Full refund was issued                       |
| `partially_refunded` | A partial refund was issued                  |

<Note>
  You can update an order's status from the order detail view. Status changes apply immediately and are reflected in the order list.
</Note>

## Payment statuses

The `payment_status` field tracks the payment lifecycle independently of the order status:

| Status               | Meaning                                      |
| -------------------- | -------------------------------------------- |
| `pending`            | Payment has been initiated but not confirmed |
| `authorized`         | Payment is authorized but not yet captured   |
| `paid`               | Payment successfully captured                |
| `failed`             | Payment attempt failed                       |
| `refunded`           | Full payment was refunded                    |
| `partially_refunded` | Part of the payment was refunded             |

## Payment methods

Meneja supports the following payment methods on orders:

* `credit_card`
* `paypal`
* `bank_transfer`
* `cash_on_delivery`
* `mobile_money`

## Searching and filtering orders

Use the filter bar at the top of the Orders list to narrow results. The available options are:

| Filter       | Description                                             |
| ------------ | ------------------------------------------------------- |
| `search`     | Search by order number, customer, or other text fields  |
| `status`     | Filter by a specific `OrderStatus` value                |
| `userId`     | Show orders for a specific customer                     |
| `vendorId`   | Show orders for a specific vendor                       |
| `dateFrom`   | Start of a date range (ISO date string)                 |
| `dateTo`     | End of a date range (ISO date string)                   |
| `has_ticket` | Show only orders that have an associated support ticket |

You can combine multiple filters. For example, filter by `status: shipped` and a date range to review all shipped orders in a given period.

<Tip>
  Use the `has_ticket` filter to quickly surface orders that have an open customer support conversation so your team can prioritize responses.
</Tip>

## Viewing order details

Click any row in the orders list to open the order detail view. From there you can:

* Review all line items, totals, and shipping address
* See the current order status and payment status
* Update the order status or payment status
* View linked delivery details
* Initiate or review refunds
* Access the linked support ticket

## Support tickets on orders

When a customer contacts support about an order, a `SupportTicket` is attached to that order record. The ticket includes:

| Field             | Description                                           |
| ----------------- | ----------------------------------------------------- |
| `ticket_id`       | Unique ticket identifier                              |
| `conversation_id` | Reference to the linked support conversation          |
| `subject`         | Ticket subject line                                   |
| `category`        | Ticket category                                       |
| `priority`        | `low`, `medium`, `high`, or `urgent`                  |
| `status`          | `open` or `resolved`                                  |
| `created_at`      | When the ticket was opened                            |
| `resolved_at`     | When the ticket was resolved, or `null` if still open |

<Info>
  Support tickets are read-only in the order detail view. To respond to or resolve a ticket, use the linked support conversation referenced by `conversation_id`.
</Info>
