Skip to main content
The Better Data Square integration allows you to expose your Square-managed catalog, inventory, and multiple locations to conversational AI agents.

Prerequisites

  • A Square account
  • A Personal Access Token from the Square Developer Dashboard
  • Your Square Application ID

Setup

1. Initialize the Square Backend

import { SquareBackend } from '@betterdata/commerce-gateway/square';

const square = new SquareBackend({
  accessToken: process.env.SQUARE_ACCESS_TOKEN!,
  environment: 'production', // or 'sandbox'
  locationId: process.env.SQUARE_LOCATION_ID!,
});

2. Connect to the Gateway

const gateway = new LLMGateway({
  backends: {
    products: square,
    cart: square,
  },
});

Features

Multi-Location Support

If you have multiple physical stores, the Square backend can route availability checks to the location closest to the user.

Catalog Mapping

Automatically maps Square’s CatalogObject types (ITEM, ITEM_VARIATION, IMAGE) to the gateway’s universal Product format.

Real-time Sync

Uses Square’s Search API to ensure that price changes or seasonal updates in your Square Dashboard are immediately reflected in the AI conversation.

Next Steps

For advanced multi-location routing, see our Architecture Guide.