arazzo: 1.0.1 info: title: Stripe Create Customer and Pay summary: Create a customer, open a PaymentIntent for them, then confirm it to take payment. description: >- The canonical Stripe one-off payment pattern for a brand new customer. The workflow first creates a Customer record, then opens a PaymentIntent that is attached to that customer and a supplied payment method, and finally confirms the PaymentIntent to attempt the charge. 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: customersApi url: ../openapi/stripe-customers-api-openapi.yml type: openapi - name: paymentIntentsApi url: ../openapi/stripe-payment-intents-api-openapi.yml type: openapi workflows: - workflowId: create-customer-and-pay summary: Create a customer and immediately charge them via a confirmed PaymentIntent. description: >- Creates a Customer, opens a PaymentIntent bound to that customer for the requested amount and currency, then confirms the PaymentIntent with the supplied payment method to attempt collection. inputs: type: object required: - email - amount - currency - paymentMethod properties: email: type: string description: Email address for the new customer. name: type: string description: Display name for the new customer. amount: type: integer description: Amount to charge in the smallest currency unit (e.g. cents). currency: type: string description: Three-letter ISO currency code (e.g. usd). paymentMethod: type: string description: ID of an existing PaymentMethod to charge (e.g. pm_card_visa). steps: - stepId: createCustomer description: Create the Customer that the payment will be associated with. operationId: postCustomers requestBody: contentType: application/x-www-form-urlencoded payload: email: $inputs.email name: $inputs.name successCriteria: - condition: $statusCode == 200 outputs: customerId: $response.body#/id - stepId: createPaymentIntent description: >- Open a PaymentIntent attached to the new customer and payment method for the requested amount. operationId: postPaymentIntents requestBody: contentType: application/x-www-form-urlencoded payload: amount: $inputs.amount currency: $inputs.currency customer: $steps.createCustomer.outputs.customerId payment_method: $inputs.paymentMethod successCriteria: - condition: $statusCode == 200 outputs: paymentIntentId: $response.body#/id status: $response.body#/status - stepId: confirmPaymentIntent description: Confirm the PaymentIntent to attempt the charge. operationId: postPaymentIntentsIntentConfirm parameters: - name: intent in: path value: $steps.createPaymentIntent.outputs.paymentIntentId requestBody: contentType: application/x-www-form-urlencoded payload: payment_method: $inputs.paymentMethod successCriteria: - condition: $statusCode == 200 outputs: status: $response.body#/status amountReceived: $response.body#/amount_received outputs: customerId: $steps.createCustomer.outputs.customerId paymentIntentId: $steps.createPaymentIntent.outputs.paymentIntentId status: $steps.confirmPaymentIntent.outputs.status