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

# Update shipping status

> Updates the shipping/fulfilment status of an order and fires the `shipping_status_updated` webhook. This is a separate lifecycle from the financial `order_status`.




## OpenAPI

````yaml /openapi/points-api-v1.yaml post /v1/orders/{orderUuid}/status
openapi: 3.0.3
info:
  title: Points API
  version: 1.0.0
  description: >
    OpenAPI definition for the `/api/v1` endpoints defined in
    `routes/api_v1.php`. This spec reflects the behaviour of the Laravel backend
    and is the source of truth for integrators.
  contact:
    name: Points API Support
    email: support@papp.sa
    url: https://docs.papp.sa
servers:
  - url: https://business.papp.sa/api
    description: Production server
  - url: https://sandbox.papp.sa/api
    description: Sandbox server
security:
  - ApiKeyAuth: []
tags:
  - name: Orders
    description: Operations for creating and managing orders
  - name: Webhooks
    description: CRUD operations for merchant webhooks
  - name: Integration
    description: External-platform toggle state (e.g. Matajer's "ربط بوينتس" switch)
paths:
  /v1/orders/{orderUuid}/status:
    post:
      tags:
        - Orders
      summary: Update shipping status
      description: >
        Updates the shipping/fulfilment status of an order and fires the
        `shipping_status_updated` webhook. This is a separate lifecycle from the
        financial `order_status`.
      operationId: updateShippingStatus
      parameters:
        - $ref: '#/components/parameters/orderUuid'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ShippingStatusUpdateRequest'
      responses:
        '200':
          description: Shipping status updated successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderResponse'
        '400':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  parameters:
    orderUuid:
      name: orderUuid
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: Order UUID.
  schemas:
    ShippingStatusUpdateRequest:
      type: object
      description: >
        Update payload for `POST /v1/orders/{uuid}/status`. At least ONE of
        `status`, `name_ar`, or `name_en` is required — a fully blank body
        returns 422. All three may be sent together; the canonical `status` enum
        and the custom bilingual label update atomically.
      properties:
        status:
          type: string
          enum:
            - new
            - license_in_progress
            - ready_shipping
            - delivery_is_in_progress
            - delivered
            - cancelled
          description: >
            Canonical shipping-status enum value. Drives dashboard badges + the
            `shipping_status_updated` webhook. Independent of the financial
            `order_status`.
          example: ready_shipping
        name_ar:
          type: string
          maxLength: 120
          description: >
            Free-form Arabic label. Stored under `custom_status.ar` on the
            order. When `name_en` is omitted, this value is auto-translated to
            English via Google Translate (cached 30 days). Lets external
            fulfilment platforms (Salla, Zid, custom WMS) attach their own
            status names without extending the canonical enum.
          example: خرج للتوصيل
        name_en:
          type: string
          maxLength: 120
          description: >
            Free-form English label. Stored under `custom_status.en`.
            Auto-translates from `name_ar` when omitted. Both fields together
            skip translation.
          example: Out for delivery
    OrderResponse:
      allOf:
        - $ref: '#/components/schemas/ApiMetadata'
        - type: object
          required:
            - data
          properties:
            data:
              $ref: '#/components/schemas/OrderResource'
    ApiMetadata:
      type: object
      required:
        - status
        - message
        - appended_data
      properties:
        status:
          type: boolean
          example: true
        message:
          type: string
          nullable: true
          example: ''
        appended_data:
          type: object
          additionalProperties: true
          example: {}
    OrderResource:
      type: object
      properties:
        id:
          type: integer
          example: 42
        uuid:
          type: string
          format: uuid
          example: 550e8400-e29b-41d4-a716-446655440000
        reference_number:
          type: string
          nullable: true
          example: REF-2024-001234
        order_status:
          type: string
          enum:
            - new
            - approved
            - authorized
            - captured
            - cancelled
            - fully_refunded
            - partially_refunded
          description: Financial state of the order.
          example: approved
        status_label:
          type: string
          description: >
            Resolved display label for the shipping status. Prefers the
            merchant's `custom_status` value in the request's locale when set,
            otherwise falls back to the canonical enum label ("New",
            "Delivered", …). **Render this directly** — locale switching +
            custom-label fallback are already applied server-side.
          example: خرج للتوصيل
        custom_status:
          type: object
          nullable: true
          description: >
            Merchant-defined free-form shipping label, populated by sending
            `name_ar` / `name_en` to `POST /v1/orders/{uuid}/status`. `null`
            when the merchant hasn't set a custom label — `status_label` falls
            back to the canonical enum text. Useful for multi-locale clients
            that switch language without refetching.
          properties:
            ar:
              type: string
              example: خرج للتوصيل
            en:
              type: string
              example: Out for delivery
        order_number:
          type: string
          example: ORD-2024-001234
        type:
          type: integer
          enum:
            - 1
            - 2
          description: |
            Order type: `1` = earning, `2` = replacing.
          example: 1
        total_price:
          type: number
          format: float
          example: 150.5
        total_points:
          type: number
          format: float
          example: 1505
        metadata:
          type: object
          nullable: true
          additionalProperties: true
          example:
            source: mobile_app
        date:
          type: string
          format: date
          nullable: true
          example: '2024-12-23T00:00:00.000Z'
        time:
          type: string
          nullable: true
          example: '10:00:00'
        since:
          type: string
          nullable: true
          description: Human-readable relative time (e.g. "2 hours ago").
          example: 2 hours ago
        settlement_status:
          type: string
          nullable: true
          description: >-
            Settlement state of the order (backed enum value of
            OrderSettlementStatus).
          example: settled
        status:
          type: integer
          nullable: true
          description: >-
            Shipping status as a backed integer enum value of
            OrderShippingStatus.
          example: 1
        created_at:
          type: string
          format: date-time
          example: '2024-12-23T10:00:00.000Z'
        updated_at:
          type: string
          format: date-time
          example: '2024-12-23T15:30:00.000Z'
        items:
          type: array
          nullable: true
          description: Present only when products were attached to the order.
          items:
            $ref: '#/components/schemas/ProductLine'
    ErrorResponse:
      type: object
      required:
        - status
        - message
        - appended_data
      properties:
        status:
          type: boolean
          example: false
        message:
          type: string
          example: Invalid or inactive API key
        appended_data:
          type: object
          additionalProperties: true
          example: {}
    ValidationErrorResponse:
      type: object
      required:
        - status
        - message
        - appended_data
      properties:
        status:
          type: boolean
          example: false
        message:
          type: string
          example: The given data was invalid.
        appended_data:
          type: object
          additionalProperties: true
          example: {}
        errors:
          type: object
          description: >
            Field-level validation errors. Keys are field names (dot-notation
            for nested fields, e.g. `products.0.product_price`). Values are
            arrays of error message strings.
          additionalProperties:
            type: array
            items:
              type: string
          example:
            total_price:
              - The total price field is required.
            products.0.quantity:
              - The quantity must be at least 1.
    ProductLine:
      type: object
      required:
        - product_name
        - product_price
        - quantity
      properties:
        product_name:
          type: string
          example: Cappuccino
        product_price:
          type: number
          format: float
          minimum: 0
          example: 18.5
        quantity:
          type: integer
          minimum: 1
          example: 2
  responses:
    Unauthorized:
      description: >
        The `x-api-key` header is missing, invalid, or belongs to an inactive
        merchant. The Points API returns `400` (not `401`) for auth failures.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: Resource not found for the authenticated merchant.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    ValidationError:
      description: Request body failed validation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationErrorResponse'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````