# Dispatch order to external POS

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://apidocs.cata.sg/pos-integration-service-api/api/v-1/orders/dispatch/llms.txt.
> For full documentation content, see https://apidocs.cata.sg/pos-integration-service-api/api/v-1/orders/dispatch/llms-full.txt.

POST http://localhost:8080/api/v1/orders/dispatch
Content-Type: application/json

Dispatches an order event to an external POS system through the connector layer.
Called by kds-management-service (internal service-to-service).

The order payload is validated for required fields, then dispatched as-is
(original bytes preserved for HMAC signature integrity).

The connector is resolved based on the store's registered webhook/provider.
If no active webhook exists, the order is persisted but not dispatched.


Reference: https://apidocs.cata.sg/pos-integration-service-api/api/v-1/orders/dispatch/dispatch-order-to-external-pos

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /api/v1/orders/dispatch:
    post:
      operationId: dispatch-order-to-external-pos
      summary: Dispatch order to external POS
      description: >
        Dispatches an order event to an external POS system through the
        connector layer.

        Called by kds-management-service (internal service-to-service).


        The order payload is validated for required fields, then dispatched
        as-is

        (original bytes preserved for HMAC signature integrity).


        The connector is resolved based on the store's registered
        webhook/provider.

        If no active webhook exists, the order is persisted but not dispatched.
      tags:
        - >-
          subpackage_api.subpackage_api/v1.subpackage_api/v1/orders.subpackage_api/v1/orders/dispatch
      parameters:
        - name: X-Api-Key
          in: header
          required: true
          schema:
            type: string
        - name: X-Tenant-ID
          in: header
          description: Tenant identifier
          required: false
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/api_v1_orders_dispatch_Dispatch order to
                  external POS_Response_200
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PostApiV1OrdersDispatchRequestBadRequestError
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PostApiV1OrdersDispatchRequestUnauthorizedError
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PostApiV1OrdersDispatchRequestInternalServerError
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                outletId:
                  type: string
                event:
                  type: string
                order:
                  $ref: >-
                    #/components/schemas/ApiV1OrdersDispatchPostRequestBodyContentApplicationJsonSchemaOrder
              required:
                - outletId
                - event
                - order
servers:
  - url: http://localhost:8080
components:
  schemas:
    ApiV1OrdersDispatchPostRequestBodyContentApplicationJsonSchemaOrderItemsItemsModifiersItems:
      type: object
      properties:
        modifierHeaderId:
          type: string
        modifierOptionId:
          type: string
        modifierHeaderName:
          type: string
        modifierOptionName:
          type: string
        price:
          type: integer
        quantity:
          type: integer
      required:
        - modifierHeaderId
        - modifierOptionId
        - modifierHeaderName
        - modifierOptionName
        - price
        - quantity
      title: >-
        ApiV1OrdersDispatchPostRequestBodyContentApplicationJsonSchemaOrderItemsItemsModifiersItems
    ApiV1OrdersDispatchPostRequestBodyContentApplicationJsonSchemaOrderItemsItems:
      type: object
      properties:
        plu:
          type: string
        name:
          type: string
        quantity:
          type: integer
        itemOnlyPrice:
          type: integer
        modifierOnlyPrice:
          type: integer
        itemPrice:
          type: integer
        itemSubTotal:
          type: integer
        modifiers:
          type: array
          items:
            $ref: >-
              #/components/schemas/ApiV1OrdersDispatchPostRequestBodyContentApplicationJsonSchemaOrderItemsItemsModifiersItems
      required:
        - plu
        - name
        - quantity
        - itemOnlyPrice
        - modifierOnlyPrice
        - itemPrice
        - itemSubTotal
        - modifiers
      title: >-
        ApiV1OrdersDispatchPostRequestBodyContentApplicationJsonSchemaOrderItemsItems
    ApiV1OrdersDispatchPostRequestBodyContentApplicationJsonSchemaOrderPayment:
      type: object
      properties:
        amount:
          type: integer
        tip:
          type: integer
        method:
          type: string
      required:
        - amount
        - tip
        - method
      title: >-
        ApiV1OrdersDispatchPostRequestBodyContentApplicationJsonSchemaOrderPayment
    ApiV1OrdersDispatchPostRequestBodyContentApplicationJsonSchemaOrder:
      type: object
      properties:
        uuid:
          type: string
        orderRefNo:
          type: string
        dailyQueueNo:
          type: string
        storeUuid:
          type: string
        storeName:
          type: string
        deliveryMethod:
          type: string
        status:
          type: string
        currency:
          type: string
        isPreorder:
          type: boolean
        items:
          type: array
          items:
            $ref: >-
              #/components/schemas/ApiV1OrdersDispatchPostRequestBodyContentApplicationJsonSchemaOrderItemsItems
        subtotal:
          type: integer
        discountTotal:
          type: integer
        serviceCharge:
          type: integer
        deliveryFee:
          type: integer
        totalPay:
          type: integer
        payment:
          $ref: >-
            #/components/schemas/ApiV1OrdersDispatchPostRequestBodyContentApplicationJsonSchemaOrderPayment
        createdAt:
          type: string
          format: date-time
      required:
        - uuid
        - orderRefNo
        - dailyQueueNo
        - storeUuid
        - storeName
        - deliveryMethod
        - status
        - currency
        - isPreorder
        - items
        - subtotal
        - discountTotal
        - serviceCharge
        - deliveryFee
        - totalPay
        - payment
        - createdAt
      title: ApiV1OrdersDispatchPostRequestBodyContentApplicationJsonSchemaOrder
    api_v1_orders_dispatch_Dispatch order to external POS_Response_200:
      type: object
      properties:
        code:
          type: integer
        isSuccess:
          type: boolean
        message:
          type: string
        orderId:
          type: string
        dispatched:
          type: boolean
        reason:
          type: string
      required:
        - code
        - isSuccess
        - message
        - orderId
        - dispatched
        - reason
      title: api_v1_orders_dispatch_Dispatch order to external POS_Response_200
    ApiV1OrdersDispatchPostResponsesContentApplicationJsonSchemaError:
      type: object
      properties:
        code:
          type: integer
        message:
          type: string
        details:
          type: string
        field:
          type: string
      required:
        - code
        - message
        - details
        - field
      title: ApiV1OrdersDispatchPostResponsesContentApplicationJsonSchemaError
    PostApiV1OrdersDispatchRequestBadRequestError:
      type: object
      properties:
        error:
          $ref: >-
            #/components/schemas/ApiV1OrdersDispatchPostResponsesContentApplicationJsonSchemaError
      required:
        - error
      title: PostApiV1OrdersDispatchRequestBadRequestError
    PostApiV1OrdersDispatchRequestUnauthorizedError:
      type: object
      properties:
        error:
          $ref: >-
            #/components/schemas/ApiV1OrdersDispatchPostResponsesContentApplicationJsonSchemaError
      required:
        - error
      title: PostApiV1OrdersDispatchRequestUnauthorizedError
    PostApiV1OrdersDispatchRequestInternalServerError:
      type: object
      properties:
        error:
          $ref: >-
            #/components/schemas/ApiV1OrdersDispatchPostResponsesContentApplicationJsonSchemaError
      required:
        - error
      title: PostApiV1OrdersDispatchRequestInternalServerError
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key

```

## SDK Code Examples

```python api_v1_orders_dispatch_Dispatch order to external POS_example
import requests

url = "http://localhost:8080/api/v1/orders/dispatch"

payload = {
    "outletId": "store-uuid-123",
    "event": "order.paid",
    "order": {
        "uuid": "ord-550e8400-e29b-41d4-a716-446655440000",
        "orderRefNo": "ORD-2024-001",
        "dailyQueueNo": "A12",
        "storeUuid": "store-uuid-123",
        "storeName": "Downtown Branch",
        "deliveryMethod": "DELIVERY",
        "status": "PAID",
        "currency": "AED",
        "isPreorder": False,
        "items": [
            {
                "plu": "SKU-BURGER-01",
                "name": "Classic Burger",
                "quantity": 2,
                "itemOnlyPrice": 35,
                "modifierOnlyPrice": 5,
                "itemPrice": 40,
                "itemSubTotal": 80,
                "modifiers": [
                    {
                        "modifierHeaderId": "mh-cheese",
                        "modifierOptionId": "mo-extra-cheese",
                        "modifierHeaderName": "Cheese",
                        "modifierOptionName": "Extra Cheese",
                        "price": 5,
                        "quantity": 1
                    }
                ]
            }
        ],
        "subtotal": 80,
        "discountTotal": 0,
        "serviceCharge": 0,
        "deliveryFee": 5,
        "totalPay": 85,
        "payment": {
            "amount": 85,
            "tip": 5,
            "method": "CARD"
        },
        "createdAt": "2024-12-01T14:30:00Z"
    }
}
headers = {
    "X-Tenant-ID": "string",
    "X-Api-Key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript api_v1_orders_dispatch_Dispatch order to external POS_example
const url = 'http://localhost:8080/api/v1/orders/dispatch';
const options = {
  method: 'POST',
  headers: {
    'X-Tenant-ID': 'string',
    'X-Api-Key': '<apiKey>',
    'Content-Type': 'application/json'
  },
  body: '{"outletId":"store-uuid-123","event":"order.paid","order":{"uuid":"ord-550e8400-e29b-41d4-a716-446655440000","orderRefNo":"ORD-2024-001","dailyQueueNo":"A12","storeUuid":"store-uuid-123","storeName":"Downtown Branch","deliveryMethod":"DELIVERY","status":"PAID","currency":"AED","isPreorder":false,"items":[{"plu":"SKU-BURGER-01","name":"Classic Burger","quantity":2,"itemOnlyPrice":35,"modifierOnlyPrice":5,"itemPrice":40,"itemSubTotal":80,"modifiers":[{"modifierHeaderId":"mh-cheese","modifierOptionId":"mo-extra-cheese","modifierHeaderName":"Cheese","modifierOptionName":"Extra Cheese","price":5,"quantity":1}]}],"subtotal":80,"discountTotal":0,"serviceCharge":0,"deliveryFee":5,"totalPay":85,"payment":{"amount":85,"tip":5,"method":"CARD"},"createdAt":"2024-12-01T14:30:00Z"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go api_v1_orders_dispatch_Dispatch order to external POS_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "http://localhost:8080/api/v1/orders/dispatch"

	payload := strings.NewReader("{\n  \"outletId\": \"store-uuid-123\",\n  \"event\": \"order.paid\",\n  \"order\": {\n    \"uuid\": \"ord-550e8400-e29b-41d4-a716-446655440000\",\n    \"orderRefNo\": \"ORD-2024-001\",\n    \"dailyQueueNo\": \"A12\",\n    \"storeUuid\": \"store-uuid-123\",\n    \"storeName\": \"Downtown Branch\",\n    \"deliveryMethod\": \"DELIVERY\",\n    \"status\": \"PAID\",\n    \"currency\": \"AED\",\n    \"isPreorder\": false,\n    \"items\": [\n      {\n        \"plu\": \"SKU-BURGER-01\",\n        \"name\": \"Classic Burger\",\n        \"quantity\": 2,\n        \"itemOnlyPrice\": 35,\n        \"modifierOnlyPrice\": 5,\n        \"itemPrice\": 40,\n        \"itemSubTotal\": 80,\n        \"modifiers\": [\n          {\n            \"modifierHeaderId\": \"mh-cheese\",\n            \"modifierOptionId\": \"mo-extra-cheese\",\n            \"modifierHeaderName\": \"Cheese\",\n            \"modifierOptionName\": \"Extra Cheese\",\n            \"price\": 5,\n            \"quantity\": 1\n          }\n        ]\n      }\n    ],\n    \"subtotal\": 80,\n    \"discountTotal\": 0,\n    \"serviceCharge\": 0,\n    \"deliveryFee\": 5,\n    \"totalPay\": 85,\n    \"payment\": {\n      \"amount\": 85,\n      \"tip\": 5,\n      \"method\": \"CARD\"\n    },\n    \"createdAt\": \"2024-12-01T14:30:00Z\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-Tenant-ID", "string")
	req.Header.Add("X-Api-Key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby api_v1_orders_dispatch_Dispatch order to external POS_example
require 'uri'
require 'net/http'

url = URI("http://localhost:8080/api/v1/orders/dispatch")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["X-Tenant-ID"] = 'string'
request["X-Api-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"outletId\": \"store-uuid-123\",\n  \"event\": \"order.paid\",\n  \"order\": {\n    \"uuid\": \"ord-550e8400-e29b-41d4-a716-446655440000\",\n    \"orderRefNo\": \"ORD-2024-001\",\n    \"dailyQueueNo\": \"A12\",\n    \"storeUuid\": \"store-uuid-123\",\n    \"storeName\": \"Downtown Branch\",\n    \"deliveryMethod\": \"DELIVERY\",\n    \"status\": \"PAID\",\n    \"currency\": \"AED\",\n    \"isPreorder\": false,\n    \"items\": [\n      {\n        \"plu\": \"SKU-BURGER-01\",\n        \"name\": \"Classic Burger\",\n        \"quantity\": 2,\n        \"itemOnlyPrice\": 35,\n        \"modifierOnlyPrice\": 5,\n        \"itemPrice\": 40,\n        \"itemSubTotal\": 80,\n        \"modifiers\": [\n          {\n            \"modifierHeaderId\": \"mh-cheese\",\n            \"modifierOptionId\": \"mo-extra-cheese\",\n            \"modifierHeaderName\": \"Cheese\",\n            \"modifierOptionName\": \"Extra Cheese\",\n            \"price\": 5,\n            \"quantity\": 1\n          }\n        ]\n      }\n    ],\n    \"subtotal\": 80,\n    \"discountTotal\": 0,\n    \"serviceCharge\": 0,\n    \"deliveryFee\": 5,\n    \"totalPay\": 85,\n    \"payment\": {\n      \"amount\": 85,\n      \"tip\": 5,\n      \"method\": \"CARD\"\n    },\n    \"createdAt\": \"2024-12-01T14:30:00Z\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java api_v1_orders_dispatch_Dispatch order to external POS_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("http://localhost:8080/api/v1/orders/dispatch")
  .header("X-Tenant-ID", "string")
  .header("X-Api-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"outletId\": \"store-uuid-123\",\n  \"event\": \"order.paid\",\n  \"order\": {\n    \"uuid\": \"ord-550e8400-e29b-41d4-a716-446655440000\",\n    \"orderRefNo\": \"ORD-2024-001\",\n    \"dailyQueueNo\": \"A12\",\n    \"storeUuid\": \"store-uuid-123\",\n    \"storeName\": \"Downtown Branch\",\n    \"deliveryMethod\": \"DELIVERY\",\n    \"status\": \"PAID\",\n    \"currency\": \"AED\",\n    \"isPreorder\": false,\n    \"items\": [\n      {\n        \"plu\": \"SKU-BURGER-01\",\n        \"name\": \"Classic Burger\",\n        \"quantity\": 2,\n        \"itemOnlyPrice\": 35,\n        \"modifierOnlyPrice\": 5,\n        \"itemPrice\": 40,\n        \"itemSubTotal\": 80,\n        \"modifiers\": [\n          {\n            \"modifierHeaderId\": \"mh-cheese\",\n            \"modifierOptionId\": \"mo-extra-cheese\",\n            \"modifierHeaderName\": \"Cheese\",\n            \"modifierOptionName\": \"Extra Cheese\",\n            \"price\": 5,\n            \"quantity\": 1\n          }\n        ]\n      }\n    ],\n    \"subtotal\": 80,\n    \"discountTotal\": 0,\n    \"serviceCharge\": 0,\n    \"deliveryFee\": 5,\n    \"totalPay\": 85,\n    \"payment\": {\n      \"amount\": 85,\n      \"tip\": 5,\n      \"method\": \"CARD\"\n    },\n    \"createdAt\": \"2024-12-01T14:30:00Z\"\n  }\n}")
  .asString();
```

```php api_v1_orders_dispatch_Dispatch order to external POS_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'http://localhost:8080/api/v1/orders/dispatch', [
  'body' => '{
  "outletId": "store-uuid-123",
  "event": "order.paid",
  "order": {
    "uuid": "ord-550e8400-e29b-41d4-a716-446655440000",
    "orderRefNo": "ORD-2024-001",
    "dailyQueueNo": "A12",
    "storeUuid": "store-uuid-123",
    "storeName": "Downtown Branch",
    "deliveryMethod": "DELIVERY",
    "status": "PAID",
    "currency": "AED",
    "isPreorder": false,
    "items": [
      {
        "plu": "SKU-BURGER-01",
        "name": "Classic Burger",
        "quantity": 2,
        "itemOnlyPrice": 35,
        "modifierOnlyPrice": 5,
        "itemPrice": 40,
        "itemSubTotal": 80,
        "modifiers": [
          {
            "modifierHeaderId": "mh-cheese",
            "modifierOptionId": "mo-extra-cheese",
            "modifierHeaderName": "Cheese",
            "modifierOptionName": "Extra Cheese",
            "price": 5,
            "quantity": 1
          }
        ]
      }
    ],
    "subtotal": 80,
    "discountTotal": 0,
    "serviceCharge": 0,
    "deliveryFee": 5,
    "totalPay": 85,
    "payment": {
      "amount": 85,
      "tip": 5,
      "method": "CARD"
    },
    "createdAt": "2024-12-01T14:30:00Z"
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-Api-Key' => '<apiKey>',
    'X-Tenant-ID' => 'string',
  ],
]);

echo $response->getBody();
```

```csharp api_v1_orders_dispatch_Dispatch order to external POS_example
using RestSharp;

var client = new RestClient("http://localhost:8080/api/v1/orders/dispatch");
var request = new RestRequest(Method.POST);
request.AddHeader("X-Tenant-ID", "string");
request.AddHeader("X-Api-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"outletId\": \"store-uuid-123\",\n  \"event\": \"order.paid\",\n  \"order\": {\n    \"uuid\": \"ord-550e8400-e29b-41d4-a716-446655440000\",\n    \"orderRefNo\": \"ORD-2024-001\",\n    \"dailyQueueNo\": \"A12\",\n    \"storeUuid\": \"store-uuid-123\",\n    \"storeName\": \"Downtown Branch\",\n    \"deliveryMethod\": \"DELIVERY\",\n    \"status\": \"PAID\",\n    \"currency\": \"AED\",\n    \"isPreorder\": false,\n    \"items\": [\n      {\n        \"plu\": \"SKU-BURGER-01\",\n        \"name\": \"Classic Burger\",\n        \"quantity\": 2,\n        \"itemOnlyPrice\": 35,\n        \"modifierOnlyPrice\": 5,\n        \"itemPrice\": 40,\n        \"itemSubTotal\": 80,\n        \"modifiers\": [\n          {\n            \"modifierHeaderId\": \"mh-cheese\",\n            \"modifierOptionId\": \"mo-extra-cheese\",\n            \"modifierHeaderName\": \"Cheese\",\n            \"modifierOptionName\": \"Extra Cheese\",\n            \"price\": 5,\n            \"quantity\": 1\n          }\n        ]\n      }\n    ],\n    \"subtotal\": 80,\n    \"discountTotal\": 0,\n    \"serviceCharge\": 0,\n    \"deliveryFee\": 5,\n    \"totalPay\": 85,\n    \"payment\": {\n      \"amount\": 85,\n      \"tip\": 5,\n      \"method\": \"CARD\"\n    },\n    \"createdAt\": \"2024-12-01T14:30:00Z\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift api_v1_orders_dispatch_Dispatch order to external POS_example
import Foundation

let headers = [
  "X-Tenant-ID": "string",
  "X-Api-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "outletId": "store-uuid-123",
  "event": "order.paid",
  "order": [
    "uuid": "ord-550e8400-e29b-41d4-a716-446655440000",
    "orderRefNo": "ORD-2024-001",
    "dailyQueueNo": "A12",
    "storeUuid": "store-uuid-123",
    "storeName": "Downtown Branch",
    "deliveryMethod": "DELIVERY",
    "status": "PAID",
    "currency": "AED",
    "isPreorder": false,
    "items": [
      [
        "plu": "SKU-BURGER-01",
        "name": "Classic Burger",
        "quantity": 2,
        "itemOnlyPrice": 35,
        "modifierOnlyPrice": 5,
        "itemPrice": 40,
        "itemSubTotal": 80,
        "modifiers": [
          [
            "modifierHeaderId": "mh-cheese",
            "modifierOptionId": "mo-extra-cheese",
            "modifierHeaderName": "Cheese",
            "modifierOptionName": "Extra Cheese",
            "price": 5,
            "quantity": 1
          ]
        ]
      ]
    ],
    "subtotal": 80,
    "discountTotal": 0,
    "serviceCharge": 0,
    "deliveryFee": 5,
    "totalPay": 85,
    "payment": [
      "amount": 85,
      "tip": 5,
      "method": "CARD"
    ],
    "createdAt": "2024-12-01T14:30:00Z"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:8080/api/v1/orders/dispatch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```