> ## Documentation Index
> Fetch the complete documentation index at: https://integrations.docs.commenda.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> The Order object represents a purchase order, typically linked to an invoice, tracking commercial transaction details with embedded transactions.

**The Order Data Model** represents a purchase order, typically linked to an invoice. Orders track the commercial transaction details and can generate invoices. In V4, orders embed complete transaction history for comprehensive financial tracking.

* **Invoice generation**: Orders can generate one or more invoices
* **Embedded transactions**: Complete payment history embedded in the order object
* **Status tracking**: Track both order fulfillment status and payment status
* **Line item details**: Detailed breakdown of items in the order

## Attributes

### Orders Attributes

| Property                  | Type    | Description                                                 |
| ------------------------- | ------- | ----------------------------------------------------------- |
| `rootfi_id`               | integer | Unique identifier for this order                            |
| `rootfi_created_at`       | string  | When this order was created in Commenda's system (ISO 8601) |
| `rootfi_updated_at`       | string  | When this order was last updated (ISO 8601)                 |
| `rootfi_integration_type` | enum    |                                                             |
| `platform_id`             | string  | Platform-specific order identifier                          |
| `order_number`            | string  |                                                             |
| `contact_id`              | string  | Reference to the Contact                                    |
| `currency_id`             | enum    | ISO 4217 currency code                                      |
| `status`                  | enum    | Current order status                                        |
| `payment_status`          | enum    | Payment state of the order                                  |
| `fulfillment_status`      | enum    |                                                             |
| `total_amount`            | double  | Total order amount                                          |
| `total_discount`          | double  | Total discount amount                                       |
| `total_tax`               | double  | Total tax amount                                            |
| `shipping_amount`         | double  |                                                             |
| `invoice_id`              | string  | Reference to the primary Invoice                            |
| `invoice_ids`             | array   | References to all related invoices                          |
| `transaction_ids`         | array   |                                                             |
| `created_at`              | string  | Original creation timestamp from platform (ISO 8601)        |
| `updated_at`              | string  | Last update timestamp from platform (ISO 8601)              |

### Status Enum Values

| Value        | Description                         |
| ------------ | ----------------------------------- |
| `PENDING`    | Order created but not yet processed |
| `PROCESSING` | Order is being processed            |
| `COMPLETED`  | Order has been fulfilled            |
| `CANCELED`   | Order was canceled                  |
| `ON_HOLD`    | Order is temporarily on hold        |
| `UNKNOWN`    | Status cannot be determined         |

### Payment Status Enum Values

| Value                | Description                           |
| -------------------- | ------------------------------------- |
| `DRAFT`              | Payment created but not yet initiated |
| `PENDING`            | Payment initiated but not confirmed   |
| `PAID`               | Payment completed successfully        |
| `PARTIALLY_PAID`     | Partial payment received              |
| `FAILED`             | Payment failed to process             |
| `REFUNDED`           | Payment refunded                      |
| `PARTIALLY_REFUNDED` | Partial refund issued                 |
| `VOIDED`             | Payment voided before capture         |
| `UNKNOWN`            | Payment status cannot be determined   |

## Expandable Attributes

Use the `expand` query parameter to include related objects:

* `expand=line_items` — includes the related Line Items object(s).
* `expand=transactions` — includes the related Transactions object(s).
* `expand=addresses` — includes the related Addresses object(s).
