square-automation
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSquare Automation via Rube MCP
通过Rube MCP实现Square自动化
Automate Square payment processing, order management, and invoicing through Composio's Square toolkit via Rube MCP.
Toolkit docs: composio.dev/toolkits/square
通过Composio的Square工具包,借助Rube MCP自动化Square支付处理、订单管理和发票开具等操作。
Prerequisites
前提条件
- Rube MCP must be connected (RUBE_SEARCH_TOOLS available)
- Active Square connection via with toolkit
RUBE_MANAGE_CONNECTIONSsquare - Always call first to get current tool schemas
RUBE_SEARCH_TOOLS
- 必须已连接Rube MCP(需具备RUBE_SEARCH_TOOLS功能)
- 通过工具并选择
RUBE_MANAGE_CONNECTIONS工具包,建立有效的Square连接square - 请始终先调用以获取最新的工具架构
RUBE_SEARCH_TOOLS
Setup
设置步骤
Get Rube MCP: Add as an MCP server in your client configuration. No API keys needed — just add the endpoint and it works.
https://rube.app/mcp- Verify Rube MCP is available by confirming responds
RUBE_SEARCH_TOOLS - Call with toolkit
RUBE_MANAGE_CONNECTIONSsquare - If connection is not ACTIVE, follow the returned auth link to complete Square OAuth
- Confirm connection status shows ACTIVE before running any workflows
获取Rube MCP:在客户端配置中添加作为MCP服务器。无需API密钥,只需添加该端点即可使用。
https://rube.app/mcp- 确认能正常响应,以此验证Rube MCP是否可用
RUBE_SEARCH_TOOLS - 调用并选择
RUBE_MANAGE_CONNECTIONS工具包square - 如果连接状态未激活,请按照返回的授权链接完成Square OAuth认证
- 在运行任何工作流之前,确认连接状态显示为已激活
Core Workflows
核心工作流
1. List and Monitor Payments
1. 支付列表与监控
When to use: User wants to view payment history or check payment status
Tool sequence:
- - Retrieve payments with optional filters [Required]
SQUARE_LIST_PAYMENTS - - Cancel a pending payment if needed [Optional]
SQUARE_CANCEL_PAYMENT
Key parameters:
- /
begin_time: RFC 3339 timestamps for date range filteringend_time - : 'ASC' or 'DESC' for chronological ordering
sort_order - : Pagination cursor from previous response
cursor - : Filter payments by specific location
location_id
Pitfalls:
- Timestamps must be RFC 3339 format (e.g., '2024-01-01T00:00:00Z')
- Pagination required for large result sets; follow until absent
cursor - Only pending payments can be cancelled; completed payments require refunds
- requires exact
SQUARE_CANCEL_PAYMENTfrom list resultspayment_id
适用场景:用户想要查看支付历史或检查支付状态
工具序列:
- - 检索支付记录,可添加可选筛选条件 [必填]
SQUARE_LIST_PAYMENTS - - 如有需要,取消待处理的支付 [可选]
SQUARE_CANCEL_PAYMENT
关键参数:
- /
begin_time: 用于日期范围筛选的RFC 3339格式时间戳end_time - : 按时间排序,可选'ASC'(升序)或'DESC'(降序)
sort_order - : 来自上一次响应的分页游标
cursor - : 按特定地点筛选支付记录
location_id
注意事项:
- 时间戳必须为RFC 3339格式(例如:'2024-01-01T00:00:00Z')
- 处理大量结果时需要分页,持续使用直到返回结果中无该字段
cursor - 仅待处理的支付可被取消;已完成的支付需要发起退款
- 需要从列表结果中获取精确的
SQUARE_CANCEL_PAYMENTpayment_id
2. Search and Manage Orders
2. 订单搜索与管理
When to use: User wants to find orders by criteria or update order details
Tool sequence:
- - Get location IDs for filtering [Prerequisite]
SQUARE_LIST_LOCATIONS - - Search orders with filters [Required]
SQUARE_SEARCH_ORDERS - - Get full details of a specific order [Optional]
SQUARE_RETRIEVE_ORDER - - Modify order state or details [Optional]
SQUARE_UPDATE_ORDER
Key parameters:
- : Array of location IDs to search within (required for search)
location_ids - : Search filter object with date ranges, states, fulfillment types
query - : Specific order ID for retrieve/update operations
order_id - : Pagination cursor for search results
cursor
Pitfalls:
- is required for SEARCH_ORDERS; get IDs from LIST_LOCATIONS first
location_ids - Order states include: OPEN, COMPLETED, CANCELED, DRAFT
- UPDATE_ORDER requires the current field to prevent conflicts
version - Search results are paginated; follow until absent
cursor
适用场景:用户想要按条件查找订单或更新订单详情
工具序列:
- - 获取地点ID用于筛选 [前提步骤]
SQUARE_LIST_LOCATIONS - - 按筛选条件搜索订单 [必填]
SQUARE_SEARCH_ORDERS - - 获取特定订单的完整详情 [可选]
SQUARE_RETRIEVE_ORDER - - 修改订单状态或详情 [可选]
SQUARE_UPDATE_ORDER
关键参数:
- : 用于搜索的地点ID数组(搜索操作必填)
location_ids - : 包含日期范围、订单状态、配送类型的搜索筛选对象
query - : 用于查询或更新操作的特定订单ID
order_id - : 搜索结果的分页游标
cursor
注意事项:
- 是
location_ids的必填参数;需先通过SQUARE_SEARCH_ORDERS获取IDSQUARE_LIST_LOCATIONS - 订单状态包括:OPEN(待处理)、COMPLETED(已完成)、CANCELED(已取消)、DRAFT(草稿)
- 需要当前的
SQUARE_UPDATE_ORDER字段以避免冲突version - 搜索结果支持分页,持续使用直到返回结果中无该字段
cursor
3. Manage Locations
3. 地点管理
When to use: User wants to view business locations or get location details
Tool sequence:
- - List all business locations [Required]
SQUARE_LIST_LOCATIONS
Key parameters:
- No required parameters; returns all accessible locations
- Response includes ,
id,name,address,statustimezone
Pitfalls:
- Location IDs are required for most other Square operations (orders, payments)
- Always cache location IDs after first retrieval to avoid redundant calls
- Inactive locations may still appear in results; check field
status
适用场景:用户想要查看业务地点或获取地点详情
工具序列:
- - 列出所有业务地点 [必填]
SQUARE_LIST_LOCATIONS
关键参数:
- 无必填参数;返回所有可访问的地点
- 响应内容包含、
id、name、address、statustimezone
注意事项:
- 地点ID是大多数其他Square操作(订单、支付)的必填项
- 首次获取地点ID后请缓存,避免重复调用
- 已停用的地点仍可能出现在结果中;请检查字段
status
4. Invoice Management
4. 发票管理
When to use: User wants to list, view, or cancel invoices
Tool sequence:
- - Get location ID for filtering [Prerequisite]
SQUARE_LIST_LOCATIONS - - List invoices for a location [Required]
SQUARE_LIST_INVOICES - - Get detailed invoice information [Optional]
SQUARE_GET_INVOICE - - Cancel a scheduled or unpaid invoice [Optional]
SQUARE_CANCEL_INVOICE
Key parameters:
- : Required for listing invoices
location_id - : Required for get/cancel operations
invoice_id - : Pagination cursor for list results
cursor - : Number of results per page
limit
Pitfalls:
- is required for LIST_INVOICES; resolve via LIST_LOCATIONS first
location_id - Only SCHEDULED, UNPAID, or PARTIALLY_PAID invoices can be cancelled
- CANCEL_INVOICE requires the invoice to prevent race conditions
version - Cancelled invoices cannot be uncancelled
适用场景:用户想要列出、查看或取消发票
工具序列:
- - 获取地点ID用于筛选 [前提步骤]
SQUARE_LIST_LOCATIONS - - 列出指定地点的发票 [必填]
SQUARE_LIST_INVOICES - - 获取发票的详细信息 [可选]
SQUARE_GET_INVOICE - - 取消已排期或未支付的发票 [可选]
SQUARE_CANCEL_INVOICE
关键参数:
- : 列出发票的必填参数
location_id - : 查询或取消操作的必填参数
invoice_id - : 列表结果的分页游标
cursor - : 每页返回的结果数量
limit
注意事项:
- 是
location_id的必填参数;需先通过SQUARE_LIST_INVOICES获取SQUARE_LIST_LOCATIONS - 仅SCHEDULED(已排期)、UNPAID(未支付)或PARTIALLY_PAID(部分支付)的发票可被取消
- 需要发票的
SQUARE_CANCEL_INVOICE字段以避免竞态条件version - 已取消的发票无法恢复
Common Patterns
通用模式
ID Resolution
ID解析
Location name -> Location ID:
1. Call SQUARE_LIST_LOCATIONS
2. Find location by name in response
3. Extract id field (e.g., 'L1234ABCD')Order lookup:
1. Call SQUARE_SEARCH_ORDERS with location_ids and query filters
2. Extract order_id from results
3. Use order_id for RETRIEVE_ORDER or UPDATE_ORDER地点名称 -> 地点ID:
1. 调用SQUARE_LIST_LOCATIONS
2. 在响应结果中按名称查找地点
3. 提取id字段(例如:'L1234ABCD')订单查询:
1. 调用SQUARE_SEARCH_ORDERS并传入location_ids和查询筛选条件
2. 从结果中提取order_id
3. 使用order_id调用RETRIEVE_ORDER或UPDATE_ORDERPagination
分页处理
- Check response for field
cursor - Pass cursor value in next request's parameter
cursor - Continue until is absent or empty
cursor - Use to control page size
limit
- 检查响应结果中的字段
cursor - 将cursor值传入下一次请求的参数
cursor - 持续操作直到不存在或为空
cursor - 使用参数控制每页结果数量
limit
Date Range Filtering
日期范围筛选
- Use RFC 3339 format:
2024-01-01T00:00:00Z - For payments: and
begin_timeparametersend_time - For orders: Use query filter with date_time_filter
- All timestamps are in UTC
- 使用RFC 3339格式:
2024-01-01T00:00:00Z - 支付操作:使用和
begin_time参数end_time - 订单操作:在查询筛选器中使用date_time_filter
- 所有时间戳均为UTC时区
Known Pitfalls
已知注意事项
ID Formats:
- Location IDs are alphanumeric strings (e.g., 'L1234ABCD')
- Payment IDs and Order IDs are longer alphanumeric strings
- Always resolve location names to IDs before other operations
Versioning:
- UPDATE_ORDER and CANCEL_INVOICE require current field
version - Fetch the resource first to get its current version
- Version mismatch returns a 409 Conflict error
Rate Limits:
- Square API has per-endpoint rate limits
- Implement backoff for bulk operations
- Pagination should include brief delays for large datasets
Response Parsing:
- Responses may nest data under key
data - Money amounts are in smallest currency unit (cents for USD)
- Parse defensively with fallbacks for optional fields
ID格式:
- 地点ID为字母数字字符串(例如:'L1234ABCD')
- 支付ID和订单ID为更长的字母数字字符串
- 在执行其他操作前,请务必将地点名称解析为地点ID
版本控制:
- 和
SQUARE_UPDATE_ORDER需要当前的SQUARE_CANCEL_INVOICE字段version - 请先获取资源以获取其当前版本
- 版本不匹配会返回409 Conflict错误
速率限制:
- Square API对每个端点有速率限制
- 批量操作时请实现退避机制
- 处理大型数据集时,分页操作应包含短暂延迟
响应解析:
- 响应数据可能嵌套在键下
data - 金额以最小货币单位表示(例如美元为美分)
- 解析时请为可选字段设置回退逻辑
Quick Reference
快速参考
| Task | Tool Slug | Key Params |
|---|---|---|
| List payments | SQUARE_LIST_PAYMENTS | begin_time, end_time, location_id, cursor |
| Cancel payment | SQUARE_CANCEL_PAYMENT | payment_id |
| Search orders | SQUARE_SEARCH_ORDERS | location_ids, query, cursor |
| Get order | SQUARE_RETRIEVE_ORDER | order_id |
| Update order | SQUARE_UPDATE_ORDER | order_id, version |
| List locations | SQUARE_LIST_LOCATIONS | (none) |
| List invoices | SQUARE_LIST_INVOICES | location_id, cursor |
| Get invoice | SQUARE_GET_INVOICE | invoice_id |
| Cancel invoice | SQUARE_CANCEL_INVOICE | invoice_id, version |
Powered by Composio
| 任务 | 工具标识 | 关键参数 |
|---|---|---|
| 列出支付记录 | SQUARE_LIST_PAYMENTS | begin_time, end_time, location_id, cursor |
| 取消支付 | SQUARE_CANCEL_PAYMENT | payment_id |
| 搜索订单 | SQUARE_SEARCH_ORDERS | location_ids, query, cursor |
| 获取订单详情 | SQUARE_RETRIEVE_ORDER | order_id |
| 更新订单 | SQUARE_UPDATE_ORDER | order_id, version |
| 列出地点 | SQUARE_LIST_LOCATIONS | 无 |
| 列出发票 | SQUARE_LIST_INVOICES | location_id, cursor |
| 获取发票详情 | SQUARE_GET_INVOICE | invoice_id |
| 取消发票 | SQUARE_CANCEL_INVOICE | invoice_id, version |
由 Composio 提供支持