Swell · Arazzo Workflow

Swell Storefront Validate and Apply Coupon

Version 1.0.0

Validate a coupon code, then apply it to the session cart only when it is valid.

1 workflow 2 source APIs 1 provider
View Spec View on GitHub CommerceHeadless CommerceAPI-FirstB2CB2BSubscriptionMarketplacesWholesaleStorefrontCheckoutPaymentsCartOrderCatalogInternationalizationArazzoWorkflows

Provider

swell-io

Workflows

storefront-validate-and-apply-coupon
Validate a coupon code, then apply it to the cart when valid.
Gets coupon validity by code; on a valid coupon it applies the code to the session cart, otherwise it ends.
2 steps inputs: code, publicKey outputs: couponCode, discountTotal
1
validateCouponStep
Validate the coupon code before applying it.
2
applyCouponStep
Apply the validated coupon code to the current session cart.

Source API Descriptions

Arazzo Workflow Specification

Raw ↑
arazzo: 1.0.1
info:
  title: Swell Storefront Validate and Apply Coupon
  summary: Validate a coupon code, then apply it to the session cart only when it is valid.
  description: >-
    A branching storefront discount flow. The workflow validates a coupon code,
    branches on the validation result, applies the coupon to the current cart
    when it is valid, and ends without acting when it is not. Each step spells
    out its request inline, including the public-key authorization, so the flow
    can be read and executed without opening the underlying OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: cartApi
  url: ../openapi/swell-io-cart-api-openapi.yml
  type: openapi
- name: couponsApi
  url: ../openapi/swell-io-coupons-api-openapi.yml
  type: openapi
workflows:
- workflowId: storefront-validate-and-apply-coupon
  summary: Validate a coupon code, then apply it to the cart when valid.
  description: >-
    Gets coupon validity by code; on a valid coupon it applies the code to the
    session cart, otherwise it ends.
  inputs:
    type: object
    required:
    - publicKey
    - code
    properties:
      publicKey:
        type: string
        description: Public storefront key, prefixed with pk_.
      code:
        type: string
        description: The coupon code to validate and apply.
  steps:
  - stepId: validateCouponStep
    description: Validate the coupon code before applying it.
    operationId: frontendGetCoupon
    parameters:
    - name: code
      in: path
      value: $inputs.code
    - name: Authorization
      in: header
      value: $inputs.publicKey
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      couponId: $response.body#/id
    onSuccess:
    - name: couponValid
      type: goto
      stepId: applyCouponStep
      criteria:
      - condition: $statusCode == 200
    onFailure:
    - name: couponInvalid
      type: end
      criteria:
      - condition: $statusCode == 404
  - stepId: applyCouponStep
    description: Apply the validated coupon code to the current session cart.
    operationId: frontendApplyCoupon
    parameters:
    - name: Authorization
      in: header
      value: $inputs.publicKey
    requestBody:
      contentType: application/json
      payload:
        code: $inputs.code
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      couponCode: $response.body#/coupon_code
      discountTotal: $response.body#/discount_total
      grandTotal: $response.body#/grand_total
  outputs:
    couponCode: $steps.applyCouponStep.outputs.couponCode
    discountTotal: $steps.applyCouponStep.outputs.discountTotal

Work with this as data

Every workflow here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for arazzo workflows

4 MCP tools reach this
  • find_arazzoBrowse and filter every workflow in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This workflow
curl "https://apis.io/api/v1/arazzo/swell-io-storefront-apply-coupon-workflow"
All arazzo workflows
curl "https://apis.io/api/v1/arazzo?limit=25"

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.

A second provider on the same verified email joins the account you already have.