> ## Documentation Index
> Fetch the complete documentation index at: https://docs.salesive.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update an order

> Update an existing order's status, notes, shipping cost or discount. Requires the WRITE_ORDERS scope.

Applies the whitelisted fields (`status`, `notes`, `shippingCost`, `discount`) and returns the re-fetched, fully populated order. Status changes notify the customer. The store is bound to your app token server-side — never send a shop id.


## OpenAPI

````yaml PUT /orders/{id}
openapi: 3.1.0
info:
  title: Salesive Apps API — Orders
  version: 1.0.0
  description: >-
    Read and manage the store's orders from an installed third-party app. Every
    endpoint authenticates with an installed-app access token (prefix `app_`)
    and requires a specific OAuth scope. The target store is bound to the token
    server-side from the installation — never send a shop id.
servers:
  - url: https://api.salesive.com/api/v1
    description: Production
security:
  - AppToken: []
paths:
  /orders/{id}:
    put:
      tags:
        - Orders
      summary: Update an order
      description: >-
        Updates an existing order. Only the whitelisted fields below are
        applied; all other body fields are ignored. Changing `status` to paid,
        processing, cancelled or refunded sends an automatic notification to the
        customer. Returns the re-fetched, fully populated order, or 404 if it
        does not exist or does not belong to the installation's store. Requires
        the `WRITE_ORDERS` scope. The store is bound to the app token
        server-side from the installation — never send a shop id.
      operationId: updateOrder
      parameters:
        - $ref: '#/components/parameters/OrderId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                status:
                  type: string
                  enum:
                    - pending
                    - processing
                    - paid
                    - cancelled
                    - refunded
                    - completed
                  description: New order status.
                notes:
                  type: string
                  description: Internal order notes.
                shippingCost:
                  type: number
                  description: Shipping cost for the order.
                discount:
                  type: number
                  description: Order-level discount amount.
            example:
              status: processing
              notes: Packed and awaiting pickup
              shippingCost: 1500
              discount: 500
      responses:
        '200':
          description: The updated, fully populated order.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/EnvelopeBase'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/OrderDetail'
              example:
                status: 200
                success: true
                message: Order updated
                data:
                  _id: 66b1f0a3c2d4e5f6a7b8c9d0
                  orderId: 1042
                  user:
                    _id: 66a0c1d2e3f4a5b6c7d8e9f0
                    name: Ada Lovelace
                    email: ada@example.com
                    phone: '+2348012345678'
                    customerId: 66a0d0e1f2a3b4c5d6e7f8a9
                  items:
                    - _id: 66b1f0a3c2d4e5f6a7b8c9d1
                      product:
                        _id: 6699aabbccddeeff00112233
                        name: Wireless Earbuds
                        images:
                          - https://cdn.salesive.com/p/earbuds.jpg
                      name: Wireless Earbuds
                      sku: WE-BLK-01
                      price: 24990
                      quantity: 2
                      variantAttributes: {}
                      imageUrl: https://cdn.salesive.com/p/earbuds.jpg
                  status: processing
                  notes: Packed and awaiting pickup
                  payment:
                    _id: 66b1f0a3c2d4e5f6a7b8c9e0
                    status: completed
                    amount: 49980
                    method: card
                    transactionId: txn_9f8e7d6c
                  coupon: null
                  shipment: null
                  discount: 500
                  subtotal: 49980
                  shippingCost: 1500
                  tax: 0
                  source: online
                  paymentMethod: card
                  total: 50980
                  createdAt: '2026-06-21T10:30:00.000Z'
                  updatedAt: '2026-06-21T11:20:00.000Z'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  parameters:
    OrderId:
      name: id
      in: path
      required: true
      description: The order's id (Mongo ObjectId).
      schema:
        type: string
  schemas:
    EnvelopeBase:
      type: object
      description: >-
        Standard Salesive response envelope. The operation-specific payload is
        carried in `data`.
      required:
        - status
        - success
        - message
      properties:
        status:
          type: integer
          description: HTTP status code, echoed in the body.
        success:
          type: boolean
          description: Whether the request succeeded.
        message:
          type: string
          description: Human-readable result message.
    OrderDetail:
      type: object
      description: >-
        A fully populated order as returned by the get-by-id and update
        endpoints.
      properties:
        _id:
          type: string
        orderId:
          type: integer
        user:
          $ref: '#/components/schemas/CustomerProfile'
        items:
          type: array
          items:
            $ref: '#/components/schemas/OrderItemPopulated'
        status:
          type: string
        notes:
          type: string
        payment:
          oneOf:
            - $ref: '#/components/schemas/PaymentDetail'
            - type: 'null'
        coupon:
          oneOf:
            - $ref: '#/components/schemas/Coupon'
            - type: 'null'
        shipment:
          oneOf:
            - $ref: '#/components/schemas/ShipmentDetail'
            - type: 'null'
        discount:
          type: number
        subtotal:
          type: number
        shippingCost:
          type: number
        tax:
          type: number
        source:
          type: string
        paymentMethod:
          type: string
        total:
          type: number
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    CustomerProfile:
      type: object
      description: Summary of the customer (user) attached to the order.
      properties:
        _id:
          type: string
        name:
          type: string
        email:
          type: string
        phone:
          type: string
        customerId:
          type: string
          description: The store-scoped customer record id.
        lastActive:
          type: string
          format: date-time
        customerSince:
          type: string
          format: date-time
    OrderItemPopulated:
      type: object
      description: A line item where the product is populated with name and images.
      properties:
        _id:
          type: string
        product:
          type:
            - object
            - 'null'
          properties:
            _id:
              type: string
            name:
              type: string
            images:
              type: array
              items:
                type: string
        variant:
          type:
            - string
            - 'null'
        name:
          type: string
        sku:
          type: string
        price:
          type: number
        quantity:
          type: integer
        variantAttributes:
          type: object
          additionalProperties: true
        imageUrl:
          type:
            - string
            - 'null'
    PaymentDetail:
      type: object
      description: Full payment detail, including the transaction id.
      properties:
        _id:
          type: string
        status:
          type: string
        amount:
          type: number
        method:
          type: string
        transactionId:
          type: string
    Coupon:
      type: object
      description: Coupon applied to the order.
      properties:
        _id:
          type: string
        code:
          type: string
        discountType:
          type: string
        discountValue:
          type: number
    ShipmentDetail:
      type: object
      description: Full shipment detail with tracking, address and shipping option.
      properties:
        _id:
          type: string
        status:
          type: string
        carrier:
          type:
            - string
            - 'null'
        trackingNumber:
          type:
            - string
            - 'null'
        trackingUrl:
          type:
            - string
            - 'null'
        trackingHistory:
          type: array
          items:
            type: object
            additionalProperties: true
        estimatedDelivery:
          type:
            - string
            - 'null'
          format: date-time
        shippingAddress:
          type: object
          properties:
            name:
              type: string
            address:
              type: string
            city:
              type: string
            state:
              type: string
            zipCode:
              type: string
            country:
              type: string
            email:
              type: string
            phone:
              type: string
        shippingOption:
          type: object
          properties:
            name:
              type: string
            description:
              type: string
            type:
              type: string
            price:
              type: number
    Envelope:
      allOf:
        - $ref: '#/components/schemas/EnvelopeBase'
        - type: object
          properties:
            data:
              description: Operation-specific payload (object, array, or null).
  responses:
    Unauthorized:
      description: Missing or invalid app access token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Envelope'
          example:
            status: 401
            success: false
            message: Authentication required
            data: null
    Forbidden:
      description: The app token is missing the OAuth scope required for this operation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Envelope'
          example:
            status: 403
            success: false
            message: Insufficient scope
            data: null
    NotFound:
      description: The order does not exist or does not belong to the installation's store.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Envelope'
          example:
            status: 404
            success: false
            message: Order not found
            data: null
  securitySchemes:
    AppToken:
      type: http
      scheme: bearer
      description: >-
        Installed-app access token (prefix app_), issued by the OAuth install
        flow. The store is bound to the token server-side — never send a shop
        id.

````