arazzo: 1.0.1
info:
title: Commerce Layer Place and Capture an Order
summary: Place an order, read its status, then capture payment only once it is placed.
description: >-
A Commerce Layer payment settlement flow with branching. The workflow
patches an order with the documented _place transition flag, reads the
resulting status, and branches: when the order reached the placed state it
patches the order with the documented _capture flag to settle payment,
otherwise it ends. 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
x-realizes-capability-ids:
- BC-520.40
x-capability-derivation:
method: 'deterministic join: sourceDescriptions -> per-tag OpenAPI -> tag/capability edge. No classification at this step.'
min_confidence: 0.7
sources:
- capability_id: BC-520.40
capability_name: Order Fulfilment Management
spec: commerce-layer-orders-api-openapi.yml
confidence: 0.7
model: Turbo EA Capabilities by Vincent Verdet — Turbo EA, https://github.com/vincentmakes/turbo-ea-capabilities, CC BY 4.0
sourceDescriptions:
- name: ordersApi
url: ../openapi/commerce-layer-orders-api-openapi.yml
type: openapi
workflows:
- workflowId: place-and-capture-order
summary: Place an order and capture payment once it is placed.
description: >-
Patches the order with the documented _place flag, then branches on the
resulting status to capture payment with the documented _capture flag.
inputs:
type: object
required:
- accessToken
- orderId
properties:
accessToken:
type: string
description: Bearer access token for the Commerce Layer organization.
orderId:
type: string
description: The id of the order to place and capture.
steps:
- 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: $inputs.orderId
requestBody:
contentType: application/vnd.api+json
payload:
data:
type: orders
id: $inputs.orderId
attributes:
_place: true
successCriteria:
- condition: $statusCode == 200
outputs:
status: $response.body#/data/attributes/status
onSuccess:
- name: isPlaced
type: goto
stepId: captureOrder
criteria:
- context: $response.body
condition: $.data.attributes.status == "placed"
type: jsonpath
- name: notPlaced
type: end
criteria:
- context: $response.body
condition: $.data.attributes.status != "placed"
type: jsonpath
- stepId: captureOrder
description: Toggle the documented _capture transition flag to settle payment.
operationId: PATCH/orders/orderId
parameters:
- name: Authorization
in: header
value: "Bearer $inputs.accessToken"
- name: orderId
in: path
value: $inputs.orderId
requestBody:
contentType: application/vnd.api+json
payload:
data:
type: orders
id: $inputs.orderId
attributes:
_capture: true
successCriteria:
- condition: $statusCode == 200
outputs:
status: $response.body#/data/attributes/status
paymentStatus: $response.body#/data/attributes/payment_status
outputs:
orderId: $inputs.orderId
status: $steps.captureOrder.outputs.status
paymentStatus: $steps.captureOrder.outputs.paymentStatus
Discovery needs no key. Ratings and market analysis are Pro.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. See our Privacy Policy and
Terms.