Skip to main content
GET /v2/merchant/shops/:shopId/abandoned-carts and GET /v2/merchant/shops/:shopId/abandoned-carts/stats are the merchant-facing surface for the abandoned-cart recovery admin page. They let the shop owner view their own recovery funnel — the paginated list of abandoned carts and the top-of-page stat cards (active / recovered / recoveryRate).
These endpoints are gated by RoleGuard([PRODUCER, SUPER_ADMIN]) PLUS an in-handler shop-ownership assertion: a PRODUCER’s JWT-bound shopId claim must equal the :shopId path parameter. Cross-shop reads from a merchant token return 403. SUPER_ADMIN tokens carry no shopId claim and pass through for operator impersonation.

Scope

These endpoints are the merchant-scoped counterpart to the SUPER_ADMIN admin surface at /admin/shops/:shopId/abandoned-carts. The original admin route remains mounted at its original path with its original guard — this is strictly additive. The recovery cron, schema, and write-path are untouched.

GET — list abandoned carts

Returns the merchant’s abandoned carts, sorted newest-abandonedAt-first, paginated.

Request

Curl example

Response (200)

Lifecycle states

Error responses

GET — recovery stats

Aggregate counts for the top-of-page stat cards. Client-side aggregation over the paginated list would produce a wrong recoveryRate past page 1 — this endpoint computes the totals server-side over the full collection.

Curl example

Response (200)

Field reference

recoveryRate is checkout-success semantic, not click-through. A customer who clicks the recovery email but bounces off checkout does NOT count as recovered. The chokepoint is service.markRecovered invoked from the checkout-success path — see the POST /v2/abandoned-cart-recovery/recover endpoint that resumes the cart upstream of that flip.
Both countDocuments calls run in parallel and hit the existing {shopId, status, abandonedAt} compound index — covered counts, no collection scan.

Error responses

Same gating + 401/403 semantics as the list endpoint above.

Typical merchant dashboard flow