Skip to main content

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​

FeatureDescription
Automatic TotalsLine-item and aggregate totals are recomputed on every update
Tax BreakdownsPer-item and order-level tax calculations with inclusive/exclusive support
Coupon ApplicationDiscounts and cashback applied at the line-item level
Billing Period NormalizationAutomatic conversion between different recurrence periods
Composite Line ItemsSupport for bundled products with multiple price components
Lifecycle ManagementState 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​

EndpointMethodDescription
/v1/orderPOSTCreate a new order with automatic total computation
/v1/order/{id}PUTUpdate an existing order (full replacement)
/v1/pricing:computePOSTCalculate pricing details without creating an order
/v1/public/cart:checkoutPOSTConvert 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:

Getting an Order using the Entity API
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.

Updating an Order via Pricing API
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.