Locate an account's active subscription and cancel it, branching when none exists.
1 workflow1 source API1 provider
View SpecView on GitHubCommerceHeadless CommerceAPI-FirstConsumerB2BSubscriptionMarketplaceWholesaleStorefrontCheckoutPaymentsCartOrderCatalogInternationalizationArazzoWorkflows
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
x-realizes-capability-ids:
- BC-4240
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-4240
capability_name: Subscription Lifecycle Management
spec: swell-io-subscriptions-api-openapi.yml
confidence: 0.75
model: Turbo EA Capabilities by Vincent Verdet — Turbo EA, https://github.com/vincentmakes/turbo-ea-capabilities, CC BY 4.0
sourceDescriptions:
- name: subscriptionsApi
url: ../openapi/swell-io-subscriptions-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
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.