Cross-Provider Workflow

Stripe Invoice to SendGrid Notification

Version 1.0.0

Create and finalize a Stripe invoice, 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

invoice-and-notify
Create a Stripe invoice, finalize it, then email the customer.
Creates a Stripe invoice, finalizes it into an open invoice, and emails the customer a notification via SendGrid.
3 steps inputs: currency, customerEmail, fromEmail, stripeCustomer outputs: amountDue, emailStatus
1
create-invoice
$sourceDescriptions.stripeInvoiceApi.postInvoices
Create a draft Stripe invoice for the customer.
2
finalize-invoice
$sourceDescriptions.stripeInvoiceApi.postInvoicesInvoiceFinalize
Finalize the draft invoice into an open payable invoice.
3
email-customer
$sourceDescriptions.sendgridApi.SendMail
Email the customer their invoice notification via SendGrid.

Source API Descriptions

Arazzo Workflow Specification

fin-stripe-invoice-to-sendgrid-notify.yml Raw ↑
arazzo: 1.0.1
info:
  title: Stripe Invoice to SendGrid Notification
  summary: Create and finalize a Stripe invoice, then email the customer via SendGrid.
  description: >-
    A billing-notification workflow that creates a draft invoice in Stripe,
    finalizes it into an open payable invoice, and emails the customer a
    notification through SendGrid. Demonstrates pairing an invoicing provider
    with an email communications provider for customer-facing billing alerts.
  version: 1.0.0
sourceDescriptions:
  - name: stripeInvoiceApi
    url: https://raw.githubusercontent.com/api-evangelist/stripe/refs/heads/main/openapi/stripe-invoice-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: invoice-and-notify
    summary: Create a Stripe invoice, finalize it, then email the customer.
    description: >-
      Creates a Stripe invoice, finalizes it into an open invoice, and emails
      the customer a notification via SendGrid.
    inputs:
      type: object
      properties:
        stripeCustomer:
          type: string
        currency:
          type: string
        customerEmail:
          type: string
        fromEmail:
          type: string
    steps:
      - stepId: create-invoice
        description: Create a draft Stripe invoice for the customer.
        operationId: $sourceDescriptions.stripeInvoiceApi.postInvoices
        requestBody:
          contentType: application/x-www-form-urlencoded
          payload:
            customer: $inputs.stripeCustomer
            currency: $inputs.currency
            auto_advance: false
        successCriteria:
          - condition: $statusCode == 200
        outputs:
          invoiceId: $response.body#/id
      - stepId: finalize-invoice
        description: Finalize the draft invoice into an open payable invoice.
        operationId: $sourceDescriptions.stripeInvoiceApi.postInvoicesInvoiceFinalize
        parameters:
          - name: invoice
            in: path
            value: $steps.create-invoice.outputs.invoiceId
        successCriteria:
          - condition: $statusCode == 200
          - condition: $response.body#/status == "open"
        outputs:
          amountDue: $response.body#/amount_due
          hostedUrl: $response.body#/hosted_invoice_url
      - stepId: email-customer
        description: Email the customer their invoice notification via SendGrid.
        operationId: $sourceDescriptions.sendgridApi.SendMail
        requestBody:
          contentType: application/json
          payload:
            personalizations:
              - to:
                  - email: $inputs.customerEmail
                subject: Your invoice is ready
            from:
              email: $inputs.fromEmail
            content:
              - type: text/plain
                value: Your invoice has been finalized and is ready to pay.
        successCriteria:
          - condition: $statusCode == 202
        outputs:
          emailStatus: $statusCode
    outputs:
      amountDue: $steps.finalize-invoice.outputs.amountDue
      emailStatus: $steps.email-customer.outputs.emailStatus