Skip to content

Reference

Payment providers

Where payment providers send their own webhooks, and an org's connection to its own Square account.

View as Markdown

Every operation below is also in the OpenAPI document. One that names an MCP tool can be called through the MCP server; one that names none cannot.

A payment provider tells us about a payment, refund, dispute or payout#

POST /v1/providers/{provider}/webhooks

Operation id receiveProviderWebhook.

Where a payment provider POSTs its own webhooks (a payment, refund, dispute or payout). It verifies the provider's signature and records the notice on the event log. Not for your server to call.

Who may call it. Anyone: no key or sign-in is needed.

ParameterInTypeDescription
provider *path"external" | "test" | "square"
JSON
{
  "id": "evt_provider_example",
  "type": "payment.succeeded",
  "data": {
    "reference": "pi_3Q8xYzEXAMPLE"
  }
}

Answers 200. Received: recorded on the event log, a duplicate, or ignored.

Fields (ProviderWebhookAck)

FieldTypeDescription
object *"provider_webhook"
received *true
outcome *"recorded" | "duplicate" | "ignored"recorded: the notice is on the event log; duplicate: seen before; ignored: a type we do not take, or a test notice for live.
event_log *string | nullThe row it wrote, when recorded.

* required

Errors of its own. webhook_signature_invalid. The errors every operation can answer are on the errors page.

Is this org connected to Square?#

GET /v1/payment_accounts/square

Operation id getSquareAccount. MCP tool get_square_account. SDK tickets.paymentAccounts.retrieveSquare.

Whether this org has connected its own Square account, and which location its sales go through. Never returns a token.

Who may call it. Any one of: An API key with scope full, read. Any other scope answers insufficient_scope; A signed-in dashboard member whose role has org.manage (owner, admin).

Answers 200. The connection's state: never a token.

Fields (PaymentAccount)

FieldTypeDescription
object *"payment_account"
provider *"square"
mode *Modetest or live, decided by the key (rt_test_… or rt_live_…). Test and live data never mix.
status *"not_connected" | "connected" | "revoked" | "broken"connected: charges and refunds go to this org's own Square account. revoked: the org or the seller ended it. broken: Square refused our stored token and a renewal did not help: connect again. not_connected: never connec…
merchant_id *string | nullSquare's id for the seller (not a secret).
location *objectThe Square location the money goes through.
business_name *string | nullThe seller's business name, as Square gives it: whose account this is.
proposed *objectBack from Square and waiting for the person who started it to read this and say yes. Nothing has changed yet.
owed_backobjectMoney that came for orders that ended, on its way back to buyers. It keeps being tried until it lands.
location_chosen *"first_active" | "picked" | nullHow that location came to be chosen: first_active, the first active one that takes cards, at connect; picked, by a person, through PATCH /v1/payment_accounts/square.
currency *string | nullThe location's currency: a charge in another is refused.
connected_at *string | nullAn instant in ISO 8601 with its zone, e.g. 2027-07-17T20:00:00Z. Answers are always UTC.
scopes *array of stringThe Square permissions the seller granted.
platform_feeobjectGiven on GET /v1/payment_accounts/square: null when the platform has set no fee for this org.

* required

Choose which Square location takes the money#

PATCH /v1/payment_accounts/square

Operation id updateSquareAccount. MCP tool update_square_account. SDK tickets.paymentAccounts.updateSquare.

Chooses which Square location takes the money, from those that are active and take cards. Charges from now on go through it, in its currency.

Who may call it. Any one of: An API key with scope full. Any other scope answers insufficient_scope; A signed-in dashboard member whose role has org.manage (owner, admin).

Request body (UpdateSquareAccountInput)

FieldTypeDescription
location *stringThe id of one of this account's locations that can take cards. Charges from now on go through it; what was charged stays where it was.

* required

JSON
{
  "location": "LEXAMPLE0002"
}

Answers 200. Changed: charges from now on go through it.

Fields (PaymentAccount)

FieldTypeDescription
object *"payment_account"
provider *"square"
mode *Modetest or live, decided by the key (rt_test_… or rt_live_…). Test and live data never mix.
status *"not_connected" | "connected" | "revoked" | "broken"connected: charges and refunds go to this org's own Square account. revoked: the org or the seller ended it. broken: Square refused our stored token and a renewal did not help: connect again. not_connected: never connec…
merchant_id *string | nullSquare's id for the seller (not a secret).
location *objectThe Square location the money goes through.
business_name *string | nullThe seller's business name, as Square gives it: whose account this is.
proposed *objectBack from Square and waiting for the person who started it to read this and say yes. Nothing has changed yet.
owed_backobjectMoney that came for orders that ended, on its way back to buyers. It keeps being tried until it lands.
location_chosen *"first_active" | "picked" | nullHow that location came to be chosen: first_active, the first active one that takes cards, at connect; picked, by a person, through PATCH /v1/payment_accounts/square.
currency *string | nullThe location's currency: a charge in another is refused.
connected_at *string | nullAn instant in ISO 8601 with its zone, e.g. 2027-07-17T20:00:00Z. Answers are always UTC.
scopes *array of stringThe Square permissions the seller granted.
platform_feeobjectGiven on GET /v1/payment_accounts/square: null when the platform has set no fee for this org.

* required

Errors of its own. provider_unavailable. The errors every operation can answer are on the errors page.

Disconnect this org's Square account#

DELETE /v1/payment_accounts/square

Operation id disconnectSquare. MCP tool disconnect_square. SDK tickets.paymentAccounts.disconnectSquare.

Ends the connection: the authorization is revoked at Square and the stored tokens are erased. Refused while an order is still waiting on the account. New charges are refused until it is connected again. Refunds of payments taken on it need that same account connected again, or are made in Square itself.

Who may call it. Any one of: An API key with scope full. Any other scope answers insufficient_scope; A signed-in dashboard member whose role has org.manage (owner, admin).

Answers 200. Revoked at Square, its tokens erased. Payments already made stay refundable only by reconnecting; their disputes still arrive.

Fields (PaymentAccount)

FieldTypeDescription
object *"payment_account"
provider *"square"
mode *Modetest or live, decided by the key (rt_test_… or rt_live_…). Test and live data never mix.
status *"not_connected" | "connected" | "revoked" | "broken"connected: charges and refunds go to this org's own Square account. revoked: the org or the seller ended it. broken: Square refused our stored token and a renewal did not help: connect again. not_connected: never connec…
merchant_id *string | nullSquare's id for the seller (not a secret).
location *objectThe Square location the money goes through.
business_name *string | nullThe seller's business name, as Square gives it: whose account this is.
proposed *objectBack from Square and waiting for the person who started it to read this and say yes. Nothing has changed yet.
owed_backobjectMoney that came for orders that ended, on its way back to buyers. It keeps being tried until it lands.
location_chosen *"first_active" | "picked" | nullHow that location came to be chosen: first_active, the first active one that takes cards, at connect; picked, by a person, through PATCH /v1/payment_accounts/square.
currency *string | nullThe location's currency: a charge in another is refused.
connected_at *string | nullAn instant in ISO 8601 with its zone, e.g. 2027-07-17T20:00:00Z. Answers are always UTC.
scopes *array of stringThe Square permissions the seller granted.
platform_feeobjectGiven on GET /v1/payment_accounts/square: null when the platform has set no fee for this org.

* required

Errors of its own. provider_unavailable, invalid_state_transition. The errors every operation can answer are on the errors page.

Start connecting this org's own Square account#

POST /v1/payment_accounts/square/connect

Operation id startSquareConnect. MCP tool start_square_connect. SDK tickets.paymentAccounts.connectSquare.

Starts connecting this org's own Square account. Returns a link to this service's own page, never Square's: have a person with permission to manage the org open it. They must be signed in, they click through to Square, and when they come back they read which account it is and say yes. Test mode connects Square's sandbox.

Who may call it. Any one of: An API key with scope full. Any other scope answers insufficient_scope; A signed-in dashboard member whose role has org.manage (owner, admin).

JSON
{}

Answers 200. A link to this service's own page, for a person to open. Never Square's address.

Fields (SquareConnectStarted)

FieldTypeDescription
object *"square_connect"
connect_url *string (uri)Send a person with permission to manage the org here: this service's own page. They must be signed in, and they click through to Square themselves; nothing connects until they have read which account it is and said yes.
expires_at *string (date-time)The link works until then (10 minutes); starting again makes a new one and ends the old.

* required

Errors of its own. provider_unavailable. The errors every operation can answer are on the errors page.

The locations on this org's Square account#

GET /v1/payment_accounts/square/locations

Operation id listSquareLocations. MCP tool list_square_locations. SDK tickets.paymentAccounts.listSquareLocations.

The locations on the connected Square account, read from Square now, with the one the money goes through marked.

Who may call it. Any one of: An API key with scope full, read. Any other scope answers insufficient_scope; A signed-in dashboard member whose role has org.manage (owner, admin).

Answers 200. Square's own list, read now, with the one in use marked.

Fields (SquareLocations)

FieldTypeDescription
object *"square_locations"
data *array of SquareLocation

* required

Errors of its own. provider_unavailable. The errors every operation can answer are on the errors page.

Where Square sends the seller back after consent#

GET /v1/payment_accounts/square/callback

Operation id squareCallback.

Where Square sends the seller's browser back after consent. Not for your code to call. It holds no session and connects nothing: it keeps what Square sent as a proposal, and sends the browser to the Settings page to say yes or no.

Who may call it. Anyone: no key or sign-in is needed.

ParameterInTypeDescription
codequerystringSquare's one-time authorization code.
statequerystringWhat connect gave Square, returned unchanged.
errorquerystringSquare sends this when the seller said no.
error_descriptionquerystring

Answers 200. With Accept: application/json: where a browser would go.

Fields (SquareCallbackLanding)

FieldTypeDescription
object *"square_callback"
go_to *stringWhere a browser would be sent: this service's own Settings page, with what Square sent. It finishes nothing by itself.

* required

Answers 302. The browser goes to Settings, Payments, to read which account came back and say yes or no (?square=review), or to why not (?square=failed&why=...). This holds no session (the session cookie is SameSite=Strict, so a browser arriving from Square does not send it) and connects nothing: a live state is traded for a proposal only.

A signed-in manager clicks through to Square#

POST /v1/payment_accounts/square/connect/authorize

Operation id authorizeSquareConnect.

The page's call when a signed-in manager clicks through. That member becomes the only one who may finish, and gets Square's consent address. Not for a key.

Who may call it. A signed-in dashboard member whose role has org.manage (owner, admin).

Request body (AuthorizeSquareConnectInput)

FieldTypeDescription
token *stringsquare_connect from the link connect made.

* required

JSON
{
  "token": "org_EXAMPLE.test.EXAMPLEnonce0000000000000"
}

Answers 200. Square's consent address. This member is now the only one who may finish.

Fields (SquareAuthorizeStarted)

FieldTypeDescription
object *"square_authorize"
authorize_url *string (uri)Square's consent page, for the person who just clicked.

* required

Errors of its own. provider_unavailable, invalid_state_transition. The errors every operation can answer are on the errors page.

Say yes or no to the account Square sent back#

POST /v1/payment_accounts/square/finish

Operation id finishSquareConnect.

The person who clicked through has read which account came back, and says yes or no. Connecting replaces any account already there, which is revoked; every owner is emailed. Refused while an order waits on the account being replaced. Not for a key.

Who may call it. A signed-in dashboard member whose role has org.manage (owner, admin).

Request body (FinishSquareConnectInput)

FieldTypeDescription
answer *"connect" | "decline"The person has read proposed. connect: this account takes the money from now on, and any account it replaces is revoked. decline: nothing changes.

* required

JSON
{
  "answer": "connect"
}

Answers 200. Connected, or left as it was. Never a token.

Fields (PaymentAccount)

FieldTypeDescription
object *"payment_account"
provider *"square"
mode *Modetest or live, decided by the key (rt_test_… or rt_live_…). Test and live data never mix.
status *"not_connected" | "connected" | "revoked" | "broken"connected: charges and refunds go to this org's own Square account. revoked: the org or the seller ended it. broken: Square refused our stored token and a renewal did not help: connect again. not_connected: never connec…
merchant_id *string | nullSquare's id for the seller (not a secret).
location *objectThe Square location the money goes through.
business_name *string | nullThe seller's business name, as Square gives it: whose account this is.
proposed *objectBack from Square and waiting for the person who started it to read this and say yes. Nothing has changed yet.
owed_backobjectMoney that came for orders that ended, on its way back to buyers. It keeps being tried until it lands.
location_chosen *"first_active" | "picked" | nullHow that location came to be chosen: first_active, the first active one that takes cards, at connect; picked, by a person, through PATCH /v1/payment_accounts/square.
currency *string | nullThe location's currency: a charge in another is refused.
connected_at *string | nullAn instant in ISO 8601 with its zone, e.g. 2027-07-17T20:00:00Z. Answers are always UTC.
scopes *array of stringThe Square permissions the seller granted.
platform_feeobjectGiven on GET /v1/payment_accounts/square: null when the platform has set no fee for this org.

* required

Errors of its own. provider_unavailable, invalid_state_transition. The errors every operation can answer are on the errors page.