All jobs

Chargeback Response Drafts for Each Square Dispute

Back-office software for furniture stores gives each store an agent that reads new Square disputes and drafts the chargeback response and evidence list.

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 back-office software to independent furniture and home-goods stores: delivery scheduling, special orders, and the books. Most of its stores take payments in Square, and a sofa that arrives two weeks late or a table with a scratch turns into a chargeback a month later. Square gives the store a deadline, the owner finds out about it from an email they skimmed, and the evidence that would win it (the signed delivery slip, the order with its special-order terms, the customer's texts) sits in three places. The software adds a Disputes inbox: for each open dispute, a drafted response and the list of documents to attach, waiting for the owner before the deadline.

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, with instructions that it only reads. When a store turns the inbox on, the backend makes its agent with {"template": "<template id>", "name": "disputes-<store id>"}, starts the sign-in with POST /o/{org}/agents/{agent}/connections {"type": "mcp", "name": "square"}, and opens the authorize_url in a popup for the owner, who approves on Square's own page. The agent reaches Square through Square's remote MCP server at https://mcp.squareup.com/mcp, discovering each endpoint's fields with get_service_info and get_type_info and calling it with make_api_request.

Each morning's run calls GET /v2/disputes with states EVIDENCE_REQUIRED and the store's location_id, following cursor. A dispute carries its id, amount_money, reason, due_at, card_brand, reported_at and disputed_payment. For each one the agent reads the payment with GET /v2/payments/{payment_id}: created_at, amount_money, order_id, customer_id, receipt_number, receipt_url, shipping_address, refunded_money and note. It reads the order with GET /v2/orders/{order_id} for the line items, and the store's delivery records come from the software itself, written into the prompt: the delivery date, who signed, and the names of the photos and slips on file. A photo can also ride along as a file block uploaded with POST /o/{org}/files.

The draft follows Square's own guidance for the reason. NOT_RECEIVED needs proof the goods arrived, so the agent pairs the signed delivery record with the shipping_address and asks for PROOF_OF_DELIVERY_DOCUMENTATION. CANCELLED and CUSTOMER_REQUESTS_CREDIT need the cancellation or return policy the customer agreed to, filed as CANCELLATION_OR_REFUND_DOCUMENTATION. DUPLICATE and PAID_BY_OTHER_MEANS need the other payment shown to be separate. NO_KNOWLEDGE needs proof the cardholder authorised it. NOT_AS_DESCRIBED needs the product as sold and what was delivered. EMV_LIABILITY_SHIFT cannot be challenged, so it goes on a separate list with the amount. Each response is written in pieces of at most 500 characters, the limit Square sets on a piece of text evidence, and every fact in it comes from Square or the store's records.

Start it with one API call

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

{
  "agent": "<agent id>",
  "input": "Draft chargeback responses for Hollis & Pine Furniture, location LQ7R9X2B5M3K. Read only: use get_service_info, get_type_info and make_api_request for GET requests only; never create evidence, submit evidence or accept a dispute. 1) GET /v2/disputes with states EVIDENCE_REQUIRED and location_id LQ7R9X2B5M3K, following cursor. 2) For each dispute read id, amount_money, reason, due_at, card_brand, reported_at, disputed_payment.payment_id; then GET /v2/payments/{payment_id} (created_at, amount_money, order_id, customer_id, receipt_number, receipt_url, shipping_address, refunded_money, note) and GET /v2/orders/{order_id} (line item names and quantities). 3) Our delivery records, by receipt number: R-4471 delivered 2026-10-14, signed by J. Moreno, slip delivery-4471.pdf and photo porch-4471.jpg; R-4502 special order, customer accepted the no-cancellation terms on 2026-09-30, terms-4502.pdf. Special orders are final sale; standard items may be returned within 14 days of delivery. 4) For each dispute, by reason: name the Square evidence types to file, the documents from our records that fit each, and draft the rebuttal as numbered pieces of at most 500 characters each, using only facts from Square and these records. For EMV_LIABILITY_SHIFT, draft nothing and list it under cannot_challenge. Flag any dispute whose payment has refunded_money. Write disputes.md sorted by due_at, soonest first, and return JSON {disputes: [{id, reason, amount, due_at, receipt_number, evidence_types, documents, missing_documents, text_pieces, refunded}], cannot_challenge: [{id, amount, due_at}]}."
}
  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 drafted chargeback response comes back for every open dispute, soonest deadline first. Each one gives the reason in plain words, the amount, the due_at, the evidence types to file, which of the store's documents fit each, the ones that are missing, and the rebuttal as numbered pieces that fit Square's 500-character limit. Disputes on a chip-card swipe come back separately as ones Square says cannot be challenged.

The owner reads each draft against the paperwork before anything goes to the bank. A signed slip with the wrong date, a return the store did accept, or a refund already issued changes the answer, and the draft says only what the records say. The owner then files the evidence and submits it in Square. The agent uploads nothing: Square's docs say that once evidence is uploaded through the API, the dispute can no longer be challenged or accepted in the Disputes Dashboard, and that submitted evidence cannot be removed.

Whether a dispute is won is the card issuer's decision, as Square's docs say. The draft makes the store's case complete and on time; it does not predict the outcome.

Run it on every business morning, per store

The software's scheduler calls POST /o/{org}/sessions each morning for each store with the inbox on: that store's agent id as agent, the location ids, and the delivery records for any receipt that has a dispute, with a request_id that is a UUID v5 of the store id and the date, so a retried job starts no second run. Stores run side by side, each in its own computer, and the key's webhook brings each run.completed back to the right inbox.

A dispute that was in yesterday's run and is still EVIDENCE_REQUIRED comes back again with its deadline closer, so the inbox can raise it until the owner has answered. Once the owner submits in Square, its state moves to PROCESSING and it drops out of the list.

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

Why run it on Rush?

Each store's Square sign-in stays in Rush's connection under that store's agent. The software keeps agent ids, not Square tokens, runs no Square OAuth app, and one store's run cannot read another store's payments. The session's accounts names the Square connection each run used, which answers an owner who asks what looked at their disputes.

A chargeback response is an argument to a bank, so each claim in the draft has to point at a record. Every run keeps a transcript of each make_api_request with its arguments and what Square returned, so the owner can check where a date or amount came from before signing off. Each run has its own computer and cost, and the software adds them up per store with GET /o/{org}/sessions?agent=<agent id>.

Frequently asked questions

What goes in a chargeback response?

A short account of the sale that answers the cardholder's stated reason, and the documents that prove it: a signed delivery slip for an item said not to arrive, the accepted policy for a refund claim, the second payment for a duplicate claim. Square's dispute reasons each say what proof they need, and the draft follows that.

Why doesn't the agent submit the evidence itself?

Submitting is final: Square's docs say evidence cannot be removed once submitted, and evidence uploaded through the API takes the dispute out of the Dashboard. The owner checks the draft and files it in Square, which keeps one person accountable for what the bank sees.

Does it decide whether to accept a dispute?

No. It lists the disputes Square says cannot be challenged and flags any payment that already has a refund. Accepting or fighting the rest is the owner's call.

Where do the delivery records come from?

From the store's own software, which knows the delivery date, who signed and which photos are on file, and writes them into the prompt by receipt number. Square holds the payment and order, not the delivery.

More Square jobs

More jobs like this: Run an agent per customer task

Keep reading