Square integration — remaining tasks
The live stack stores Square OAuth tokens and business configuration in Convex (not an external headless CMS). The notes below are a task checklist against the site-nextjs API routes and Convex module.
Vercel project (ftn-vercel-site)
-
API routes: Implement or adapt
api/getSquareItems.tsand the Square OAuth callback path underapi/auth/callback/square/to use the shared Square helpers inlib/square-api.tsand tokens fromconvexqueries (for exampleapi.square.getSquareCredentials). -
Install dependencies:
pnpm install square(and other app deps as already declared in the package manifest). -
Environment variables: Set Square application ID, secret, redirect URI, and Convex / Next public URLs in the Vercel project. Redirect URI must match the deployed
/api/auth/callback/squareURL. -
Deploy the Vercel project.
Post–OAuth: Convex and business tokens
-
Vercel base URL: Ensure
NEXT_PUBLIC_APP_URL(or the URL your UI uses for API calls) matches the deployment used by menu and owner dashboards. -
CSRF (if applicable): Harden the Square callback route for CSRF and state validation as needed.
-
Per-owner tokens:
getSquareItemsand related routes already resolve the active business owner viarequireBusinessAccessand read credentials from Convex. Extend only if new flows require additional fields or token refresh.
Frontend and data model (Convex)
-
Menu and owner views: Update dashboard components to pass
ownerId/ business context as required by the Convex-backed APIs. -
Store Square identifiers (location, catalog ids, etc.) in the Convex schema and UI that replace any legacy external CMS fields; keep field names consistent with the Convex schema in
convex/. -
Revisit any Square-related config stored in your schema when Square APIs or webhooks change.