Skip to content

[Bug] Zod validation errors on /payments and /payments/[id] API endpoints #24287

@linear

Description

@linear

Summary

GET /payments and GET /payments/[id] on the Platform API are returning Zod validation errors, blocking consumers from retrieving the paymentUid used for abandoned-cart recovery links.

#15513

Proposed Solution

  • Identify and fix the schema mismatch causing Zod parse failures on both endpoints.
  • Align response payloads with the published/expected types; ensure paymentUid is included when available.
  • Add robust request/response validation with clear error messaging (non-200 paths).
  • Backfill unit/integration tests for both endpoints, including happy paths and failure cases.

Acceptance Criteria

  • Calling GET /payments returns 200 with a validated array payload; no Zod errors.
  • Calling GET /payments/[id] returns 200 with a validated object payload; no Zod errors.
  • paymentUid is present when applicable and typed correctly.
  • Invalid ID returns 404 with a typed error object (no Zod stack traces).
  • Contract tests added (and passing) for: list, by-id, invalid-id, and schema shape.
  • Docs updated to reflect the final response schema.

Metadata

Metadata

Assignees

Labels

Medium priorityCreated by Linear-GitHub Syncapiarea: API, enterprise API, access token, OAuth🐛 bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions