> ## Documentation Index
> Fetch the complete documentation index at: https://betterdatainc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Square Integration

> Connect your Square catalog and locations to AI

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

```typescript theme={null}
import { SquareBackend } from '@commercegateway/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

```typescript theme={null}
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](/getting-started/concepts).
