Skip to main content
GET /v2/merchant/x402-earnings returns the authenticated merchant’s rollup of x402 settlement events: per-row settlement detail, totals envelope (settlement amount + count), and pagination. This endpoint is the data source for the merchant x402 Earnings page in the dashboard.
This endpoint requires:
  • Merchant JWT — any authenticated merchant role (OWNER, MEMBER, PRODUCER)
The merchant scope is derived from the JWT sub claim. There is no merchantId query parameter. If a client passes one anyway it is silently ignored — the response is always scoped to the JWT-bound merchant.

GET /v2/merchant/x402-earnings

Authentication

Obtain a merchant JWT via POST /merchant/admin/login — see Authentication.

Query parameters

Example

With a date filter:

Response — 200 OK

Fields

Errors

Notes

  • X402_ENABLED gating. Until the platform flag X402_ENABLED is set to true, X402SettlementLog accepts no writes and this endpoint always returns rows: [], totalSettlementsUsdCents: 0, totalCount: 0. The endpoint itself is always reachable — the gate is at the write path, not the read path. Merchants safely linkable to the page before the flip; it renders an empty-state.
  • Auth scope. The endpoint reads merchantId from the JWT sub claim only. Any ?merchantId= is silently ignored. A merchant cannot read another merchant’s settlements through this endpoint — even with a syntactically valid query parameter pointing at the target.
  • Fail-open semantics. If the underlying X402SettlementLog aggregation throws, the endpoint returns the empty-state envelope (rows: [], totals 0) with 200 OK rather than propagating the error. Inspect server logs / Sentry for the underlying failure.
  • Currency. All monetary fields are USD cents, integer — same contract as the admin x402-earnings rollup. Divide by 100 for major-unit display.
  • Pagination. total and totalCount count settlement rows, not products / orders. A merchant with 50 settlements across 3 products reports total: 50, totalCount: 50.
  • Date filter semantics. startDate and endDate are inclusive bounds on settledAt. Omit either to leave that side of the window unbounded; omit both for the full per-merchant history (capped at the merchant’s earliest settlement).