Order Validation

Purpose

This allows ordering platforms to pre-validate a customer’s basket at the checkout stage, before the order is completed. As the source of truth for item availability, pricing rules and tax calculation, the POS verifies each of these, so any issues can be flagged to the guest before payment is captured.

Format

The complete basket content is sent in the request body of a webhook event to a specified webhook endpoint. The order schema is the same as the Order Notification payload , with two additional top-level fields validationId and callbackUrl

No Order Creation
Do not treat this request as an order to inject. Do not create a ticket, hold inventory, or return a POS order ID.

Response

The POS is expected to validate the following;

  • Confirmed Item availability
  • Correct pricing
  • Correct tax details

There are two methods of responding;

Synchronous validation

Return 200 OK with a JSON body containing the validation result. This is recommended where possible, so validation errors reach the guest straight away.

See flow diagram here

Asynchronous validation

Use this when validation requires a round trip to in-store systems and cannot complete within a few seconds.

Return 202 or a 200 with an empty body. Deliverect then marks the validation as pending and waits for a POST to the providedcallbackUrl ( see Validation Response Async )​

See flow diagram here

Validation Errors

The response should include structured validation errors as shown in the Response section below which are relayed back to the ordering channel to surface any issues to the guest, for example to prompt them to adjust their cart as items are out of stock.

Once all corrections are applied and a customer completes checkout, an order would then be created and delivered to the POS Order Notification endpoint.

Inference rules

You can return a minimal response and let Deliverect infer the errors, see examples in the 200 response body below.

The rules are applied in order listed below:

Prefer explicit errors
When you know the failure mode, return explicit "errors": [] entries with the correct code. This gives ordering channels the clearest signal to surface to customers.

RuleApplies when your response includesDeliverect's result
Explicit errorsEntries in errors[]Errors take precedence, so never set isValid: true while also reporting errors.

See list of error codes here
Partial stockitems[] with available: false and quantity > 0 but below the requested quantityquantity_unavailable
Full unavailabilityitems[] with available: false and quantity of 0 or omittedproduct_snoozed
Price comparisonitems[].priceCompared to the matching request line (by itemId, then plu). A difference over 1 cent returns price_mismatch.
Tax comparisoncharges.tax or taxTotalCompared to the request's taxTotal. A difference over 1 cent returns tax_mismatch.
De-duplicationIdentical (code, path) pairsReturned once only.
Payload

The body is the standard Generic POS order object (same structure as an order sent to ordersWebhookURL), with two additional top-level fields: validationId and callbackUrl.

Prices and amounts are integer values in the smallest currency unit (cents), consistent with the order webhook.

string

Unique identifier for this validation round. Echo this in async callbacks.

string

Deliverect URL to POST the completed result when using async validation. Format: {apiBaseUrl}/orderValidation/{validationId}

string

Deliverect's identifier for the transient cart.

string

Deliverect account ID.

string

locationId is Deliverect's unique ID of the customer location

channelLinkId is Deliverect's unique identifier of an individual store in a location

string

posLocationId is an identifier of the location known on the POS side, it is stored within the POS config in Deliverect

integer
enum

Order type, as per the order webhook.

  • Pickup: 1
  • Delivery: 2
  • Eat in: 3
  • Curbside: 4
Allowed:
boolean

Whether the order has already been paid.

items
array of objects

Cart lines. Each line may include _id, Deliverect's internal line identifier.

items
integer

Total tax. Integer value in the smallest currency unit (cents), consistent with the order webhook.

payment
object
integer

Number of decimal digits used for currency amounts.

Headers
string
required

HMAC-SHA256 signature of the raw request body, computed with your shared secret. Verify this before processing the request.

Responses

LoadingLoading…