Generate Square invoices and subscriptions from text with GPT-4o Mini
Quick overview This sub-workflow accepts plain-language invoice details from a parent workflow, uses OpenAI to normalize and structure the data, then uses the Square API to find or create the customer, create and publish an invoice, and optionally create a monthly subscription, returning the public invoice URL.
How it works Receives invoice fields (name, email, item, amount, notes, recurring flag, and date) from a parent workflow via an Execute Workflow trigger. Uses OpenAI (GPT-4o-mini) with a structured output parser to clean and normalize the invoice data, including converting the date to YYYY-MM-DD and generating a unique invoice number. Searches Square Customers by email and creates a new Square customer if no match is found. Retrieves the Square customer profile and checks whether the customer has a card on file. Creates a Square order and then creates and publishes a Square invoice configured for email delivery. If the invoice is marked as Monthly, creates a Square subscription plan and plan variation and attaches the subscription to the customer; otherwise returns the published invoice public URL to the parent workflow.
Setup Add an OpenAI credential for the OpenAI chat model nodes used by the agent and structured output parser. Create a Square access token and replace YOUR_SQUARE_ACCESS_TOKEN in the Authorization header on every Square HTTP request. Set your Square location ID by replacing YOUR_SQUARE_LOCATION_ID in the Create Order and Attach Subscription requests. Call this workflow from a parent workflow and pass the expected input fields (Name, Email, Item, Amount, Notes, Recurring, and Date).
Related Templates
Get Airtable data via AI and Obsidian Notes
I am submitting this workflow for the Obsidian community to showcase the potential of integrating Obsidian with n8n. Whi...
AI SEO Readability Audit: Check Website Friendliness for LLMs
Who is this for? This workflow is designed for SEO specialists, content creators, marketers, and website developers who ...
Use OpenRouter in n8n versions <1.78
What it is: In version 1.78, n8n introduced a dedicated node to use the OpenRouter service, which lets you to use a lot...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments