Skip to content

square-api-reference

Use when working with Square API for payments, orders, customers, catalog, webhooks, or OAuth. Also use when setting up Square authentication, handling payment errors, or switching from the legacy Square SDK.

ModelSource
sonnetpack: payments
Full Reference

┏━ πŸ”§ square-api-reference ━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Use when working with Square API for payments,… ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

Version: 2026-01-22 | Production: https://connect.squareup.com | Sandbox: https://connect.squareupsandbox.com

ItemValue
Current API Version2026-01-22
AuthAuthorization: Bearer ACCESS_TOKEN (server-side only)
Node.jsnpm install square (v40+) β€” requires BigInt for money fields
Pythonpip install squareup (v42+) β€” Pydantic response models

Route to the relevant file based on the task:

I want to…File
SDK install, versioning, environments, migration from legacyreference/sdk-setup.md
Access tokens, OAuth 2.0, PKCE, scopes, client initreference/authentication.md
Create/cancel/refund payments, idempotency, feesreference/payments.md
Create orders, pay orders, order statesreference/orders.md
Customer profiles, cards on file, list/charge saved cardsreference/customers.md
Catalog items, variations, categories, upsert, searchreference/catalog.md
Webhook signature verification, event types, best practicesreference/webhooks.md
Error categories, HTTP codes, error handling pattern, rate limits, backoffreference/errors-and-limits.md
Sandbox setup, test nonces, Web Payments SDK, local webhook testingreference/testing.md
API version history, SDK rewrite migration guidereference/changelog.md

Usage: Read the reference file matching your current task from the index above. Each file is self-contained with code examples and inline gotchas.

GotchaDetail
Node.js money fieldsRequire BigInt(100) β€” plain integers throw
Python responsesPydantic models β€” use .attribute, not ['key']
Python errorstry/except ApiError β€” not response.is_error()
Webhook body parsingMust use raw body parser β€” express.raw() not express.json()
Signature comparisonUse hmac.compare_digest / timingSafeEqual β€” not ==
Sandbox vs productionCredentials are completely separate β€” no cross-environment tokens
Legacy SDK pathssquare/legacy and square_legacy deprecated β€” migrate now