Commerce Layer · Arazzo Workflow

Commerce Layer Guest Order Add Line Item and Place

Version 1.0.0

Open a guest order, add a SKU line item, then place the order in one flow.

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

guest-order-add-line-item-place
Open a guest order, add a line item, and place it.
Creates a guest order with a customer email, adds a SKU line item, then patches the order with the documented _place flag to submit it.
3 steps inputs: accessToken, customerEmail, marketId, quantity, skuCode outputs: lineItemId, orderId, status
1
createGuestOrder
POST/orders
Open a guest order in the market with the customer email.
2
addLineItem
POST/line_items
Add a SKU line item to the guest order.
3
placeOrder
PATCH/orders/orderId
Toggle the documented _place transition flag to submit the order.

Source API Descriptions

Arazzo Workflow Specification

commerce-layer-guest-order-add-line-item-place-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Commerce Layer Guest Order Add Line Item and Place
  summary: Open a guest order, add a SKU line item, then place the order in one flow.
  description: >-
    A streamlined Commerce Layer guest checkout flow. The workflow opens a guest
    order in a market with a customer email, adds a SKU line item, and then
    patches the order with the documented _place transition flag to submit it.
    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: guest-order-add-line-item-place
  summary: Open a guest order, add a line item, and place it.
  description: >-
    Creates a guest order with a customer email, adds a SKU line item, then
    patches the order with the documented _place flag to submit it.
  inputs:
    type: object
    required:
    - accessToken
    - marketId
    - customerEmail
    - skuCode
    - quantity
    properties:
      accessToken:
        type: string
        description: Bearer access token for the Commerce Layer organization.
      marketId:
        type: string
        description: The id of the market the order belongs to.
      customerEmail:
        type: string
        description: The guest customer email for the order.
      skuCode:
        type: string
        description: The SKU code to add as a line item.
      quantity:
        type: integer
        description: The quantity of the SKU to add.
  steps:
  - stepId: createGuestOrder
    description: Open a guest order in the market with the customer email.
    operationId: POST/orders
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.accessToken"
    requestBody:
      contentType: application/vnd.api+json
      payload:
        data:
          type: orders
          attributes:
            guest: true
            customer_email: $inputs.customerEmail
          relationships:
            market:
              data:
                type: markets
                id: $inputs.marketId
    successCriteria:
    - condition: $statusCode == 201
    outputs:
      orderId: $response.body#/data/id
  - stepId: addLineItem
    description: Add a SKU line item to the guest order.
    operationId: POST/line_items
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.accessToken"
    requestBody:
      contentType: application/vnd.api+json
      payload:
        data:
          type: line_items
          attributes:
            sku_code: $inputs.skuCode
            quantity: $inputs.quantity
          relationships:
            order:
              data:
                type: orders
                id: $steps.createGuestOrder.outputs.orderId
    successCriteria:
    - condition: $statusCode == 201
    outputs:
      lineItemId: $response.body#/data/id
  - stepId: placeOrder
    description: Toggle the documented _place transition flag to submit the order.
    operationId: PATCH/orders/orderId
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.accessToken"
    - name: orderId
      in: path
      value: $steps.createGuestOrder.outputs.orderId
    requestBody:
      contentType: application/vnd.api+json
      payload:
        data:
          type: orders
          id: $steps.createGuestOrder.outputs.orderId
          attributes:
            _place: true
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      status: $response.body#/data/attributes/status
  outputs:
    orderId: $steps.createGuestOrder.outputs.orderId
    lineItemId: $steps.addLineItem.outputs.lineItemId
    status: $steps.placeOrder.outputs.status