Skip to content

create-pos-order ​

Method: POST
Path: /pos/orders

Tags: Orders

Summary ​

Create POS order

Description ​

Creates an order from a POS cart. Returns an Order with payment_required and payment_info. Include payment_method to create an initial payment request. When the customer's loyalty points, credit balance or a discount pay the whole order, no payment is requested, whatever the method. Paid by points or a discount alone, the order comes back already confirmed (awaiting_approval when the store doesn't approve orders automatically; complete when it is collected in store with nothing to ship) with payment_status success. Paid by its credit balance, with or without points, it stays pending until that balance is settled against it. If the customer can't be identified at that moment, the order comes back pending, and its purchase completes once the customer is identified. When the credit balance pays only part of the order, its payments include a bank transfer for that credit, and the order stays pending until the credit is settled against it and the rest is paid. If the store's type can't be determined for the cashier's session, the request fails with a 503 and the store-type-unavailable error code, and nothing is placed: retry, or sign in on the device again. Credit balance applied to the cart must be within what the customer can spend now, which leaves out credit their other unpaid orders have claimed. When credit balance can't be used for a moment, an order using it fails with a 409 and the credit-balance-unavailable error code, and nothing is placed: retry shortly. The payment method must be one the store offers on the POS's sales channel; any other is refused with a 400.

Pos SDK Usage ​

SDK Method: pos.createOrder()

Example:

typescript
const { data, error } = await pos.createOrder({
  cart_id: "01H9CART12345ABCDE",
  payment_method: { payment_provider_slug: "cash" },
});

if (error) {
  console.error("Failed to create order:", error.message);
} else {
  console.log("Order created:", data.order.order_number);
  console.log("Payment required:", data.payment_required);
}

TypeScript Definition ​

typescript
"create-pos-order": {
        parameters: {
            query?: never;
            header?: never;
            path?: never;
            cookie?: never;
        };
        /** @description Request body */
        requestBody: {
            content: {
                "application/json": {
                    cart_id: string;
                    payment_method?: components["schemas"]["PosPaymentMethodPayload"];
                };
            };
        };
        responses: {
            /** @description OK */
            200: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": {
                        message: string;
                        success: boolean;
                        content: {
                            order: components["schemas"]["Order"];
                            /** @description `true` when something is left to pay after the customer's loyalty points, credit balance and discounts; `false` when they pay the whole order. */
                            payment_required: boolean;
                            /** @description Gateway initiation details when an auto payment method is used and something is left to pay; otherwise `null`. Always `null` when `payment_required` is `false`. */
                            payment_info: components["schemas"]["JusPayHyperCheckoutResponse"] | components["schemas"]["JusPayExpressCheckoutResponse"] | null;
                        };
                        /** @description Analytics events to emit for the change this request made, each with a server-issued `event_id`. Replay them to your analytics destinations so your client-side and server-side copies of the same action dedupe. Empty when the request produced no analytics event. */
                        events: components["schemas"]["StorefrontResponseEvent"][];
                    };
                };
            };
            400: components["responses"]["BadRequest"];
            401: components["responses"]["Unauthorized"];
            /** @description The order uses credit balance, which can't be used at the moment. Nothing is placed; retry shortly. */
            409: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": {
                        /** @example Paying with credit balance waits for the payment ledger update to finish; try again shortly */
                        message: string;
                        /** @default false */
                        success: boolean;
                        /** @example credit-balance-unavailable */
                        code: string;
                        details?: string;
                    };
                };
            };
            /** @description The store's type can't be determined for the cashier's session yet. Nothing is placed; retry, or sign in on the device again. */
            503: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": {
                        /** @example The store's type is not known yet. Try again. */
                        message: string;
                        /** @default false */
                        success: boolean;
                        /** @example store-type-unavailable */
                        code: string;
                        details?: string;
                    };
                };
            };
        };
    };

Component References ​

ReferenceResolves To
components["schemas"]["PosPaymentMethodPayload"]PosPaymentMethodPayload
components["schemas"]["Order"]Order
components["schemas"]["JusPayHyperCheckoutResponse"]JusPayHyperCheckoutResponse
components["schemas"]["JusPayExpressCheckoutResponse"]JusPayExpressCheckoutResponse
components["schemas"]["StorefrontResponseEvent"]StorefrontResponseEvent
components["responses"]["BadRequest"]BadRequest
components["responses"]["Unauthorized"]Unauthorized

Request Body ​

Request body

Content Types: application/json

Responses ​

200 ​

OK

400 ​

Bad request

401 ​

Not authorized for given operation on the Resource

409 ​

The order uses credit balance, which can't be used at the moment. Nothing is placed; retry shortly.

503 ​

The store's type can't be determined for the cashier's session yet. Nothing is placed; retry, or sign in on the device again.

OpenAPI Definition ​

json
{
  "operationId": "create-pos-order",
  "summary": "Create POS order",
  "description": "Creates an order from a POS cart. Returns an `Order` with `payment_required` and `payment_info`. Include `payment_method` to create an initial payment request. When the customer's loyalty points, credit balance or a discount pay the whole order, no payment is requested, whatever the method. Paid by points or a discount alone, the order comes back already `confirmed` (`awaiting_approval` when the store doesn't approve orders automatically; `complete` when it is collected in store with nothing to ship) with `payment_status` `success`. Paid by its credit balance, with or without points, it stays `pending` until that balance is settled against it. If the customer can't be identified at that moment, the order comes back `pending`, and its purchase completes once the customer is identified. When the credit balance pays only part of the order, its payments include a bank transfer for that credit, and the order stays `pending` until the credit is settled against it and the rest is paid. If the store's type can't be determined for the cashier's session, the request fails with a 503 and the `store-type-unavailable` error code, and nothing is placed: retry, or sign in on the device again. Credit balance applied to the cart must be within what the customer can spend now, which leaves out credit their other unpaid orders have claimed. When credit balance can't be used for a moment, an order using it fails with a 409 and the `credit-balance-unavailable` error code, and nothing is placed: retry shortly. The payment method must be one the store offers on the POS's sales channel; any other is refused with a 400.",
  "parameters": [],
  "requestBody": {
    "description": "Request body",
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "cart_id": {
              "type": "string"
            },
            "payment_method": {
              "$ref": "#/components/schemas/PosPaymentMethodPayload"
            }
          },
          "required": [
            "cart_id"
          ]
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string"
              },
              "success": {
                "type": "boolean"
              },
              "content": {
                "properties": {
                  "order": {
                    "$ref": "#/components/schemas/Order"
                  },
                  "payment_required": {
                    "description": "`true` when something is left to pay after the customer's loyalty points, credit balance and discounts; `false` when they pay the whole order.",
                    "type": "boolean"
                  },
                  "payment_info": {
                    "description": "Gateway initiation details when an auto payment method is used and something is left to pay; otherwise `null`. Always `null` when `payment_required` is `false`.",
                    "oneOf": [
                      {
                        "$ref": "#/components/schemas/JusPayHyperCheckoutResponse"
                      },
                      {
                        "$ref": "#/components/schemas/JusPayExpressCheckoutResponse"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "order",
                  "payment_required",
                  "payment_info"
                ],
                "type": "object"
              },
              "events": {
                "description": "Analytics events to emit for the change this request made, each with a server-issued `event_id`. Replay them to your analytics destinations so your client-side and server-side copies of the same action dedupe. Empty when the request produced no analytics event.",
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/StorefrontResponseEvent"
                }
              }
            },
            "required": [
              "message",
              "success",
              "content",
              "events"
            ]
          }
        }
      }
    },
    "400": {
      "$ref": "#/components/responses/BadRequest"
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "409": {
      "description": "The order uses credit balance, which can't be used at the moment. Nothing is placed; retry shortly.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string",
                "examples": [
                  "Paying with credit balance waits for the payment ledger update to finish; try again shortly"
                ]
              },
              "success": {
                "type": "boolean",
                "default": false
              },
              "code": {
                "type": "string",
                "examples": [
                  "credit-balance-unavailable"
                ]
              },
              "details": {
                "type": "string"
              }
            },
            "required": [
              "message",
              "success",
              "code"
            ]
          }
        }
      }
    },
    "503": {
      "description": "The store's type can't be determined for the cashier's session yet. Nothing is placed; retry, or sign in on the device again.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string",
                "examples": [
                  "The store's type is not known yet. Try again."
                ]
              },
              "success": {
                "type": "boolean",
                "default": false
              },
              "code": {
                "type": "string",
                "examples": [
                  "store-type-unavailable"
                ]
              },
              "details": {
                "type": "string"
              }
            },
            "required": [
              "message",
              "success",
              "code"
            ]
          }
        }
      }
    }
  },
  "externalDocs": {
    "url": "https://llm-docs.commercengine.io/storefront/operations/create-pos-order",
    "description": "API reference for the create-pos-order operation"
  },
  "security": [
    {
      "Authorization": []
    }
  ],
  "tags": [
    "Orders"
  ],
  "x-speakeasy-group": "pos",
  "x-speakeasy-name-override": "createPosOrder"
}

Auto-generated from OpenAPI spec and TypeScript definitions

Last updated: