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 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 handles basic data operations, but orders require additional logic: lifecycle management, state transitions, and line-item total recomputation.
Use the Pricing API 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 to recompute totals correctly.
Both examples authenticate with an Access Token:
- API
- SDK (Javascript)
curl --location --request GET 'https://entity.sls.epilot.io/v1/entity/schemas/order?id=<order-id>' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <org-access-token>'
Modify the line_items and send a PUT request. The update is a full replacement -- no PATCH endpoint exists for partial updates.
- API
- SDK (Javascript)
curl --location --request PUT 'https://pricing-api.sls.epilot.io/v1/order/<order-id>' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <org-access-token>' \
--data-raw '{
"line_items": [
{
"description": "individual adjustment",
"_price": {
"unit_amount": 1000,
"unit_amount_decimal": "10.00",
"unit_amount_currency": "EUR"
}
}
]
}'
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.