Skip to content

Square

Square is a payments and commerce platform for businesses.

ingestr supports Square as a source.

URI format

The URI format for Square is as follows:

plaintext
square://?access_token=<access-token>

URI parameters:

  • access_token (required): A Square access token for your application or seller account.
  • environment: Either production (default) or sandbox. Use sandbox to read from Square's developer sandbox.

Setting up a Square Integration

To get an access token:

  1. Sign in to the Square Developer Dashboard.
  2. Open an existing application or create a new one.
  3. Copy the Access token from the Credentials page. Use the Sandbox token together with environment=sandbox for testing, or the Production token for live data.

Once you have your access token, here's a sample command that will copy data from Square into a DuckDB database:

sh
ingestr ingest \
  --source-uri 'square://?access_token=EAAAxxxxxx' \
  --source-table 'payments' \
  --dest-uri duckdb:///square.duckdb \
  --dest-table 'square.payments'

The result of this command will be a table in the square.duckdb database.

Tables

Square source allows ingesting the following sources into separate tables:

TablePKInc KeyInc StrategyDetails
paymentsidupdated_atmergePayments taken by the account.
refundsidupdated_atmergeRefunds processed against payments.
ordersidupdated_atmergeOrders across all of the account's locations.
customersidupdated_atmergeCustomer profiles.
catalog_objectsidupdated_atmergeAll catalog objects (items, variations, categories, taxes, discounts, modifier lists, images, and more).
locationsid-replaceThe account's locations.
team_membersidupdated_atmergeTeam members (staff). Soft-deletes appear as status="INACTIVE".
team_member_wagesid-replaceHourly wage settings per team member.
shiftsid-replaceWorked shifts (Labor API).
inventorycatalog_object_id, location_id, statecalculated_atmergeInventory counts per catalog object, location, and state.
bank_accountsid-replaceLinked bank accounts.
cash_drawersid-replaceCash drawer shifts across all locations.
loyaltyid-replaceLoyalty accounts.

Use one of these as the --source-table parameter in the ingestr ingest command.

Examples

Ingest orders updated within a given interval:

sh
ingestr ingest \
  --source-uri 'square://?access_token=EAAAxxxxxx' \
  --source-table 'orders' \
  --dest-uri duckdb:///square.duckdb \
  --dest-table 'square.orders' \
  --interval-start 2024-01-01

Read from the Square sandbox:

sh
ingestr ingest \
  --source-uri 'square://?access_token=EAAAxxxxxx&environment=sandbox' \
  --source-table 'catalog_objects' \
  --dest-uri duckdb:///square.duckdb \
  --dest-table 'square.catalog_objects'