Swell · Arazzo Workflow

Swell Find and Cancel Active Subscription

Version 1.0.0

Locate an account's active subscription and cancel it, branching when none exists.

1 workflow 1 source API 1 provider
View Spec View on GitHub CommerceHeadless CommerceAPI-FirstB2CB2BSubscriptionsMarketplacesWholesaleStorefrontCheckoutPaymentsCartsOrdersCatalogInternationalizationArazzoWorkflows

Provider

swell-io

Workflows

find-and-cancel-subscription
Find an account's active subscription and cancel it.
Filters subscriptions to the account with active status; on a hit it cancels the matched subscription, on a miss it ends.
2 steps inputs: account_id outputs: canceledSubscriptionId
1
findSubscriptionStep
listSubscriptions
List subscriptions for the account that are currently active, returning at most one.
2
cancelSubscriptionStep
cancelSubscription
Cancel the matched active subscription.

Source API Descriptions

Arazzo Workflow Specification

swell-io-cancel-subscription-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Swell Find and Cancel Active Subscription
  summary: Locate an account's active subscription and cancel it, branching when none exists.
  description: >-
    A find-then-act lifecycle flow for self-service or support-driven churn. The
    workflow lists subscriptions filtered to an account with active status and
    branches: when an active subscription is found it cancels that subscription,
    and when none is found it ends without acting. Each step spells out its
    request inline so the flow can be read and executed without opening the
    underlying OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: swellBackendApi
  url: ../openapi/swell-backend-api-openapi.yml
  type: openapi
workflows:
- workflowId: find-and-cancel-subscription
  summary: Find an account's active subscription and cancel it.
  description: >-
    Filters subscriptions to the account with active status; on a hit it cancels
    the matched subscription, on a miss it ends.
  inputs:
    type: object
    required:
    - account_id
    properties:
      account_id:
        type: string
        description: The account whose active subscription should be canceled.
  steps:
  - stepId: findSubscriptionStep
    description: >-
      List subscriptions for the account that are currently active, returning at
      most one.
    operationId: listSubscriptions
    parameters:
    - name: where
      in: query
      value:
        account_id: $inputs.account_id
        status: active
    - name: limit
      in: query
      value: 1
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      subscriptionId: $response.body#/results/0/id
    onSuccess:
    - name: subscriptionFound
      type: goto
      stepId: cancelSubscriptionStep
      criteria:
      - context: $response.body
        condition: $.results.length > 0
        type: jsonpath
    - name: noSubscription
      type: end
      criteria:
      - context: $response.body
        condition: $.results.length == 0
        type: jsonpath
  - stepId: cancelSubscriptionStep
    description: Cancel the matched active subscription.
    operationId: cancelSubscription
    parameters:
    - name: id
      in: path
      value: $steps.findSubscriptionStep.outputs.subscriptionId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      canceledSubscriptionId: $steps.findSubscriptionStep.outputs.subscriptionId
  outputs:
    canceledSubscriptionId: $steps.cancelSubscriptionStep.outputs.canceledSubscriptionId