Cross-Provider Workflow

Square Sale to SendGrid Receipt

Version 1.0.0

Take a Square payment with Block, then email a receipt via SendGrid.

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

Providers Orchestrated

block sendgrid

Workflows

square-sale-receipt
Create a Square payment, then email a SendGrid receipt.
Creates a payment with Block's Square Payments API and, on a completed sale, emails the buyer a receipt via SendGrid.
2 steps inputs: amount, buyerEmail, currency, idempotencyKey, sourceId outputs: paymentId, paymentStatus, receiptStatus
1
create-payment
$sourceDescriptions.blockApi.create-payment
Create a payment with Block's Square Payments API.
2
email-receipt
$sourceDescriptions.sendgridApi.SendMail
Email the buyer a receipt via SendGrid Mail Send.

Source API Descriptions

Arazzo Workflow Specification

pay-block-sale-to-sendgrid-receipt-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Square Sale to SendGrid Receipt
  summary: Take a Square payment with Block, then email a receipt via SendGrid.
  description: >-
    A cross-provider workflow that captures an in-person or online sale through
    Block's Square Payments API and, on a completed payment, emails the buyer a
    receipt using SendGrid's Mail Send API. Brings point-of-sale payments and
    transactional email together into one orchestration.
  version: 1.0.0
sourceDescriptions:
  - name: blockApi
    url: https://raw.githubusercontent.com/api-evangelist/block/refs/heads/main/openapi/block-square-api-openapi.yaml
    type: openapi
  - name: sendgridApi
    url: https://raw.githubusercontent.com/api-evangelist/sendgrid/refs/heads/main/openapi/tsg_mail_v3.yaml
    type: openapi
workflows:
  - workflowId: square-sale-receipt
    summary: Create a Square payment, then email a SendGrid receipt.
    description: >-
      Creates a payment with Block's Square Payments API and, on a completed sale,
      emails the buyer a receipt via SendGrid.
    inputs:
      type: object
      properties:
        sourceId:
          type: string
        idempotencyKey:
          type: string
        amount:
          type: integer
        currency:
          type: string
        buyerEmail:
          type: string
    steps:
      - stepId: create-payment
        description: Create a payment with Block's Square Payments API.
        operationId: $sourceDescriptions.blockApi.create-payment
        requestBody:
          contentType: application/json
          payload:
            source_id: $inputs.sourceId
            idempotency_key: $inputs.idempotencyKey
            amount_money:
              amount: $inputs.amount
              currency: $inputs.currency
        successCriteria:
          - condition: $statusCode == 200
          - condition: $response.body#/payment/status == "COMPLETED"
        outputs:
          paymentId: $response.body#/payment/id
          paymentStatus: $response.body#/payment/status
      - stepId: email-receipt
        description: Email the buyer a receipt via SendGrid Mail Send.
        operationId: $sourceDescriptions.sendgridApi.SendMail
        requestBody:
          contentType: application/json
          payload:
            personalizations:
              - to:
                  - email: $inputs.buyerEmail
                subject: Your Square receipt
            from:
              email: [email protected]
            content:
              - type: text/plain
                value: Payment $steps.create-payment.outputs.paymentId completed. Thank you.
        successCriteria:
          - condition: $statusCode == 202
        outputs:
          emailStatus: $statusCode
    outputs:
      paymentId: $steps.create-payment.outputs.paymentId
      paymentStatus: $steps.create-payment.outputs.paymentStatus
      receiptStatus: $steps.email-receipt.outputs.emailStatus