arazzo: 1.0.1 info: title: Commerce Layer Create Customer, Address, and Order summary: Onboard a customer, save a customer address book entry, then open an order for them. description: >- A customer onboarding flow for Commerce Layer. The workflow creates a customer record, creates a reusable address, links that address to the customer as a customer address book entry, and finally opens a draft order in a market tied to the new customer. 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-customer-address-order summary: Create a customer, attach an address, and open an order for them. description: >- Creates a customer, creates an address and links it to the customer, then creates a draft order in the supplied market associated with the customer. inputs: type: object required: - accessToken - marketId - email - line1 - city - countryCode - phone 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. email: type: string description: The customer email address. line1: type: string description: First line of the street address. city: type: string description: City of the address. countryCode: type: string description: Two-letter country code of the address. phone: type: string description: Phone number for the address. steps: - stepId: createCustomer description: Create the customer record from the supplied email. operationId: POST/customers parameters: - name: Authorization in: header value: "Bearer $inputs.accessToken" requestBody: contentType: application/vnd.api+json payload: data: type: customers attributes: email: $inputs.email successCriteria: - condition: $statusCode == 201 outputs: customerId: $response.body#/data/id - stepId: createAddress description: Create a reusable address resource for the customer. operationId: POST/addresses parameters: - name: Authorization in: header value: "Bearer $inputs.accessToken" requestBody: contentType: application/vnd.api+json payload: data: type: addresses attributes: line_1: $inputs.line1 city: $inputs.city country_code: $inputs.countryCode phone: $inputs.phone successCriteria: - condition: $statusCode == 201 outputs: addressId: $response.body#/data/id - stepId: linkCustomerAddress description: Link the address to the customer as an address book entry. operationId: POST/customer_addresses parameters: - name: Authorization in: header value: "Bearer $inputs.accessToken" requestBody: contentType: application/vnd.api+json payload: data: type: customer_addresses attributes: customer_email: $inputs.email relationships: customer: data: type: customers id: $steps.createCustomer.outputs.customerId address: data: type: addresses id: $steps.createAddress.outputs.addressId successCriteria: - condition: $statusCode == 201 outputs: customerAddressId: $response.body#/data/id - stepId: createOrder description: Open a draft order in the market for the new customer. operationId: POST/orders parameters: - name: Authorization in: header value: "Bearer $inputs.accessToken" requestBody: contentType: application/vnd.api+json payload: data: type: orders attributes: customer_email: $inputs.email relationships: market: data: type: markets id: $inputs.marketId customer: data: type: customers id: $steps.createCustomer.outputs.customerId successCriteria: - condition: $statusCode == 201 outputs: orderId: $response.body#/data/id outputs: customerId: $steps.createCustomer.outputs.customerId addressId: $steps.createAddress.outputs.addressId customerAddressId: $steps.linkCustomerAddress.outputs.customerAddressId orderId: $steps.createOrder.outputs.orderId