ml-connector
XeroSquare

Xero and Square integration

Xero runs accounting and financial reporting. Square processes payments and manages invoicing and inventory. Connecting the two keeps your financial records aligned with your transaction data. Invoices created in Xero can be sent through Square's payment processing, and Square payments flow back into Xero's general ledger, eliminating manual reconciliation. ml-connector handles the different authentication schemes and manages the sync on a schedule you control.

How Xero works

Xero is a cloud accounting platform that exposes invoices, payments, accounts, tracking categories, contacts, purchase orders, and bank transactions through the Xero Accounting REST API. Authentication uses OAuth2 Authorization Code flow with 30-minute access tokens and 60-day refresh tokens (with offline_access scope). Xero supports webhooks for Invoice, Payment, Contact, CreditNote, ManualJournal, PurchaseOrder, and BankTransaction events; webhooks deliver only metadata, requiring follow-up GET calls to fetch the full record. The API also supports delta sync via If-Modified-Since headers for polling workflows. All requests require the Xero-tenant-id header to target the specific organization. Rate limits are 5 concurrent calls and 60 per minute per tenant.

How Square works

Square is a payments and commerce platform exposing payments, refunds, invoices, orders, customers, inventory, vendors, and catalog items through its versioned REST API. Authentication uses OAuth2 with 30-day access tokens (Authorization Code flow) or non-expiring refresh tokens; both flows use Bearer token authorization. Square supports webhooks for payment, refund, invoice, order, customer, and inventory events with HMAC-SHA256 signature verification via the x-square-hmacsha256-signature header. Square has no GL accounts API because it is commerce-layer only; financial reconciliation requires mapping to an external accounting system. Vendors API is beta. The Inventory API supports read and adjustments but not direct item creation.

What moves between them

Square payments and refunds flow into Xero as bank transactions and payments, mapped to the correct Xero bank account and customer record. Xero invoices can be pulled into Square as payment requests or invoices; customer and item records are synchronized bidirectionally so both systems have the same master data. Inventory adjustments from Square can be recorded in Xero as manual journals or inventory adjustments, depending on your workflow. The sync runs on a schedule tied to your reconciliation cycle, with webhooks from either system triggering immediate updates.

How ml-connector handles it

ml-connector stores OAuth2 credentials encrypted for both Xero and Square, managing the 30-minute Xero token refresh and 30-day Square token refresh automatically. It handles the two different webhook signature schemes: Xero sends a plain webhook with a signing key retrieved from the Developer portal, while Square uses HMAC-SHA256; ml-connector verifies each correctly and prevents replay. Customer records are matched by email address or external ID reference; items are matched by SKU or name. Xero's Xero-tenant-id header is required on all Xero API calls and is stored per-customer configuration. Because Xero is page-based paginated (100 records per page), ml-connector iterates through all pages to retrieve full syncs. Square payments are deduplicated using the Square payment ID as the Xero bank transaction external reference. The integration respects both systems' rate limits: Xero (60 per minute per tenant) and Square (standard REST limits). Every record carries a full audit trail, and failed downstream calls can be replayed.

A real-world example

A mid-sized services firm uses Xero for accounting and invoicing, and Square for point-of-sale and online payment processing across multiple locations. Before the integration, the firm exported Square payment summaries at day-end and manually entered them into Xero as deposits, while reconciling customer accounts against Square's transaction list took hours each week. With Xero and Square connected, Square payments flow directly into Xero bank transactions with customer and line-item detail intact, and invoices issued in Xero can be sent as Square payment links for faster collection. Month-end reconciliation now takes minutes instead of days, and the finance team can focus on analysis instead of data entry.

What you can do

  • Sync Square payments and refunds into Xero as bank transactions and payments, mapped to customer and account records.
  • Pull Xero invoices into Square payment requests or invoices for faster customer payment collection.
  • Keep customer and item master data synchronized across Xero and Square so both systems stay aligned.
  • Handle OAuth2 token refresh on both sides and verify webhook signatures correctly for each system.
  • Reconcile financial records on a schedule tied to your accounting close, with full audit trail and replay capability.

Questions

Which direction do records flow between Xero and Square?
Square payments and refunds flow into Xero as bank transactions and payments. Xero invoices can be pulled into Square as payment requests. Customer and item records are kept in sync in both directions. This keeps Xero's accounting records current with actual Square transaction data while allowing Xero invoices to be collected through Square's payment channels.
How does ml-connector handle the different authentication schemes?
ml-connector stores both OAuth2 credential sets encrypted and manages token refresh separately for each system: 30-minute cycles for Xero and 30-day cycles for Square. Xero tokens are refreshed automatically before expiry. The Xero-tenant-id header is required on every Xero call and is stored in per-customer configuration so the correct organization is always targeted.
What happens if an invoice or payment sync fails?
Every record carries a full audit trail including the error that caused the failure. Failed records can be replayed on demand once the underlying issue is resolved, so no manual re-entry is needed. The integration also respects both systems' rate limits (Xero: 60 per minute per tenant) and backs off if either system returns a limit error.

Related integrations

Connect Xero and Square

Free to use. Add your credentials, ping your real systems, and see if we fit.

Get started