Skip to content
Sandadocs

Stream a Square account

Land a Square account's orders, item sales, payments, refunds, catalogue, customers and timecards in your warehouse every few minutes, through Square's own sign-in.

Standard · EnterpriseFor owners and admins

A Square stream lands a Square account's orders and the items sold on them, its payments and refunds, its catalogue, customers, team and timecards in your warehouse, as often as every few minutes, from every location in the account. Each run reads only what changed since the last run, so a sale is in your warehouse minutes after it is rung up.

Square is a published source, like Bite: Sanda wrote the code that reads it and runs it as its own, so there is no connector for Sam to write or for anyone to approve. The account's owner connects it through Square's own sign-in, you choose what to read, and you set a schedule.

Before you start

  • The account's owner connects it. Square lets only the owner of a Square account connect an app to it, so the person who signs in when you connect must be the owner, not a team member with full access.
  • One account, every location. A stream reads one Square account, and every location in it: each café, shop or market stall, closed ones too, so their history comes in. A business with several Square accounts makes a stream for each.
  • No token to paste. Square doesn't let a service like Sanda use a seller's personal access token, so this pull connects only through Square's own sign-in, and Sam never asks you for a token.
  • In Sanda, only owners and admins connect an account and make a stream on it, because Sanda reads it on the whole workspace's behalf.

Connect an account

  1. Open Pull. Go to Data · Streams · Pull and press the Square card under Choose a source. The new pull's editor opens on Connect a Square account when none is connected yet. Once an account is connected, Connect another account in the editor adds another.
  2. Press Continue to Square.
  3. Sign in to Square as the account's owner, and allow Sanda when Square asks. If you don't, nothing is connected.
  4. Back in Sanda, a line at the top of the page says the account is connected, and it is listed under Square in Connected by its business name. If you started from a new stream, you are back in its editor with the account chosen.

Sanda keeps the connection encrypted, and it is never shown, in the console or to Sam. Connect again connects the account again: sign in to the same account, and every stream on it carries on. Square's access lasts 30 days at a time before it is renewed, and Square asks every app to renew within a week, so Sanda renews each connected account every 7 days, whether or not a stream ran.

Disconnect forgets the connection in Sanda and ends Sanda's access to the account in Square as well. If another Sanda workspace reads the same Square account, that workspace's connection stays, and only this one is forgotten. To remove Sanda in Square itself, go to Settings · App integrations in Square. Either way, the account's streams wait until it is connected again.

Make a stream

  1. Start it. Press the Square card under Choose a source, or New pull and then Square.
  2. Choose when it runs. When it runs comes first: how often, within which hours, on which days, with every run drawn out and the cost a month beneath. See when a stream runs.
  3. Name it. Its tables are named after it: a stream called square lands orders in raw.square__orders.
  4. Choose the account, and, if your workspace has more than one warehouse, the warehouse it lands in. Both are chosen once.
  5. Choose what it reads. Everything but Inventory is ticked. Untick what you don't need.
  6. Read history from is optional: the date the first run starts from for orders, line items, payments, refunds and timecards. Leave it empty to read the last 730 days.
  7. Days to read again is how many days back each read of timecards goes: 30 unless you change it, and at most 90.
  8. Pay rates lands what each team member is paid, on team members and timecards (Land pay rates), or leaves it out of both (Leave pay rates out).
  9. Press Save pull. Saving reads nothing yet: press Run now, or wait for its schedule.

What it reads

Tick Lands in Each run reads
Locations raw.<stream>__locations The whole list, at most every hour
Orders raw.<stream>__orders The orders that changed since the last run
Order line items raw.<stream>__order_line_items The order line items that changed since the last run
Payments raw.<stream>__payments The payments that changed since the last run
Refunds raw.<stream>__refunds The refunds that changed since the last run
Items raw.<stream>__catalog_items The items that changed since the last run
Item variations raw.<stream>__catalog_variations The item variations that changed since the last run
Categories raw.<stream>__catalog_categories The categories that changed since the last run
Modifiers raw.<stream>__catalog_modifiers The modifiers that changed since the last run
Modifier lists raw.<stream>__catalog_modifier_lists The modifier lists that changed since the last run
Discounts raw.<stream>__catalog_discounts The discounts that changed since the last run
Taxes raw.<stream>__catalog_taxes The taxes that changed since the last run
Customers raw.<stream>__customers The customers that changed since the last run
Team members raw.<stream>__team_members The whole list, at most every hour
Timecards raw.<stream>__timecards The days set in Days to read again, at most every hour, so late changes land
Inventory raw.<stream>__inventory_counts The inventory that changed since the last run

Each table is keyed by Square's own id: an order line by its order's id and the line's uid, and a stock count by its variation, location and state. The editor marks the two that land people's names and contact details: customers and team members.

Orders and their line items

Orders are read location by location, up to 10 locations a request, the most Square allows. Each run asks Square for the orders that changed since the newest change the last run saw, less 10 minutes, oldest change first, so a change made while the last run was reading isn't missed. A record read twice is still one row, and one that hasn't changed costs nothing. A first run reads the orders changed since the history date. Every order Square has for a location comes in, open, completed or cancelled, whether it was rung up at the counter, ordered online or sent by another app.

Order line items is one row for each line of each completed order: what was sold and its variation, the quantity, its modifiers, and its gross sales, discounts, tax and total, with the order's id, location, customer and times beside it. It holds completed orders only, because an open order's lines can still change before it is paid, and a line taken off an open check would otherwise stay behind. An order that completes later lands its lines when it completes. Each order also keeps its lines inside it, in line_items.

Payments and refunds

Payments are read one location at a time, because Square lists them a location at a time. Each run reads the payments that changed since the last run, less 10 minutes, so a tip added or a refund taken from a payment afterwards updates its row. A first run reads every payment made since the history date; later runs look for changes among the payments made within the last year. Refunds come from every location at once, read the same way.

The catalogue

Items, item variations, categories, modifiers, modifier lists, discounts and taxes are a table each. Each run reads the ones that changed since the last run, and a first run reads the whole catalogue. Deleted ones come in too, with is_deleted true, so an order line that names an item deleted since still finds it. Each row holds the object's own fields at the top, such as an item's name or a variation's item_id, sku and price_money_amount. An item's variations and a modifier list's modifiers are tables of their own, so they are left off those rows.

Customers

Each run reads the customers that changed since the last run. A first run, and Load everything again, read every customer, and a customer Square no longer lists is marked _deleted_at. Square lists only profiles with a name, an email address, a phone number or a company.

Team members and timecards

The team is read whole, at most once an hour: everyone, active or not. A timecard is one shift: who worked it, where, when it started and ended, its breaks, the job, declared cash tips and the hourly rate. Square can't be asked which timecards changed, and a manager edits or deletes timecards after the shift, so at most once an hour Sanda reads every timecard that started in the last 30 days again (Days to read again changes how many), by the day each shift started at its own location. A timecard deleted inside those days is marked _deleted_at, and older ones are never touched. A first run reads timecards back to the history date.

Inventory

Inventory is unticked to begin with, because only a business that counts its stock in Square has any. Ticked, each run reads the stock counts Square has worked out again since the last run, for every location at once: one row for each variation, location and state (in stock, wasted and the rest), with its quantity.

Left out

  • Who paid, and the card they paid with. A payment comes with the buyer's email, billing and shipping addresses, a note, and a link that shows its receipt to anyone who has it. None of them are kept. Of a card, only its brand, its type and how it was presented are kept, never its last four digits, expiry, fingerprint, holder's name or address. The same goes for the card on a refund.
  • Who collects an order. The name, phone number, email and address of the person a pickup, delivery or shipment is for stay in Square. The order's customer_id names its customer.
  • Birthdays, notes and tax numbers on customer profiles.
  • Pay rates, when the stream says Leave pay rates out: then neither team members nor timecards carry what anyone is paid.
  • Not read: gift cards, loyalty, payouts, cash drawer shifts, invoices, bookings and subscriptions.

What lands in your warehouse

Every field becomes a column, and the whole record is kept in _record, as for every pull. A few things are worth knowing when you model them:

  • Money is in cents. Square sends every amount in its currency's smallest unit, and it lands that way, as a whole number: an order's total_money_amount of 1890 is A$18.90. Each record's currency says which currency its amounts are in. An amount inside a JSON column, such as an order's net_amounts, keeps Square's own amount and currency.
  • Processing fees land summed as a payment's or a refund's processing_fee_amount, beside Square's own list of them in processing_fee.
  • Quantities are decimals. A line's quantity can be 1.5 for something sold by weight.
  • Times carry their zone, such as created_at and updated_at, so they compare correctly whatever your warehouse's time zone. A location's own zone is its timezone.
  • Ids are Square's. An order line's catalog_object_id names a row in item variations, a variation's item_id a row in items, and an item's categories the categories it is in. A payment's order_id names its order, and a timecard's team_member_id its team member.
  • Where an order came from is its source_name, such as Square Point of Sale or Square Online.
  • Deleted records. Square keeps its orders, payments and refunds, and marks a catalogue object deleted itself. A location, a team member, a customer (on a read from the start) or a timecard inside the days read again that Square no longer lists is marked _deleted_at and kept, and reports and answers stop counting it.

Change a stream

Edit, on the stream's page, changes everything but the account and the warehouse. Something you take off keeps its table, with what it landed. A new Read history from date takes effect the next time everything is read from the start: press Load everything again on the stream's page.

When something goes wrong

What you see What to do
Square didn't let Sanda read something: its connection to the account doesn't allow it The run skipped that one and read the rest. The account was connected before Sanda asked Square for it: press Connect again beside the account under Connected and allow it, or take it off the stream with Edit
Square didn't let Sanda read something, in Square's own words The run skipped that one and read the rest. The account may not use that part of Square: take it off the stream with Edit
Square didn't let the account Sanda reads with see something, though it still signs in As above
Square no longer accepts Sanda's connection to the account Someone may have disconnected Sanda in Square, under Settings · App integrations. The stream waits, rather than failing again and again. Press Connect it again on the stream's page, or Connect again beside the account under Connected, and sign in to the same account as its owner
Square asked whether to allow Sanda and the answer was no Connect again, sign in as the account's owner, and allow Sanda when Square asks
Square didn't accept Sanda's request for something, in Square's own words Something in the account stops Square answering that request. The words after it say what. If they don't help, Sanda support can see why
Square asked Sanda to slow down Nothing to do: the run pauses, then carries on
Square didn't answer, or answered with an error of its own Nothing to do: the run tries again, and the next run carries on from the last page that landed

A failed run counts toward the stream pausing itself, as any stream's does. See runs.

Limits

  • Square publishes no limit on how often an app may ask, and tells one that asks too fast to slow down. A run makes at most 4 requests a second.
  • A request asks for up to 500 orders, or 100 payments, refunds or customers, and an orders search names up to 10 locations.
  • One run lands at most 20,000,000 records, so a long history is several runs.

A Square stream is billed like any pull: a charge for each run that does its work, and the rows it lands past what your edition includes. See what streams cost.

Something unclear or out of date? Tell us, and we will fix the page.