Non-admin org members see "connect a payout account" even when the org's Stripe account is connected
Bug
When an organization's payout account was created by one member, other members of the same org who are not that account's admin_id are shown the "Connect a payout account" onboarding state, even though the org already has a fully connected Stripe payout account.
Root cause
GET /v1/payout-accounts/{id} is gated by PayoutAccountPolicyGuard in server/polar/authz/dependencies.py:
payout_account = await pa_repo.get_by_id(id)
if payout_account is None or payout_account.admin_id != auth_subject.subject.id:
raise ResourceNotFound()This returns 404 for any authenticated org member who isn't the payout account's admin_id, not just for members outside the org. The web app's usePayoutAccount(organization.payout_account_id) hook (clients/apps/web/src/hooks/queries/payout_accounts.ts) treats a 404/undefined result as "no payout account exists", so PayoutAccountSection.tsx falls back to the "Connect payout account" call-to-action instead of showing the connected status.
This is inconsistent with AccountPolicyGuard, which resolves access via the resource's owning organization rather than a single user id, and with the engineering handbook (handbook/engineering/backend-development/authorization.mdx), which documents PayoutAccountPolicyGuard as resolving {id} → PayoutAccount → owning Organization, same as AccountPolicyGuard. The actual implementation only checks admin_id, so any org member other than the account's creator gets a 404 and a misleading UI state.
Repro
- Have User A create/connect a Stripe payout account for an organization (User A becomes
PayoutAccount.admin_id). - Log in as User B, another member of the same organization.
- Visit the organization's Finance/Account page.
Expected: User B sees the payout account as connected (or at least a status reflecting the org's actual state).
Actual: User B is shown "Connect a payout account" instructions, and GET /v1/payout-accounts/{id} returns 404 for User B.
Suggested fix
Either:
- Update
PayoutAccountPolicyGuardto resolve access via the payout account's owning organization(s) (mirroringAccountPolicyGuard), gated by an appropriate finance/payouts permission, or - If restricting payout account details to the
admin_idis intentional, update the frontend to distinguish "no payout account" from "payout account exists but you can't view its details" so non-admin members aren't told to connect an account that already exists.
Sent by @allison-polar from Stripe Connect account UX bug investigation.
Source: polarsource/polar