Cross-Provider Workflow

Stripe Credit Note to SendGrid Email

Version 1.0.0

Issue a Stripe credit note, then email the customer via SendGrid.

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

Providers Orchestrated

stripe sendgrid

Workflows

credit-note-email
Create a Stripe credit note, then email a SendGrid notice.
Creates a credit note against an invoice in Stripe and emails the customer a notice via SendGrid.
2 steps inputs: creditAmount, customerEmail, invoiceId outputs: creditNoteId, creditNoteStatus, emailStatus
1
create-credit-note
$sourceDescriptions.stripeApi.postCreditNotes
Create a credit note against a Stripe invoice.
2
email-notice
$sourceDescriptions.sendgridApi.SendMail
Email the customer a credit notice via SendGrid Mail Send.

Source API Descriptions

Arazzo Workflow Specification

pay-stripe-credit-note-to-sendgrid-email-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Stripe Credit Note to SendGrid Email
  summary: Issue a Stripe credit note, then email the customer via SendGrid.
  description: >-
    A cross-provider workflow that issues a credit note against a Stripe invoice and
    then emails the customer a notice of the credit through SendGrid's Mail Send API.
    Keeps customers informed when an adjustment or partial credit is applied to
    their account.
  version: 1.0.0
sourceDescriptions:
  - name: stripeApi
    url: https://raw.githubusercontent.com/api-evangelist/stripe/refs/heads/main/openapi/stripe-credit-notes-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: credit-note-email
    summary: Create a Stripe credit note, then email a SendGrid notice.
    description: >-
      Creates a credit note against an invoice in Stripe and emails the customer a
      notice via SendGrid.
    inputs:
      type: object
      properties:
        invoiceId:
          type: string
        creditAmount:
          type: integer
        customerEmail:
          type: string
    steps:
      - stepId: create-credit-note
        description: Create a credit note against a Stripe invoice.
        operationId: $sourceDescriptions.stripeApi.postCreditNotes
        requestBody:
          contentType: application/x-www-form-urlencoded
          payload:
            invoice: $inputs.invoiceId
            amount: $inputs.creditAmount
        successCriteria:
          - condition: $statusCode == 200
        outputs:
          creditNoteId: $response.body#/id
          creditNoteStatus: $response.body#/status
          creditTotal: $response.body#/total
      - stepId: email-notice
        description: Email the customer a credit notice via SendGrid Mail Send.
        operationId: $sourceDescriptions.sendgridApi.SendMail
        requestBody:
          contentType: application/json
          payload:
            personalizations:
              - to:
                  - email: $inputs.customerEmail
                subject: A credit has been applied
            from:
              email: [email protected]
            content:
              - type: text/plain
                value: Credit note $steps.create-credit-note.outputs.creditNoteId has been applied to your account.
        successCriteria:
          - condition: $statusCode == 202
        outputs:
          emailStatus: $statusCode
    outputs:
      creditNoteId: $steps.create-credit-note.outputs.creditNoteId
      creditNoteStatus: $steps.create-credit-note.outputs.creditNoteStatus
      emailStatus: $steps.email-notice.outputs.emailStatus