API Reference
Introduction to Omnium Orders
An order in Omnium could originate from any sales channel and operate and behave in different ways in. For instance, it could be an order placed from a web shop, a sale from POS, or a click&collect reservation. As a modern order management system, Omnium accepts all types of orders, and offers customizable workflows for all kinds.
In this section you’ll (hopefully) learn everything you need to know to get started importing, managing and reading orders using Omnium’s API.
Order properties
When working with the Order API, the same model is used for adding, updating and fetching orders.
Crucial properties
ID
The ID of the order must be unique. If you want Omnium to generate an order number, this is possible using the X API when adding orders.
Customer ID: This is usually set to the customer’s phone number, email or ID from an external system. We accept everything, but try avoid 'special characters' such as '+' or '%'.
MarketId
The order must have a market ID which corresponds to a market added to Omnium. A market would typically be “Epic Enterprise Norway”, which would contain stores such as “Epic Enterprise Webshop” and “Epic Enterprise Store New York”. Markets are not entities that are added to Omnium, but settings that are configured.
StoreId
The order must also have a “StoreId” set which corresponds to a store in Omnium. The StoreId should represent the selling store. Unlike markets, stores are entities that are created or imported to Omnium.
OrderType
The OrderType must be set to a corresponding OrderType defined in the Omnium configuration, which will ensure the correct workflow is executed when the order is processed.
Status
The order status defines the current state of the order and should also match a status defined for the current OrderType. Typically, this would be set to "New" for orders that has yet been processed (not yet shipped for instance, and/or payment has not been captured).
Complete model
The full order model definition can be found in
swagger.
OrderForm and LineItems(Order Lines)
Each order contains an order form. The order form contains lists of order lines, payments and shipments. LineItems is a list of order lines, each order line contains price(s), quantity, product data and various meta data.
Shipments
The order form contains one or multiple shipments. A shipment contains shipping information and order lines. An order will usually only contain a single shipment, but for partial deliveries or multiple senders or recipients, there will be multiple shipments. A shipment contains one or multiple order lines, and an order line cannot be added to multiple shipments. A shipment must also contain a "warehouseCode". This should be set to the ID of a store in Omnium that is the shipment sender.
Payments
For every order, there should be a payment corresponding to the total amount of the order. Most commonly, an order will be sent to Omnium after the order has been placed from an e-commerce site. That means that the payment should already be authenticated in the payment provider (such as Klarna, Paypal or Vipps). Omnium will then be able to void, capture or credit the payment later on in the order process. The required properties in order to get this right are the following:
Property | Type | Description | Information |
---|---|---|---|
PaymentMethodName | string | Value to indentify correct payment provider("Klarna" for instance) | Required |
TransactionId | string | Unique id for this payment(from payment provider) | Required |
TransactionType | string | "Authorization", "Captured", "Credit", "Invoiced", "ReleaseRemainingAuthorization" or "Invoiced" | Required |
Status | string | "Processed" when successful, and "Failed" on unsuccessful | Required |
Amount | decimal | The amount for this payment transaction | Required |
Discount
There are a few ways to add discounts to an order:
-
Simple Discount: Set the
discounted
property on an order line. This allows you to set the discounted amount directly on the order line. Example: An order line containing two sweaters with an original price of $200, but with a 10% discount. -
Advanced Discount: Set the list of
discounts
objects beneathorderForm
. This allows you to add more advanced discounts to the order, such as order-level discounts, percentage-based discounts, or other types, like "3 for 2". -
Shipment-Specific Discount: The model is identical to the advanced discount but should be added beneath the shipment. This is typically used for adding a "free shipping" discount to the shipment.
Reward Types
Value | Type |
---|---|
0 | None |
1 | Money |
2 | Percentage |
3 | Free |
4 | FixedPrice |
5 | Gift |
6 | MultiBuys |
Discount Types
Value | Type |
---|---|
0 | None |
1 | LineItem |
2 | Order |
3 | Shipping |
4 | Manual |
5 | BonusPoints |
Examples
Simple: Discounted Order Line
Advanced: 20% Order-Level Discount
Advanced: $10 Order-Level Discount
Advanced: Fixed Price Order Line Discount
All items involved in the fixed price promotion should be added to the list skuIds
. The promotion calculator will prioritize items from highest to lowest price.
If the setting SplitMultibuyPromotionOrderLines
is true, the order lines involved in the promotion will be split to have quantity = 1
per order line.
Advanced: 3 for 2 Order Line Discount
All items involved in the multi-buys promotion should be added to the list skuIds
. By default, the promotion calculator will prioritize items from lowest to highest price. This can be changed with the setting SortMultibuyItemsDescending
.
Advanced: Combination of Fixed Price and Percentage Order Line Discounts
Order the discounts from highest priority.
Shipping Discount
Price properties
The order line consists of multiple price properties. Generally, only the PlacedPrice and TaxRate should be set, in order for the other price properties to be calculated correctly.
PlacedPrice The full price per item, without any discounts added. The PlacedPrice should not be multiplied by quantity.
DiscountedPrice
This price is calculated by the order calculator and should not be set manually.
The discounted price is the total price of the order line reduced by the order line level discounts applied. Any order level discounts are not applied to the discounted price.
The discounted price is calculated with the following formula:
DiscountedPrice = ( ( Quantity - CanceledQuantity ) * PlacedPrice ) - ( ( Discounted / Quantity ) * ( Quantity - CanceledQuantity ) )
ExtendedPrice
This price is calculated by the order calculator and should not be set manually.
The extended price is the total line item price with all discounts applied, including both order line level and order level discounts.
The extended price is calculated with the following formula:
ExtendedPrice = DiscountedPrice - ( ( DiscountedPrice / ( [ Sum of DiscountedPrice for all order lines ] ) * DiscountAmount )
SuggestedRetailPrice
This price is not used in any calculations, and will not be changed by Omnium.
The placed price could be a customer-specific price based on price agreements (e.g., 10% off suggested retail price). In these scenarios, the placed price would already contain a discount, and the suggested retail price could be used to indicate savings for the end customer by comparing suggested retail price to the discounted price.
The price could also be used for reports or statistics by third-party applications.
Price Example This is an example of how the prices would look after calculation when a 10% order discount is added to the order. The case is that the customer bought two products with an original price of $500, but with a 10% discount. So, the customer paid 2 x (500 - 10%) = 900.
Order types
The order type is used for triggering different workflows. A point of sale order can have a different process than an online order.
The order type string is a free text string, but orders in Omnium should have a corresponding order type in the settings in order for workflows to run correctly.
Omnium has five predefined order types, commonly used:
Order type | Description |
---|---|
Pos | Order from Point of Sale system |
Online | Order from B2B / B2C web portals |
ClickAndCollect | Click and collect orders (Not paid) |
Bopis | Buy online, pick up in store (Paid) |
PreOrder | Orders placed for products that are not yet released |
Adding orders
An order can be added to Omnium in numerous ways. It can be:
- Imported via API
- Created from a cart via API
- Created from a cart via Omnium's UI
- Created from Omnium's UI
- Imported from Excel via Omnium's UI
Example: Creating an order
In order to meet multiple demands and be as flexible as Omnium is, Omnium’s order model is rather large and contains many fields. Most likely, you’ll not be in need of all of them. Below is a basic example of how to add an order, using the POST /api/Orders API.
Relevant swagger documentation
Fetching orders
There are multiple endpoints that could be used to retrieve an order, as there are various ways of searching for an order. This could be faceted free-text searching, filtered search by customer metadata or product data, or simply fetching a single order using the order ID.
Get a single order
Standard Online order
This is the data from the order created in the order creation example.
Updating orders
There are multiple ways an order could be update, and multipe reasons to update an order. Sometimes, you would only like to update data on an order, without triggering any other logic. For this, the patch endpoint would typically be a good fit.
Triggering workflows
An order update often involves a status update which should trigger a workflow in Omnium. A workflow contains workflow steps which triggeres actions configured for the current status. Examples of this could be to capture payment, send email/sms, book shipping, or reduce inventory. Workflows are an essencial part of how Omnium works. More information
There are endpoints specifically created for the purpose of updating order status and the workflow connected to the status: More information
Order/order-config#workflow-steps
Errors
The orders contain a list of errors in the property Errors. This is a list of OmniumEntityError, a class designed to capture detailed information about errors related to order processing. To add error messages to an order, simply add new items to this list.
Validate Order
Webhook validation for orders can be enabled from order settings in configuration. The validator will be run on all updates to the order from the UI. It’s possible to add custom validation using the webhook validator. The webhook validator will post the order. to a provided endpoint, and accept the validated order as response.
Add the webhook validator to Connectors in settings:
Required properties
Property | Sample value | Description |
---|---|---|
Name | webhookOrderValidator | Name of Omnium connector provider. In this case it must be "webhookOrderValidator" |
Host | https://acme.com | Endpoint host |
Implementations | "IWebhookOrderValidator" | Connector capabilities. Must include IWebhookOrderValidator. |