Commerce Layer · Arazzo Workflow

Commerce Layer Create Shipment for Order

Version 1.0.0

Create a shipment for an order from a stock location, then advance it toward ready to ship.

1 workflow 1 source API 1 provider
View Spec View on GitHub Headless CommerceComposable CommerceAPI-FirstEcommerceJSON:APIOAuth 2.0Multi-MarketMulti-CurrencyB2CB2BSubscriptionsPromotionsInventoryOrder ManagementCheckoutArazzoWorkflows

Provider

commerce-layer

Workflows

create-shipment-for-order
Create a shipment for an order and mark it ready to ship.
Creates a shipment referencing an order and an inventory stock location, then patches it with the documented _ready_to_ship transition flag.
2 steps inputs: accessToken, inventoryStockLocationId, orderId outputs: shipmentId, status
1
createShipment
POST/shipments
Create the shipment for the order from the stock location.
2
markReadyToShip
PATCH/shipments/shipmentId
Toggle the documented _ready_to_ship transition flag on the shipment.

Source API Descriptions

Arazzo Workflow Specification

commerce-layer-create-shipment-for-order-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Commerce Layer Create Shipment for Order
  summary: Create a shipment for an order from a stock location, then advance it toward ready to ship.
  description: >-
    A Commerce Layer fulfillment flow. The workflow creates a shipment tied to
    an order and an inventory stock location, then patches the shipment with the
    documented _ready_to_ship transition flag to move it forward in its
    lifecycle. Every step spells out its JSON:API request inline so the flow can
    be read and executed without opening the underlying OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: coreApi
  url: ../openapi/commerce-layer-core-api-openapi.json
  type: openapi
workflows:
- workflowId: create-shipment-for-order
  summary: Create a shipment for an order and mark it ready to ship.
  description: >-
    Creates a shipment referencing an order and an inventory stock location,
    then patches it with the documented _ready_to_ship transition flag.
  inputs:
    type: object
    required:
    - accessToken
    - orderId
    - inventoryStockLocationId
    properties:
      accessToken:
        type: string
        description: Bearer access token for the Commerce Layer organization.
      orderId:
        type: string
        description: The id of the order the shipment belongs to.
      inventoryStockLocationId:
        type: string
        description: The id of the inventory stock location fulfilling the shipment.
  steps:
  - stepId: createShipment
    description: Create the shipment for the order from the stock location.
    operationId: POST/shipments
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.accessToken"
    requestBody:
      contentType: application/vnd.api+json
      payload:
        data:
          type: shipments
          relationships:
            order:
              data:
                type: orders
                id: $inputs.orderId
            inventory_stock_location:
              data:
                type: inventory_stock_locations
                id: $inputs.inventoryStockLocationId
    successCriteria:
    - condition: $statusCode == 201
    outputs:
      shipmentId: $response.body#/data/id
      status: $response.body#/data/attributes/status
  - stepId: markReadyToShip
    description: Toggle the documented _ready_to_ship transition flag on the shipment.
    operationId: PATCH/shipments/shipmentId
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.accessToken"
    - name: shipmentId
      in: path
      value: $steps.createShipment.outputs.shipmentId
    requestBody:
      contentType: application/vnd.api+json
      payload:
        data:
          type: shipments
          id: $steps.createShipment.outputs.shipmentId
          attributes:
            _ready_to_ship: true
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      status: $response.body#/data/attributes/status
  outputs:
    shipmentId: $steps.createShipment.outputs.shipmentId
    status: $steps.markReadyToShip.outputs.status