Cross-Provider Workflow

Amberflo Usage to Stripe Invoice

Version 1.0.0

Ingest a metered usage event into Amberflo, then bill it on a Stripe invoice.

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

Providers Orchestrated

amberflo stripe

Workflows

meter-usage-and-invoice
Record Amberflo usage, then create and finalize a Stripe invoice.
Ingests a metered usage event into Amberflo, adds a matching invoice item to the customer's Stripe account, and finalizes the resulting invoice.
3 steps inputs: amount, currency, customerId, invoiceId, meterApiName, stripeCustomer, usageValue outputs: amountDue, finalizedInvoiceId, ingestStatus
1
ingest-usage
$sourceDescriptions.amberfloMeteringApi.ingestMeterEvents
Ingest a metered usage event into Amberflo.
2
add-invoice-item
$sourceDescriptions.stripeInvoiceApi.postInvoices
Create a Stripe invoice item for the metered usage.
3
finalize-invoice
$sourceDescriptions.stripeInvoiceApi.postInvoicesInvoiceFinalize
Finalize the draft invoice so it becomes payable.

Source API Descriptions

Arazzo Workflow Specification

fin-amberflo-usage-to-stripe-invoice.yml Raw ↑
arazzo: 1.0.1
info:
  title: Amberflo Usage to Stripe Invoice
  summary: Ingest a metered usage event into Amberflo, then bill it on a Stripe invoice.
  description: >-
    A usage-based billing workflow that records a metered usage event in
    Amberflo, then creates a corresponding invoice item in Stripe and finalizes
    the customer's draft invoice so the metered consumption is turned into a
    payable charge. Demonstrates bridging a metering provider to a payments
    provider for end-to-end consumption billing.
  version: 1.0.0
sourceDescriptions:
  - name: amberfloMeteringApi
    url: https://raw.githubusercontent.com/api-evangelist/amberflo/refs/heads/main/openapi/amberflo-metering-openapi.yaml
    type: openapi
  - name: stripeInvoiceApi
    url: https://raw.githubusercontent.com/api-evangelist/stripe/refs/heads/main/openapi/stripe-invoice-api-openapi.yml
    type: openapi
workflows:
  - workflowId: meter-usage-and-invoice
    summary: Record Amberflo usage, then create and finalize a Stripe invoice.
    description: >-
      Ingests a metered usage event into Amberflo, adds a matching invoice item
      to the customer's Stripe account, and finalizes the resulting invoice.
    inputs:
      type: object
      properties:
        meterApiName:
          type: string
        customerId:
          type: string
        usageValue:
          type: number
        stripeCustomer:
          type: string
        invoiceId:
          type: string
        amount:
          type: integer
        currency:
          type: string
    steps:
      - stepId: ingest-usage
        description: Ingest a metered usage event into Amberflo.
        operationId: $sourceDescriptions.amberfloMeteringApi.ingestMeterEvents
        requestBody:
          contentType: application/json
          payload:
            - meterApiName: $inputs.meterApiName
              customerId: $inputs.customerId
              meterValue: $inputs.usageValue
              meterTimeInMillis: 1717459200000
        successCriteria:
          - condition: $statusCode == 200
        outputs:
          ingestStatus: $statusCode
      - stepId: add-invoice-item
        description: Create a Stripe invoice item for the metered usage.
        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:
          draftInvoiceId: $response.body#/id
          invoiceStatus: $response.body#/status
      - stepId: finalize-invoice
        description: Finalize the draft invoice so it becomes payable.
        operationId: $sourceDescriptions.stripeInvoiceApi.postInvoicesInvoiceFinalize
        parameters:
          - name: invoice
            in: path
            value: $steps.add-invoice-item.outputs.draftInvoiceId
        successCriteria:
          - condition: $statusCode == 200
          - condition: $response.body#/status == "open"
        outputs:
          finalizedInvoiceId: $response.body#/id
          amountDue: $response.body#/amount_due
    outputs:
      ingestStatus: $steps.ingest-usage.outputs.ingestStatus
      finalizedInvoiceId: $steps.finalize-invoice.outputs.finalizedInvoiceId
      amountDue: $steps.finalize-invoice.outputs.amountDue