Cross-Provider Workflow

Shopify Order Refund to Stripe Refund to SendGrid Notice

Version 1.0.0

Look up a Shopify order, issue a Stripe refund, then email the customer a refund notice.

1 workflow 3 source APIs 3 providers
View Spec View on GitHub ArazzoWorkflowsCross-Provider

Providers Orchestrated

shopify stripe sendgrid

Workflows

refund-order-and-notify
Fetch a Shopify order, refund the Stripe charge, and email the customer.
Retrieves a Shopify order, creates a Stripe refund against the original charge, then emails the customer a refund confirmation via SendGrid.
3 steps inputs: chargeId, customerEmail, orderId, refundAmount outputs: noticeStatus, refundId
1
get-order
$sourceDescriptions.shopifyApi.getOrder
Retrieve the Shopify order being refunded.
2
create-refund
$sourceDescriptions.stripeApi.PostRefunds
Issue a Stripe refund against the original charge.
3
email-refund-notice
$sourceDescriptions.sendgridApi.SendMail
Email the customer a refund confirmation via SendGrid.

Source API Descriptions

Arazzo Workflow Specification

shop-refund-notify-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Shopify Order Refund to Stripe Refund to SendGrid Notice
  summary: Look up a Shopify order, issue a Stripe refund, then email the customer a refund notice.
  description: >-
    A refund workflow that retrieves a Shopify order, issues a refund against the
    original Stripe charge, and emails the customer a confirmation through
    SendGrid once the money is returned. Demonstrates coordinating a commerce
    platform, a payment provider's refund flow, and a communications provider.
  version: 1.0.0
sourceDescriptions:
  - name: shopifyApi
    url: https://raw.githubusercontent.com/api-evangelist/shopify/refs/heads/main/openapi/shopify-admin-rest-api-openapi.yml
    type: openapi
  - name: stripeApi
    url: https://raw.githubusercontent.com/api-evangelist/stripe/refs/heads/main/openapi/stripe-refunds-api-openapi.yml
    type: openapi
  - name: sendgridApi
    url: https://raw.githubusercontent.com/api-evangelist/sendgrid/refs/heads/main/openapi/tsg_mail_v3.yaml
    type: openapi
workflows:
  - workflowId: refund-order-and-notify
    summary: Fetch a Shopify order, refund the Stripe charge, and email the customer.
    description: >-
      Retrieves a Shopify order, creates a Stripe refund against the original
      charge, then emails the customer a refund confirmation via SendGrid.
    inputs:
      type: object
      properties:
        orderId:
          type: string
        chargeId:
          type: string
        refundAmount:
          type: integer
        customerEmail:
          type: string
    steps:
      - stepId: get-order
        description: Retrieve the Shopify order being refunded.
        operationId: $sourceDescriptions.shopifyApi.getOrder
        parameters:
          - name: order_id
            in: path
            value: $inputs.orderId
        successCriteria:
          - condition: $statusCode == 200
        outputs:
          orderName: $response.body#/order/name
      - stepId: create-refund
        description: Issue a Stripe refund against the original charge.
        operationId: $sourceDescriptions.stripeApi.PostRefunds
        requestBody:
          contentType: application/x-www-form-urlencoded
          payload:
            charge: $inputs.chargeId
            amount: $inputs.refundAmount
        successCriteria:
          - condition: $statusCode == 200
          - condition: $response.body#/status == "succeeded"
        outputs:
          refundId: $response.body#/id
          refundStatus: $response.body#/status
      - stepId: email-refund-notice
        description: Email the customer a refund confirmation via SendGrid.
        operationId: $sourceDescriptions.sendgridApi.SendMail
        requestBody:
          contentType: application/json
          payload:
            personalizations:
              - to:
                  - email: $inputs.customerEmail
                subject: Your refund has been processed
            from:
              email: [email protected]
            content:
              - type: text/plain
                value: Your refund has been issued and will appear shortly.
        successCriteria:
          - condition: $statusCode == 202
        outputs:
          noticeStatus: $statusCode
    outputs:
      refundId: $steps.create-refund.outputs.refundId
      noticeStatus: $steps.email-refund-notice.outputs.noticeStatus