Swell · Arazzo Workflow

Swell Capture and Refund Payment

Version 1.0.0

Record a payment against an order, then issue a refund against that payment.

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

Provider

swell-io

Workflows

capture-and-refund-payment
Create a payment, then refund it.
Posts a payment against an order and account, then posts a refund against the returned payment id.
2 steps inputs: account_id, amount, currency, method, order_id, refund_amount, refund_reason outputs: paymentId, refundId
1
createPaymentStep
createPayment
Record a payment against the order with the supplied method and amount.
2
refundPaymentStep
refundPayment
Issue a refund against the captured payment.

Source API Descriptions

Arazzo Workflow Specification

swell-io-capture-refund-payment-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Swell Capture and Refund Payment
  summary: Record a payment against an order, then issue a refund against that payment.
  description: >-
    A back-office money-movement flow. The workflow creates a payment tied to an
    order and account with a method and amount, captures the payment id, and then
    posts a refund against that payment for a given amount and reason. 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: capture-and-refund-payment
  summary: Create a payment, then refund it.
  description: >-
    Posts a payment against an order and account, then posts a refund against
    the returned payment id.
  inputs:
    type: object
    required:
    - order_id
    - amount
    properties:
      order_id:
        type: string
        description: The order the payment settles.
      account_id:
        type: string
        description: The account the payment belongs to.
      amount:
        type: number
        description: Payment amount in store currency.
      method:
        type: string
        description: Payment method (card, account, amazon, paypal, manual).
      currency:
        type: string
        description: ISO 4217 currency code.
      refund_amount:
        type: number
        description: Amount to refund against the payment.
      refund_reason:
        type: string
        description: Reason recorded on the refund.
  steps:
  - stepId: createPaymentStep
    description: Record a payment against the order with the supplied method and amount.
    operationId: createPayment
    requestBody:
      contentType: application/json
      payload:
        order_id: $inputs.order_id
        account_id: $inputs.account_id
        amount: $inputs.amount
        method: $inputs.method
        currency: $inputs.currency
    successCriteria:
    - condition: $statusCode == 201
    outputs:
      paymentId: $response.body#/id
      amountRefundable: $response.body#/amount_refundable
  - stepId: refundPaymentStep
    description: Issue a refund against the captured payment.
    operationId: refundPayment
    parameters:
    - name: id
      in: path
      value: $steps.createPaymentStep.outputs.paymentId
    requestBody:
      contentType: application/json
      payload:
        amount: $inputs.refund_amount
        reason: $inputs.refund_reason
    successCriteria:
    - condition: $statusCode == 201
    outputs:
      refundId: $response.body#/id
      refundAmount: $response.body#/amount
  outputs:
    paymentId: $steps.createPaymentStep.outputs.paymentId
    refundId: $steps.refundPaymentStep.outputs.refundId