Webhook Validator
Calls an external HTTP endpoint to validate and optionally modify the cart during cart validation.
Overview
The Webhook Validator delegates cart validation to an external HTTP endpoint that you host. During cart validation, Omnium sends the cart to your endpoint as a POST request. Your endpoint inspects the cart and returns a validation result that can:
- approve the cart,
- reject it with one or more validation errors, and/or
- return a modified cart (for example with adjusted line items, prices, or properties) that Omnium applies back to the cart.
This makes it suitable for custom validation rules, external stock or price checks, fraud screening, or any logic that must run against the cart and lives in your own systems.
The Webhook Validator operates on the cart. It runs when the cart is validated — for example via the cart Validate endpoint and other cart validation flows. It does not run against orders.
Identifier
| Property | Value |
|---|---|
| Connector ID | webhookValidator |
| Validation Type | External |
Setup
Add a connector named webhookValidator to the Connectors section in tenant settings. The connector's host is the URL Omnium posts the cart to.
The name must be exactly webhookValidator — that is how Omnium locates the connector for this validator.
Authentication
Omnium sets the Authorization header on every request based on the connector configuration. Use one of:
| Field | Header sent |
|---|---|
bearerToken | Authorization: Bearer <token> |
token | Authorization: Token <token> |
username + password | Authorization: Basic <base64> |
For other schemes, add headers via customHeaders instead.
Properties
| Key | Type | Default | Description |
|---|---|---|---|
IsRequestWrapperEnabled | bool | false | When true, the cart is wrapped in a request envelope ({ "cart": { ... } }) instead of being sent as the bare cart object. |
IsOnlyLineItemsUpdated | bool | false | When true and your response returns a cart in value, only the line items (value.orderForm.lineItems) are applied back to the cart. When false, the entire returned cart is applied. |
Optional connector fields
| Field | Type | Description |
|---|---|---|
customHeaders | array | Extra HTTP headers added to every request |
timeOut | timespan | Request timeout (e.g. "00:00:30") |
enabledForMarkets | string[] | Only run for these markets |
disabledForMarkets | string[] | Exclude these markets |
enabledForMarketGroups | string[] | Only run for these market groups |
disabledForMarketGroups | string[] | Exclude these market groups |
Request — what your endpoint receives
Omnium sends a POST request to the connector's host with the cart as the JSON body. Field names are camelCase.
Default (no wrapper): the body is the cart object directly.
The body is the full cart (OmniumCart) — the same model returned by the Cart API. The fields above are illustrative; the actual payload contains the complete cart.
With IsRequestWrapperEnabled = true: the cart is nested under cart.
Request headers
| Header | Value |
|---|---|
Content-Type | application/json |
Accept | application/json |
User-Agent | OmniumOms/{version} |
Authorization | Based on connector auth config (see Authentication) |
Plus any headers configured via customHeaders.
Response — what your endpoint must return
Return HTTP 200 with a JSON validation result:
| Field | Type | Description |
|---|---|---|
isValidatedSuccessful | bool | true if the cart passed. Defaults to true if omitted. Forced to false whenever validationErrors is non-empty. |
validationErrors | array | Validation errors. A non-empty list fails validation. |
validationWarnings | array | Warnings. Do not fail validation. |
validationMessage | string | Optional overall message. |
value | object | Optional. A modified cart to apply back (see Modifying the cart). |
Each entry in validationErrors / validationWarnings:
| Field | Type | Description |
|---|---|---|
message | string | Human-readable message. |
translateKey | string | Optional translation key. |
validationType | string | Category, e.g. External, Inventory, Price, Customer. |
referenceId | string | Optional reference, e.g. a SKU or line item ID. |
Approve the cart
Return 200 with {} or:
Reject the cart
Return one or more validationErrors. A non-empty list marks the cart as invalid regardless of isValidatedSuccessful.
Modifying the cart
To change the cart, return the updated cart in value. Omnium applies it back to the cart.
- When
IsOnlyLineItemsUpdated = true, onlyvalue.orderForm.lineItemsis applied; the rest of the returned cart is ignored. - When
IsOnlyLineItemsUpdated = false(default), the full returned cart is applied.
The request envelope and the response use different field names for the cart. With IsRequestWrapperEnabled enabled, the request wraps the cart under cart, but the response must always return the cart under value.
Behavior
| Condition | Result |
|---|---|
HTTP 200, isValidatedSuccessful: true, no validationErrors | Cart passes |
HTTP 200 with a non-empty validationErrors | Cart fails validation; errors are returned to the caller |
HTTP 200 with value | The returned cart (or only its line items) is applied back to the cart |
| Non-2xx response | Validation fails with an External error containing the status code and response body |
Omnium sends camelCase field names in the request. Field matching on the response is case-insensitive, so isValidatedSuccessful and IsValidatedSuccessful are both accepted.
