Authentication
Use an active verified merchant’sx-api-key or supported merchant_token session. An invalid supplied key does not fall back to a cookie. Consumer and admin cookies are not merchant authentication.
GET /api/merchant/me
Returnssuccess, merchant, settlementPreference, stats and recentPayments.
merchant: ID, email, business name, creation time, wallet provider/address, maskedapiKeyHintandhasApiKey. No full API key is returned.settlementPreference: canonical symbol, address and decimals. A corrupt stored preference can degrade to USDC in this read view.stats: total/successful payment counts,volumeByCurrency, deprecated mixed-unittotalVolumeand success rate.recentPayments: up to 20 rows with reference, amount, currency, stored status, timestamp and checkout URL.
401; the handler also maps caught read failures to 401 with Invalid session, so that message alone does not diagnose the cause.
PATCH /api/merchant/me
Updates the default settlement preference for future invoices. SendsettlementToken and/or settlementTokenAddress with canonical supported identity; mismatches and non-USDC preferences are rejected with 400 (Merchant settlement is USDC-only). A stored legacy EURC preference is not automatically rewritten. Existing invoice amounts and recipients are unchanged.
The route applies the payments limiter and returns success, settlementPreference and merchantId on success. Keep request fields server-derived; arbitrary provider token claims are not accepted.
DELETE /api/merchant/me
Clearsmerchant_token and returns success: true, message: 'Logged out.'. If a merchant resolves, it attempts to increment the account’s session version; that update is best-effort. The cleared-cookie response does not independently prove all other copies of the session were revoked after a database failure.

