- POST /v1/auth/register: a merchant always gets a fresh organization; a
caller-supplied organizationId let anyone join an existing seller's org and
receive a platform:admin key (tenant takeover, present on main too).
- Customer (portal) sessions carry the seller's org id; they are now refused
on the management API instead of being treated as the org owner.
- Fee statements: issuance is serialized per merchant+period in-process and a
duplicate raced in by another instance is voided before sending; a draft
left by an interrupted run is sent on the next run. Overlapping runs
previously issued (and emailed) several statements for one month.
- Invoices: SettleKit-owned metadata keys (pay token, session bindings,
settlement facts, fee-statement markers) are stripped from API input, and a
payment from another organization never settles an invoice.
- Scope map: /v1/merchant/refunds/* needs payments:write (was reports:write).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Security fix plus team access. Before this change any valid API key,
including access keys the delivery system hands to BUYERS, authenticated
as the merchant on the whole management API, and GET /v1/api-keys listed
every organization's keys. Now only platform keys (issued at sign-up or
via POST /v1/api-keys/platform, marked with the platform product id) can
call the API, and each request needs its resource scope
(<resource>:read|write, write implies read; platform:admin or * for
full access), answered with 403 and details.requiredScope otherwise.
Keys cannot mint broader keys, customer keys cannot carry management
scopes, key listing is tenant-scoped and keys can be revoked by id.
Dashboard sessions get team roles (owner, admin, developer, support,
viewer) mapped to scopes. /v1/team manages members and email
invitations (packages/invitations, token hash only, 7-day expiry);
/v1/auth/invitations/accept joins the org and creates the account. The
last owner is protected and only owners grant owner. Dashboard: Team
page, invite accept page, and an API keys page that creates restricted
keys and shows the secret once.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>