Stripe · Arazzo Workflow

Stripe Invoice and Collect

Version 1.0.0

Draft an invoice, add an item, finalize it, then charge it immediately.

1 workflow 1 source API 1 provider
View Spec View on GitHub CommerceFinancial ServicesFintechPaymentsT1ArazzoWorkflows

Provider

stripe

Workflows

invoice-and-collect
Create, populate, finalize, and pay an invoice end to end.
Creates a draft Invoice for a customer, adds a one-off invoice item, finalizes the invoice, then immediately pays it to collect funds.
4 steps inputs: amount, currency, customer, description outputs: invoiceId, paid, status
1
createDraftInvoice
postInvoices
Create a draft Invoice for the customer.
2
addInvoiceItem
postInvoice Items
Attach a one-off invoice item to the draft invoice.
3
finalizeInvoice
postInvoicesInvoiceFinalize
Finalize the invoice so it can be paid.
4
payInvoice
postInvoicesInvoicePay
Pay the finalized invoice to collect funds from the customer.

Source API Descriptions

Arazzo Workflow Specification

stripe-invoice-and-collect-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Stripe Invoice and Collect
  summary: Draft an invoice, add an item, finalize it, then charge it immediately.
  description: >-
    The full closed-loop invoicing pattern that bills and collects in one flow.
    The workflow creates a draft Invoice, attaches an invoice item, finalizes the
    invoice, then pays it using the customer's default payment method. Every step
    spells out its form-encoded request inline so the flow can be read and
    executed without opening the underlying OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: invoiceApi
  url: ../openapi/stripe-invoice-api-openapi.yml
  type: openapi
workflows:
- workflowId: invoice-and-collect
  summary: Create, populate, finalize, and pay an invoice end to end.
  description: >-
    Creates a draft Invoice for a customer, adds a one-off invoice item,
    finalizes the invoice, then immediately pays it to collect funds.
  inputs:
    type: object
    required:
    - customer
    - amount
    - currency
    properties:
      customer:
        type: string
        description: ID of the customer to invoice and charge.
      amount:
        type: integer
        description: Line item amount in the smallest currency unit.
      currency:
        type: string
        description: Three-letter ISO currency code.
      description:
        type: string
        description: Optional description for the invoice item.
  steps:
  - stepId: createDraftInvoice
    description: Create a draft Invoice for the customer.
    operationId: postInvoices
    requestBody:
      contentType: application/x-www-form-urlencoded
      payload:
        customer: $inputs.customer
        auto_advance: false
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      invoiceId: $response.body#/id
  - stepId: addInvoiceItem
    description: Attach a one-off invoice item to the draft invoice.
    operationId: postInvoice Items
    requestBody:
      contentType: application/x-www-form-urlencoded
      payload:
        customer: $inputs.customer
        invoice: $steps.createDraftInvoice.outputs.invoiceId
        amount: $inputs.amount
        currency: $inputs.currency
        description: $inputs.description
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      invoiceItemId: $response.body#/id
  - stepId: finalizeInvoice
    description: Finalize the invoice so it can be paid.
    operationId: postInvoicesInvoiceFinalize
    parameters:
    - name: invoice
      in: path
      value: $steps.createDraftInvoice.outputs.invoiceId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      status: $response.body#/status
  - stepId: payInvoice
    description: Pay the finalized invoice to collect funds from the customer.
    operationId: postInvoicesInvoicePay
    parameters:
    - name: invoice
      in: path
      value: $steps.createDraftInvoice.outputs.invoiceId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      status: $response.body#/status
      paid: $response.body#/paid
  outputs:
    invoiceId: $steps.createDraftInvoice.outputs.invoiceId
    status: $steps.payInvoice.outputs.status
    paid: $steps.payInvoice.outputs.paid