# Create an order

Authorize a new order for a customer.

Endpoint: POST /orders
Version: V5
Security: bearerAuth, basicAuth

## Security:

  - `bearerAuth` (unknown)
    http bearer JWT

  - `basicAuth` (unknown)
    http basic

## Request body:

  - `application/json` (unknown)
    Fields for creating a new order.

## Request fields (application/json):

  - `amount` (number, required)
    Amount to authorize for the order in USD.
    Example: 1000

  - `customer_id` (string, required)
    Unique identifier of the customer placing the order.
    Example: X50sgfRd

  - `line_items` (array, required)
    Line items for the order. At least one item is required.

  - `line_items.name` (string)
    Name or description of the line item.
    Example: Widget A

  - `line_items.quantity` (number)
    Quantity of units.
    Example: 2

  - `line_items.unit_price` (number)
    Price per unit in USD.
    Example: 50

  - `line_items.sku` (string)
    SKU or product identifier.
    Example: ABC-123

  - `line_items.total_price` (number)
    Total price for this line item in USD. Defaults to unit_price × quantity if omitted.
    Example: 100

  - `line_items.type` (string)
    Line item type. Common values: `product`, `shipping`, `subtotal`.
    Example: product

  - `line_items.tax_amount` (number)
    Tax amount for this line item in USD.
    Example: 8.5

  - `order_number` (string)
    Your internal order number.
    Example: 5055

  - `po_number` (string)
    Purchase order number.
    Example: PO-555

  - `advance_requested` (boolean)
    Whether to request an advance on this order.
    Example: false

  - `source` (string)
    Source channel creating the order.
    Example: checkout

  - `metadata` (object)
    Custom metadata to attach to the order.
    Example: {"internal_ref":"ref-001"}

## Request examples:

  - `Create an order` (unknown)

## Response 200:

  - `200` (unknown)
    An object representing an order.

## Response 200 fields (application/json):

  - `id` (string)
    Unique identifier for the order.
    Example: ORDlaE5wbg0

  - `checkout_id` (string)
    ID of the checkout session associated with this order.
    Example: CHKabc123

  - `number` (string)
    Order number identifier.
    Example: ord_100001

  - `po_number` (string)
    Purchase order number associated with the order.
    Example: PO-555

  - `advance_requested` (boolean)
    Whether an advance was requested for this order.
    Example: false

  - `source` (string)
    Source channel that created the order.
    Example: checkout

  - `status` (string)
    Current status of the order.
    Example: authorized

  - `amount_authorized` (number)
    Total authorized amount for the order in USD.
    Example: 1000

  - `amount_captured` (number)
    Total captured amount for the order in USD.
    Example: 500

  - `amount_canceled` (number)
    Total canceled amount for the order in USD.
    Example: 0

  - `amount_remaining` (number)
    Remaining authorized amount available for capture in USD.
    Example: 500

  - `first_captured_at` (string)
    Timestamp of the first capture event.
    Example: 2024-01-15T10:00:00.000Z

  - `line_items` (array)
    Line items associated with the order.

  - `line_items.name` (string)
    Name or description of the line item.
    Example: Widget A

  - `line_items.quantity` (number)
    Quantity of units.
    Example: 2

  - `line_items.unit_price` (number)
    Price per unit in USD.
    Example: 50

  - `line_items.sku` (string)
    SKU or product identifier.
    Example: ABC-123

  - `line_items.total_price` (number)
    Total price for this line item in USD. Defaults to unit_price × quantity if omitted.
    Example: 100

  - `line_items.type` (string)
    Line item type. Common values: `product`, `shipping`, `subtotal`.
    Example: product

  - `line_items.tax_amount` (number)
    Tax amount for this line item in USD.
    Example: 8.5

  - `authorization_expires_at` (string)
    Timestamp when the authorization expires.
    Example: 2024-02-15T10:00:00.000Z

  - `authorization_expiry_source` (string)
    Source that determined the authorization expiry.
    Example: system

  - `capture_events` (array)
    List of capture events for this order.

  - `capture_events.amount` (number)
    Amount captured in this capture event in USD.
    Example: 500

  - `capture_events.idempotency_key` (string)
    Idempotency key used for this capture.
    Example: capture-2024-001

  - `capture_events.processed_at` (string)
    Timestamp when this capture was processed.
    Example: 2024-01-15T10:00:00.000Z

  - `capture_events.invoice_id` (string)
    ID of the merchant invoice associated with this capture.
    Example: INabc123

  - `authorized_at` (string)
    Timestamp when the order was authorized.
    Example: 2024-01-01T00:00:00.000Z

  - `updated_at` (string)
    Timestamp when the order was last updated.
    Example: 2024-01-15T10:00:00.000Z

  - `customer` (object)

  - `customer.id` (string)
    Unique identifier of the customer.
    Example: X50sgfRd

  - `customer.name` (string)
    Business name of the customer.
    Example: Acme Corp

  - `customer.remaining_credit` (number)
    Remaining available credit for the customer in USD.
    Example: 5000

## Response 400:

  - `400` (unknown)
    Bad request error

## Response 400 fields (application/json):

  - `error` (object)

  - `error.message` (string)
    A short string, describing error details
    Example: Validation error

  - `error.type` (string)
    A short string, describing error type
    Enum: "validation_error"

  - `error.details` (array)

  - `error.details.path` (string)
    Path to the field failed validation
    Example: path.to.field

  - `error.details.message` (string)
    Detailed description of the error
    Example: `[field]` is required

## Response 401:

  - `401` (unknown)
    Unauthorized error

## Response 401 fields (application/json):

  - `error` (object)

  - `error.message` (string)
    A short string, describing error details
    Example: Invalid merchant credentials

  - `error.type` (string)
    A short string, describing error type
    Enum: "authentication_error"

## Response 429:

  - `429` (unknown)
    Rate limit error

## Response 429 fields (application/json):

  - `error` (object)

  - `error.message` (string)
    A short string, describing error details
    Example: Too many requests

  - `error.type` (string)
    A short string, describing error type
    Enum: "rate_limit_error"

