# Orders

An Order is a collection of products and prices purchased by a customer. Create orders manually, through the UI, or through automations triggered by events like journey submissions.

Orders use the same [flexible entity](/docs/entities/flexible-entities) system as all other epilot entities -- they support custom attributes, relations, workflows, and webhooks.

## Order Features

| Feature | Description |
|---|---|
| **Automatic Totals** | Line-item and aggregate totals are recomputed on every update |
| **Tax Breakdowns** | Per-item and order-level tax calculations with inclusive/exclusive support |
| **Coupon Application** | Discounts and cashback applied at the line-item level |
| **Billing Period Normalization** | Automatic conversion between different recurrence periods |
| **Composite Line Items** | Support for bundled products with multiple price components |
| **Lifecycle Management** | State transitions and approval workflows |

## Managing Orders via Pricing API 

The [Entity API](/docs/entities/entity-api) handles basic data operations, but orders require additional logic: lifecycle management, state transitions, and line-item total recomputation.

Use the [Pricing API](/api/pricing) for all programmatic order operations. It wraps the Entity API with this logic.

### Key Endpoints

| Endpoint | Method | Description |
|---|---|---|
| `/v1/order` | POST | Create a new order with automatic total computation |
| `/v1/order/{id}` | PUT | Update an existing order (full replacement) |
| `/v1/pricing:compute` | POST | Calculate pricing details without creating an order |
| `/v1/public/cart:checkout` | POST | Convert a cart to an order or quote |

### Example: Updating an Order 

Order `line_items` changes must go through the [Pricing API](/api/pricing) to recompute totals correctly.

Both examples authenticate with an [Access Token](/docs/auth/access-tokens):

  

Modify the `line_items` and send a PUT request. The update is a full replacement -- no PATCH endpoint exists for partial updates.

  

### Promo Code Validation

Validate promo codes before applying them to an order:

```
POST /v1/public/validate-promo-codes
```

This public endpoint checks code validity, usage limits, and applicable price items. Use it in customer-facing journeys to provide real-time feedback on promotional codes.