Cross-Provider Workflow

Amberflo Usage to Stripe Billing Meter

Version 1.0.0

Query Amberflo usage, then push a usage event to a Stripe billing meter.

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

Providers Orchestrated

amberflo stripe

Workflows

usage-to-stripe-meter
Query Amberflo usage, then record a Stripe meter event.
Queries aggregated usage in Amberflo and pushes a matching meter event to Stripe Billing Meters for usage-based subscription billing.
2 steps inputs: customerId, meterApiName, stripeCustomer, stripeEventName, usageQuantity outputs: meterEventId, usageResult
1
query-usage
$sourceDescriptions.amberfloMeteringApi.queryUsage
Query aggregated usage from Amberflo.
2
record-stripe-meter
$sourceDescriptions.stripeBillingMetersApi.PostBillingMeterEvents
Record a usage event on the Stripe billing meter.

Source API Descriptions

Arazzo Workflow Specification

fin-amberflo-usage-to-stripe-meter.yml Raw ↑
arazzo: 1.0.1
info:
  title: Amberflo Usage to Stripe Billing Meter
  summary: Query Amberflo usage, then push a usage event to a Stripe billing meter.
  description: >-
    A metering-to-billing workflow that queries aggregated usage from Amberflo
    and forwards a corresponding meter event to Stripe's Billing Meters API so
    Stripe-side usage-based subscriptions reflect the metered consumption.
    Demonstrates synchronizing two metering systems for accurate 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: stripeBillingMetersApi
    url: https://raw.githubusercontent.com/api-evangelist/stripe/refs/heads/main/openapi/stripe-billing-meters-api-openapi.yml
    type: openapi
workflows:
  - workflowId: usage-to-stripe-meter
    summary: Query Amberflo usage, then record a Stripe meter event.
    description: >-
      Queries aggregated usage in Amberflo and pushes a matching meter event to
      Stripe Billing Meters for usage-based subscription billing.
    inputs:
      type: object
      properties:
        meterApiName:
          type: string
        customerId:
          type: string
        stripeEventName:
          type: string
        stripeCustomer:
          type: string
        usageQuantity:
          type: string
    steps:
      - stepId: query-usage
        description: Query aggregated usage from Amberflo.
        operationId: $sourceDescriptions.amberfloMeteringApi.queryUsage
        requestBody:
          contentType: application/json
          payload:
            meterApiName: $inputs.meterApiName
            aggregation: SUM
            timeGroupingInterval: DAY
            filter:
              customerId:
                - $inputs.customerId
        successCriteria:
          - condition: $statusCode == 200
        outputs:
          usageResult: $response.body#/clientMeters
      - stepId: record-stripe-meter
        description: Record a usage event on the Stripe billing meter.
        operationId: $sourceDescriptions.stripeBillingMetersApi.PostBillingMeterEvents
        requestBody:
          contentType: application/x-www-form-urlencoded
          payload:
            event_name: $inputs.stripeEventName
            payload:
              stripe_customer_id: $inputs.stripeCustomer
              value: $inputs.usageQuantity
        successCriteria:
          - condition: $statusCode == 200
        outputs:
          meterEventId: $response.body#/identifier
          eventName: $response.body#/event_name
    outputs:
      usageResult: $steps.query-usage.outputs.usageResult
      meterEventId: $steps.record-stripe-meter.outputs.meterEventId