Skip to main content

Authentication

Use an active verified merchant’s x-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

Returns success, merchant, settlementPreference, stats and recentPayments.
  • merchant: ID, email, business name, creation time, wallet provider/address, masked apiKeyHint and hasApiKey. 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-unit totalVolume and success rate.
  • recentPayments: up to 20 rows with reference, amount, currency, stored status, timestamp and checkout URL.
The handler queries only the latest 50 merchant rows before network filtering. Stats describe that sample, not lifetime totals. Mainnet views exclude explicit historical testnet rows. Status/timestamp are stored fields; there is no live chain reconciliation here. Use the ledger for the separate full-row view, and reconcile actual receipts when needed. Missing authentication returns 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. Send settlementToken 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

Clears merchant_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.