Build a payroll prototype with AI
Set up your AI coding tool to build a payroll prototype inside your own product, in Check's sandbox.
What would payroll look like inside your product? This guide will set up your AI coding tool (Claude Code, Codex, Cursor, or other) to build a payroll product in Check's sandbox, in your own design, so your team can see it working before you scope the full integration.
One prompt will get it started, and your AI tool will build a working payroll flow: setting up a company, adding employees, running payroll, and viewing paystubs and a payroll summary. Your team will come away knowing:
- How companies, employees, and payrolls fit together in Check.
- Which screens you'll build yourself and where Check's components will fit in.
- What Check will handle for you: tax calculation, filing, and money movement.
- What gaps remain between the prototype and launch.
Before you start
You need:
- Your sandbox API key.
- An AI coding tool that supports MCP.
- Your application's code, checked out and running on your computer. The prototype will be built on a new branch.
Step 1: Connect Check to your AI tool
This step will connect Check's sandbox MCP server, so your AI tool can make requests to the Check API and access sandbox data. Check runs the server for you, so there's nothing to install. You'll point your AI tool at it and sign in with your Console login. You'll only need to do this once.
Claude Code:
- In your terminal, run:
claude mcp add --transport http --scope user check-sandbox https://mcp.sandbox.checkhq.com/check/mcp - Then open Claude Code, type
/mcp, select check-sandbox, and choose Authenticate.
Codex:
- In your terminal, run:
codex mcp add check-sandbox --url https://mcp.sandbox.checkhq.com/check/mcp - Run
codex mcp login check-sandbox
Cursor:
- Add
"check-sandbox": { "url": "https://mcp.sandbox.checkhq.com/check/mcp" }undermcpServersin~/.cursor/mcp.json. - Open Cursor Settings, go to MCP, and sign in to check-sandbox.
Your browser will open Check's Authorize Connection page. Review the MCP Usage Terms, check the box, choose Allow Access, and sign in with your Console email, password and authenticator code.
Using a different tool? See Hosted MCP setup.
Step 2: Paste the setup prompt
Commit or stash any work in progress first. Setup will create a new branch.
Then open your AI tool in the repo, copy this block and send it:
Set up this repo so you can build a payroll prototype on Check with me. Do these steps in order, then tell me what you did:
1. Create and switch to a new git branch named check-prototype. If there are uncommitted changes, stop and ask me first. If the branch already exists, switch to it.
2. Download CHECK.md into the repo root: fetch https://docs.checkhq.com/docs/build-with-ai.md and save the contents of the code block labeled CHECK.md (drop the two-space indent on each line) as CHECK.md. It starts with "# Building a payroll prototype on Check". If you can't fetch the page, ask me to open "Show CHECK.md" on https://docs.checkhq.com/docs/build-with-ai, copy the whole file, and paste it here. Save what I paste as CHECK.md in the repo root, then carry on with the steps below.
3. Make sure future sessions in this repo read CHECK.md. Add one line pointing to it in the instruction file you read at startup, and create the file if it doesn't exist: AGENTS.md for most tools ("Read CHECK.md before starting any work, and follow it.") or CLAUDE.md for Claude Code (@CHECK.md). Don't change anything else in that file.
4. Create .env in the repo root if it doesn't exist, add the line CHECK_API_KEY= if it isn't there, and make sure .env is listed in .gitignore. Don't ask me for the key and don't fill in a value.
5. Check that the check-sandbox MCP server is connected by calling its list_toolsets tool. If it isn't, add it yourself for the tool you're running in (the commands are under "No MCP" in CHECK.md), then tell me to restart you and sign in with my Console login. Keep going either way.
6. Tell me my next steps: paste my sandbox API key after CHECK_API_KEY= in .env myself (never in this chat), then send "Let's build my Check prototype." When I do, read CHECK.md and follow it.Your AI tool will create a check-prototype branch, download CHECK.md (the instructions it follows, shown below) into the repo root, or ask you to paste it in, and point its instruction file (such as AGENTS.md or CLAUDE.md) at it. It will also create a .env file for your key, and confirm the MCP server is connected, or add it and ask you to sign in.
Show CHECK.md
# Building a payroll prototype on Check
Version 3
You are helping an engineer whose company is building payroll on Check. Act as a technical guide: recommend one option, give the tradeoff in a sentence, and let the user choose. The goal is a prototype of the payroll happy path, built inside the user's own application, in their own design, on Check's sandbox: an employer sets up their company, adds their employees, runs payroll, and sees the results. Build it the way the real integration will work, so the prototype becomes the start of the real build. Show something working early. Teach the Check concept behind each step in a line or two, without lecturing.
## Always
- **Sandbox only.** Base URL https://sandbox.checkhq.com (or `CHECK_API_BASE_URL`). Never call production (api.checkhq.com).
- **Synthetic PII only.** Sandbox data is test data: invent names, addresses, dates of birth, SSNs and bank account numbers. Never send a real person's SSN, bank details or pay, and don't copy real employees from the app's database into the sandbox, even where the real integration would send the app's stored data.
- **Respect the rate limit.** Sandbox allows 10 requests per second per partner, shared by every client on the partner's key (the app, scripts, and you at the terminal). Make calls one at a time or a few at once, page lists one page at a time, and don't fan out across companies or employees in parallel. Every response carries `RateLimit-Limit` and `RateLimit-Remaining`; a `429` carries `Retry-After` in seconds, so wait that long and retry the same call. Build this into the app's API client once, in server-side code.
- **The key** is `CHECK_API_KEY` in `.env`, which must be in `.gitignore`. Read it in server-side code only. Never send it to the browser, log it, print it, or write it anywhere else. If the user pastes it into the chat, don't repeat it or write it to any file; ask them to put it in `.env`. If they want the key replaced, they can ask their Check team.
- **Trust the facts below.** They were checked against Check's code and sandbox when this file was written. If a docs page seems to contradict one, test it with a read call before changing course.
- **Native first.** Build in the app's own UI and use a Check component only where it fits (see "How to build").
## Start of a session
If `PROTOTYPE_PLAN.md` exists, read it and continue from the next unfinished milestone. Otherwise, run the kickoff:
1. **Check the setup yourself; don't ask the user to redo anything.** The repo is on a branch made for the prototype, `.env` has a value for `CHECK_API_KEY` (check that it exists; never print it), and the check-sandbox MCP server answers `list_toolsets`.
- **No key:** ask the user to paste it into `.env` themselves, never into the chat, and carry on with everything that doesn't need it.
- **No MCP:** add the server yourself, for the tool you're running in: `claude mcp add --transport http --scope user check-sandbox https://mcp.sandbox.checkhq.com/check/mcp` (Claude Code), `codex mcp add check-sandbox --url <same URL>` (Codex), or the URL under `mcpServers` in `~/.cursor/mcp.json` (Cursor). Then tell the user the one step only they can do: restart the tool and sign in with their Console login (in Claude Code, `/mcp`, then **check-sandbox**, then **Authenticate**). Until it's connected, carry on with the REST API: find each endpoint in the API reference through https://docs.checkhq.com/llms.txt and read its page before using it. Never guess a path or a component name.
2. **Learn their design system:** shared components, styles or tokens, layout and navigation, and any style guide. Summarize it in a few lines. Everything you build reuses it.
3. **First build.** If the user asked for a specific flow, skip this step. Otherwise, build a quick win: one real page in their app, using their components, that lists the sandbox companies (name, onboarding status, and employee count from `GET /employees?company=`) from server-side code. Tell them where to open it, point to **Companies** in Console, and link Onboard status (https://docs.checkhq.com/docs/onboard-status). If the sandbox has no companies, seed one first (see "Seeding a demo company").
4. **Write `PROTOTYPE_PLAN.md`:** the four milestones in "The happy path", in order, or starting with the flow the user asked for. For each, list its screens, the Check endpoints behind them, and what will show in Console. Add the demo click path. Write it before any milestone code, even if the user says to just build. Ask who will see the demo, then get the user's go. That go covers milestone 1.
## The happy path
The steps an employer takes to run their first payroll, following Check's quickstart (https://docs.checkhq.com/docs/quickstart). Build each one in the user's UI.
1. **Company setup.** Create the company (legal name, DBA as `trade_name`, address), a workplace, a signatory and a pay schedule. Tax setup, the funding bank account, Terms of Service and debit authorization, and the filing authorization forms. A "what's left" view built from `onboard`.
2. **Employees.** Add employees (name, address, date of birth, hire date, workplace), then their SSN, withholdings and direct deposit.
3. **Run payroll.** A regular payroll on the next payday, showing the pay period, payday, approval deadline and status. Enter hours and earnings, preview with the tax breakdown, and submit.
4. **See the results.** The payroll moving to paid, a payroll summary with wages, taxes and net pay (`GET /companies/{id}/reports/payroll_summary`; https://docs.checkhq.com/reference/get-payroll-summary), and each employee's paystub (`GET /employees/{id}/paystubs/{payroll}`, as a PDF with `Accept: application/pdf`; https://docs.checkhq.com/docs/paystubs). Move the payroll's status in the app from Check's webhooks, not by polling: `POST /webhook_configs` subscribed to payroll events, with a tunnel for a local app.
## Each milestone
1. **Plan.** From milestone 2 on, post a short plan (screens, endpoints, Console view) and wait for a go, unless the user has told you to keep going.
2. **Look up.** Before using an endpoint for the first time, read its docs page or its MCP schema (`search_tools`) for required fields, prerequisites and sandbox behavior. Look up only what this milestone uses. If a subagent does the reading, give it only this milestone's endpoints, plus the API facts below, and tell it they're checked.
3. **Build** (see "How to build").
4. **Verify.** Read the records back through the MCP or the API and confirm they match what the app shows, including that list results belong to the company you asked about.
5. **Show.** End with the app URL, the matching Console view (see "Show it in Console"), and one docs link about what you just built. Update `PROTOTYPE_PLAN.md`.
## How to build
- **Their accounts.** A Check company is one of the app's client, customer or user accounts. Store the Check company ID on that account.
- **Their UI.** Every screen uses the app's own components, tokens and patterns. Don't add a UI library. Ask for brand guidelines only if the repo has no UI to learn from.
- **Check the data first.** If the app already stores what a flow needs (employer tax IDs, bank details, employee SSNs), send it through the API. If it doesn't, embed the matching Check component, so Check collects it instead of the app storing it. Say which you chose and why.
- **The narrowest component**, embedded in the native page and themed to match. Use these individual components, not the full Company Onboard or Employee Onboard components. Company: Company Tax Setup (`tax_setup`), Company Connect Bank Account (`connect_bank_account`), Company Signatory Agreements (`signatory_agreements`), Company Filing Authorization (`filing_authorization`). Employee: Employee Withholdings Setup (`withholdings_setup`), Employee SSN Setup (`ssn_setup`), Employee Payment Setup (`payment_setup`). Create the record and fill in what the app knows through the API first.
- **Signing always uses components**, because they're the easiest path: Terms of Service and debit authorization through Company Signatory Agreements, IRS Form 8655 plus state forms through Company Filing Authorization, and employee withholding forms (W-4s) through Employee Withholdings Setup, even when the app already has that data. Don't build signing or consent screens in the app's own UI, and don't sign forms through the API. If the user asks, recommend the component, since it handles the forms, the signer and the signed PDFs for them.
- **Name Check's part.** Say what Check handles behind each flow (tax calculation, filing, money movement).
## Done means
- **Coverage.** The happy path works end to end in the user's UI. Keep to it. Edge cases and other flows go in `PROTOTYPE_PLAN.md` under "Next steps to launch", with a link to How to prepare for your Product Review (below): the rest of what Check's product review covers, such as editing and terminating employees, contractors, off-cycle payrolls, reopening a payroll, tax documents, and notices for failed debits.
- **Quality.** It looks like the user's product, runs on live sandbox data with no hardcoded IDs in the UI, retries failed API calls, handles loading, empty and error states, and runs end to end without manual steps once the data is seeded. A re-runnable seed script creates a payroll-ready company for each run (see "Seeding a demo company"). `DEMO.md` holds the click path and talking points, including the Console views.
## Show it in Console
Console (console.checkhq.com, Sandbox) shows the same data the app changes. Point to the view that matches what you built: **Companies** and the company's onboarding status (**View blockers** in Console v2) as steps finish, **Payrolls** on a company, **Developers > API logs** (the app's API-key requests, with bodies; admins only, and up to 5 minutes behind), **Developers > Webhooks** (every event sent), and **Settings > Activity logs** (changes made through components, the MCP, Checkmate and Console).
**Checkmate, once.** Checkmate is Check's AI assistant in Console. It works on sandbox data through the same Check MCP, with the user's Console permissions. Once a draft payroll exists, suggest the user ask it once, for example "Add a $500 bonus for [employee] on the draft payroll for [company] on [payday]." Then show the equivalent API call (`PATCH /payroll_items/{id}` with the item's existing earnings plus a `bonus` earning, each with its workplace, since the PATCH replaces the whole earnings list), the entry in **Settings > Activity logs**, and the change in the app. If Checkmate can't make changes, the user's Console role may be view-only.
## Reference
**Docs.** https://docs.checkhq.com/llms.txt indexes most docs and API reference pages; add `.md` to any docs.checkhq.com URL to read it as markdown, including pages the index doesn't list, and cite the pages you used. The Help Center (help.checkhq.com) needs a Console sign-in, so you can't read it: give the user a link and say what it covers, or suggest they ask Checkmate. Start with Path to payroll (https://help.checkhq.com/starting-your-payroll-journey/4Msp39koQmeEmL9vYP22cJ/path-to-payroll/4AHi9ot5aPkNrSirmJSggB) and How to prepare for your Product Review (https://help.checkhq.com/starting-your-payroll-journey/4Msp39koQmeEmL9vYP22cJ/how-to-prepare-for-your-product-review/4CX7hKFYoGKcSowkWv9NTb). For product or roadmap questions, suggest the user contact their Check team.
**API facts.**
- **MCP:** the check-sandbox server has `list_toolsets`, `search_tools` (start here) and `run_tool`. Use it to explore and to check data; the app calls the REST API directly with `Authorization: Bearer <CHECK_API_KEY>`.
- **Lists** return `{next, previous, results}`, even where a reference page shows a bare array: up to 25 per page from the API, 10 by default from the MCP. Follow `next`, except on paydays.
- **Onboarding:** `GET /companies/{id}` returns `onboard`: `status`, `blocking_steps`, `remaining_steps`, and detail per step (`bank_account`, `setup_parameters` by jurisdiction, `filing_authorization` by form). Build the "what's left" view from it.
- **Components** (list: https://docs.checkhq.com/docs/check-components): create a fresh link on every page load with `POST /companies/{id}/components/<name>` or `POST /employees/{id}/components/<name>`. Initialize the Component SDK once per link, since React and Next.js can initialize twice and end the session (https://docs.checkhq.com/docs/embedding-a-component). Refresh on component events (https://docs.checkhq.com/docs/handling-component-events), and theme to match (https://docs.checkhq.com/docs/customizing-components). `tax_setup`, `filing_authorization` and `signatory_agreements` each need a signer: a `signatory` ID, or `signer_name`, `signer_title` and `email`.
- **Payrolls:** find the next payday with `GET /pay_schedules/{id}/paydays`: the first one whose `approval_deadline` hasn't passed and that has no payroll yet. The list includes paydays whose deadline is already past, and those can't be approved. It returns a year of paydays from `start` (today by default), and its `next` always points to the following year, so don't follow it. Every earning needs a workplace. `draft`, then `POST /payrolls/{id}/approve` makes it `pending`, then `processing` and `paid`. Preview with `GET /payrolls/{id}/preview` before approving.
- **Sandbox simulation:** pending payrolls advance one step about every 5 minutes and reach paid on their own; once in a while one stalls in `processing`. To control each step, set `simulation_mode` to `manual` (on create, or by updating the payroll while it's still a draft), then call `POST /payrolls/{id}/simulate/start_processing`, `/complete_funding` and `/complete_disbursements`. https://docs.checkhq.com/docs/testing-payments-in-sandbox
- **Approval in sandbox** usually doesn't wait for onboarding. It needs a funding bank account, a payday on or after the company's start date, and an approval deadline that hasn't passed. If approval returns a blocking error, finish the steps it lists.
- **Webhooks:** `POST /webhook_configs` needs a public URL, so use a tunnel locally. Start with payroll and company events: https://docs.checkhq.com/docs/webhook-event-types
**Seeding a demo company.** Read and explore existing companies, but for anything the demo creates, approves or changes, create a new company or payroll unless the user says otherwise. Write a re-runnable seed script, in this order:
1. `POST /companies` with a future `start_date` on a bank day, matching the first payday.
2. `POST /workplaces`, then `POST /companies/{id}/signatories`.
3. `PATCH /company_tax_params/{company}` with the parameters `GET /company_tax_params/{company}` lists. The EIN is the `federal_ein` parameter, formatted `##-#######`. Check rejects repeated or sequential numbers, such as 11-1111111 or 12-3456789, for EINs and state account numbers, so use realistic digits.
4. `POST /employees` (each with a home address in `residence`, a workplace, date of birth and start date), then `POST /pay_schedules`.
5. `POST /bank_accounts` for the funding account. The company can now run payroll in sandbox, so the script stops here.
6. A person signs the authorization forms in the app, through `signatory_agreements` and `filing_authorization`. Signing can't be scripted.
7. `POST /companies/{id}/start_implementation` once the forms are signed and onboarding has no blocking steps, while the start date is still in the future. In sandbox, business verification finishes on its own.Step 3: Add your key
Paste your sandbox API key after CHECK_API_KEY= in .env. Don't paste it into the chat. Don't commit .env to GitHub; make sure it's listed in .gitignore.
Step 4: Start building
Send:
Let's build my Check prototype.Your AI tool will review your application's components and styles, and add a screen that lists your sandbox companies. It will then write a four-milestone plan for you to approve: company setup, employees, running payroll, and payroll results.
What this connects to
For your security team:
- The MCP server and your key only reach Check's sandbox, where no real money moves.
- The MCP server acts as your Console user, with your Console permissions.
- Your key stays in
.env.CHECK.mdtells your AI tool to read it only in server-side code, and never to print or log it. - Check's MCP server sees your sandbox data, not your code.
Follow along in Console
Changes your prototype makes will show up in Console, in the Sandbox environment:
- Companies: onboarding status and blockers
- Payrolls on a company: drafts, previews and statuses
- Developers > API logs: every request your app makes with its API key (admins only, up to 5 minutes behind)
- Developers > Webhooks: every event Check sends
- Settings > Activity logs: changes made through components, the MCP server, Checkmate and Console
Once you have a draft payroll, your AI tool will suggest a change to make with Checkmate in Console, then show you the same change through the API. See Checkmate.
Troubleshooting
- If your AI tool can't download
CHECK.md(some tools can't fetch web pages), it will ask you to paste it. Open Show CHECK.md above, copy the whole file, and paste it into the chat. - If Check doesn't appear in your AI tool, restart the tool after adding the server, then sign in again.
- If your company's settings block the MCP server, ask your IT team to allow
https://mcp.sandbox.checkhq.com/*. Your AI tool can keep building with the REST API and your key in the meantime. - If the companies listed don't match Console, the MCP server is signed in with a different Console login. Remove the check-sandbox server, add it again, and sign in with the right login.
- If requests return 401, check that the key in
.envis your sandbox key, with no spaces or quotes around it.
Good to know
- The prototype will be built on a branch of your application, so you can keep any of it for your real build.
CHECK.mdis plain markdown. Open it to see exactly what your AI tool has been told.- To explore Check's sandbox before you build, connect any AI chat app that supports remote MCP servers, such as claude.ai or ChatGPT, to
https://mcp.sandbox.checkhq.com/check/mcp. Sign in with your Console login and ask it about your sandbox companies and payrolls. No code needed. See Hosted MCP setup. - Questions? Ask Checkmate in Console, or reach out to your Check team.
Updated about 7 hours ago

