All jobs

Tip Pooling From Square Timecards and Card Tips

Restaurant payroll software makes one agent per restaurant that reads each week's Square card tips and timecards and drafts the tip pool split for a manager.

Run this on RushOpens the console with this prompt ready to send. Connect Square there first.

What the agent does

This is for a company that sells payroll software to independent restaurants and bars, most of which take payments and run the time clock in Square. Many of them pool card tips: every tip left on a card during the workweek goes into one pot, and the pot is split among the staff who work the floor, either by hours or by a point system in which a server's hour counts for more than a busser's. A manager does it on Monday morning in a spreadsheet, from a tips report and an export of timecards, and one timecard left open or one shift under the wrong job title means someone's share is wrong on payday. The software adds a Tip pool step to its payroll run: a draft of each week's tip pool waits for the manager to check and approve before paychecks are calculated.

The company connects a Square account of its own and saves the agent once as a template with POST /o/{org}/agents, naming square in connections and with instructions that it only reads. When a restaurant turns Tip pool on, the backend calls POST /o/{org}/agents {"template": "<template id>", "name": "tips-<restaurant id>"}, then POST /o/{org}/agents/{agent}/connections {"type": "mcp", "name": "square"}, and opens the authorize_url in a popup for the owner, who signs in on Square's own page. The agent reaches Square through Square's remote MCP server at https://mcp.squareup.com/mcp, whose tools are get_service_info and get_type_info to discover an API's methods and fields, and make_api_request to call it. Square documents a read-only switch for its local server only, so the read-only rule lives in the template's instructions and in every prompt.

The hours come from Square's Labor API. The agent calls POST /v2/labor/timecards/search with a filter on the restaurant's location_ids and a workday date range in the location's time zone, 200 at a time, following cursor. Each timecard carries team_member_id, start_at, end_at, status, its breaks with is_paid, a wage with title and tip_eligible, and declared_cash_tip_money. The pot comes from the Payments API: GET /v2/payments with location_id, begin_time and end_time for the same week, following cursor. Square documents tip_money as the amount designated as a tip for the seller's staff, kept apart from amount_money, and the agent adds it up across completed payments.

It works out each person's paid hours as the time between start_at and end_at less unpaid breaks, counting only closed timecards whose wage is tip-eligible and whose title the restaurant's rules name. Hours times the points for that title gives each person's points, and their share is the pot times their points over everyone's, in cents, rounded down, with the leftover cents reported rather than handed to anyone. Open timecards, titles the rules do not name, cash tips declared on timecards and payments with a refund are listed separately for the manager, because each needs a decision the data cannot make. The agent writes nothing to Square and pays no one.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "<agent id>",
  "input": "Draft the tip pool for Harbor Street Kitchen, location L8XK2Q4D9TZ1, for the workweek Monday 2026-11-16 to Sunday 2026-11-22, time zone America/Chicago. Read only: use get_service_info and get_type_info as needed, then make_api_request; never send a create, update or delete request. 1) Timecards: POST /v2/labor/timecards/search with query.filter.location_ids [L8XK2Q4D9TZ1] and query.filter.workday date_range start_date 2026-11-16, end_date 2026-11-22, default_timezone America/Chicago, limit 200, following cursor. For each CLOSED timecard whose wage.tip_eligible is true, paid hours = end_at minus start_at minus breaks where is_paid is false. 2) Pot: GET /v2/payments with location_id L8XK2Q4D9TZ1, begin_time 2026-11-16T00:00:00-06:00, end_time 2026-11-23T00:00:00-06:00, following cursor; add up tip_money on COMPLETED payments. 3) Our rules: card tips only. Points per paid hour by wage.title: Server 10, Bartender 10, Food Runner 6, Busser 5, Host 4. Any other title shares nothing and is listed. Cash tips stay with the person: list declared_cash_tip_money per person and do not add it to the pot. 4) Share = pot x the person's points / total points, in cents, rounded down; report the cents left over. A person with two titles gets one row per title. 5) Look up each team_member_id's name. Write tip-pool.csv (name, title, paid hours, points, share) and return only JSON: {pot, total_points, rows: [{name, title, hours, points, share}], left_over_cents, open_timecards: [{name, start_at}], other_titles: [{name, title, hours}], cash_tips: [{name, amount}], refunded_payments: [{id, refunded_money}]}."
}
  1. Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
  2. Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions. The run starts in its own cloud sandbox.
  3. Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

What comes back

A draft split of the week's card tips comes back: each person's tip-eligible hours, points and share, with the pot and the cents left over. The software shows it as the Tip pool step of payroll, with tip-pool.csv attached for the restaurant's records.

The manager reads the lists before the split. An open timecard usually means someone forgot to clock out, and their hours are missing until it is closed in Square and the run is repeated. A title the rules do not name may be a new role or a typo in a wage setting. A refunded payment may have had its tip taken back, which the pot does not reflect until the manager decides. Then the split itself, row by row, against who actually worked: a person who covered a busser's shift and a server's shift shows on two rows at two point rates.

When the manager approves, the payroll software puts each share on that person's paycheck; the agent has no part in paying. Who may share in a tip pool, and how cash tips are handled, is set by the law where the restaurant operates and by its own policy. The agent applies the rules the restaurant wrote in the app and does not judge them.

Run it on every pay period close, per restaurant

When a restaurant's workweek closes, the payroll software sends POST /o/{org}/sessions with that restaurant's agent id as agent, the week, its location ids, its time zone and its pool rules from the app's settings in input, and a request_id that is a UUID v5 of the restaurant id and the week, so a retried job starts no second run. Restaurants that close their week on the same night each get their own run, and the key's webhook brings each run.completed back to the right payroll.

A restaurant with two locations that pool separately gets one run per location. One that pools across both names both location ids in the filter and both in the payments read, and the agent reports each location's tips beside the combined pot.

The use case this job follows, with its automation and trigger: Run an agent per customer task.

Why run it on Rush?

Each restaurant's Square sign-in stays in Rush's connection under that restaurant's agent. The payroll company stores agent ids, not Square tokens, runs no Square OAuth app, and a run for one restaurant cannot read another's timecards or payments. The session's accounts names the Square connection a run used, which the company can show an owner who asks what read their tips.

A tip pool is money people count on, so a disputed share has to be traceable. Every run keeps a transcript of each make_api_request with its arguments and the timecards and payments that came back, so the manager can show a server exactly which shifts and which tips made their number. Each run also has its own computer and its cost, which the company adds up per restaurant with GET /o/{org}/sessions?agent=<agent id>.

Frequently asked questions

Does it decide who is allowed to share in the tip pool?

No. The restaurant sets which job titles share and how many points each earns, in the payroll app, and the app passes those rules in the prompt. Any title the rules do not name is listed, not paid.

Can it split by hours instead of points?

Yes. Give every sharing title the same points per hour and the split becomes a straight share of hours. A restaurant can change its rules in the app and the next week's run uses them.

What about cash tips?

This prompt pools card tips only and lists the cash tips each person declared on their timecards. A restaurant that pools cash too says so in its rules, and the agent adds declared_cash_tip_money to the pot.

Does it change anything in Square?

No. Every call is a read, the instructions forbid writes, and the transcript shows each request. Closing a forgotten timecard is done by a manager in Square, followed by a fresh run.

More Square jobs

More jobs like this: Run an agent per customer task

Keep reading