Payouts & Finance Ledger
Relevant source files
The following files were used as context for generating this wiki page:
- server/polar/payout/endpoints.py
- server/polar/backoffice/payouts/endpoints.py
- clients/apps/web/src/components/Landing/features/FinancePage.tsx
- clients/apps/app/app/(authenticated)/finance/index.tsx
- clients/apps/web/src/app/(main)/dashboard/[organization]/(header)/finance/(wide)/payouts/PayoutsPage.tsx
- server/polar/backoffice/DEVELOPMENT_GUIDE.md
Polar provides a comprehensive financial infrastructure layer that handles the movement of funds from customer purchases to organization payouts. The system is built around a transparent ledger that tracks every order, refund, fee, and payout in chronological order. As a Merchant of Record (MoR), Polar handles the complexity of international sales tax and remittance, presenting a "Live Balance" to users that represents the net amount available for withdrawal.
Sources: clients/apps/web/src/components/Landing/features/FinancePage.tsx:28-40, clients/apps/web/src/components/Landing/resources/MORPage.tsx:17-23
Financial Ledger Architecture
The finance system operates on a ledger-based model where every transaction is recorded with its associated fees. This ensures that the balance shown to the organization is always net of platform fees, card network extras, and taxes.
Key Components
- Transactions Ledger: A chronological record of every financial event, including orders, refunds, and disputes. Each entry explicitly breaks out associated fees.
- Live Balance: A real-time calculation of payable funds. Multi-currency orders are converted to USD at the time of transaction to maintain settlement stability.
- Payout Accounts: Connections to Stripe Connect Express which facilitate the actual transfer of funds to the user's bank account.
Sources: clients/apps/web/src/components/Landing/features/FinancePage.tsx:43-61, clients/apps/web/src/app/(main)/dashboard/[organization]/(header)/finance/(wide)/payouts/PayoutsPage.tsx:110-180
Transaction Data Flow
The following diagram illustrates how financial events flow through the system to update the available balance and generate the ledger.
The diagram shows the lifecycle of a payment from initial capture to manual withdrawal.
Sources: clients/apps/web/src/components/Landing/features/FinancePage.tsx:32-38, server/polar/payout/endpoints.py:89-105
Payout Management
Payouts in Polar are deliberately manual. The platform does not perform automatic sweeps, allowing organizations to control when funds are moved to their connected accounts.
Payout Lifecycle and Statuses
A payout goes through several states from creation to final settlement.
| Status | Description |
|---|---|
pending | Payout created but not yet processed. |
in_transit | Funds are currently being moved by the processor. |
succeeded | Funds have successfully reached the destination account. |
failed | The transfer failed (e.g., bank rejection). |
canceled | The payout was manually voided before completion. |
held | Payout is temporarily paused for review. |
Sources: server/polar/backoffice/payouts/endpoints.py:44-60, server/polar/payout/endpoints.py:34-40
Payout Execution Sequence
The manual payout process involves estimation, creation, and asynchronous execution through background workers.
API and Implementation Details
Core Payout Endpoints
The server/polar/payout/endpoints.py file defines the primary interface for managing payouts.
| Endpoint | Method | Description |
|---|---|---|
/payouts/ | GET | Lists payouts with filters for account ID and status. |
/payouts/estimate | GET | Calculates the current withdrawable balance for an organization. |
/payouts/ | POST | Triggers a new manual payout for the entire available balance. |
/payouts/{id}/csv | GET | Exports specific payout details and associated transactions as a CSV. |
/payouts/{id}/invoice | GET | Retrieves invoice data associated with the payout. |
Sources: server/polar/payout/endpoints.py:25-140
Internal Backoffice Management
Administrators have access to enhanced payout controls for auditing and troubleshooting, located in server/polar/backoffice/payouts/endpoints.py.
- Manual Retry: Allows re-triggering a failed payout attempt or processing a remaining amount.
- Sync with Provider: Forces a refresh of the payout status by querying the Stripe API directly.
- Cancel Payout: Reverses funds back to the organization balance if the payout is still in a cancelable state.
Sources: server/polar/backoffice/payouts/endpoints.py:230-265, server/polar/backoffice/payouts/endpoints.py:380-410
Frontend Integration
The finance dashboard is implemented using TanStack Query for data fetching and provides real-time feedback on balance and payout status.
// Example of balance check in the mobile application
const canWithdraw =
payoutAccount &&
payoutAccount.is_payout_ready &&
summary?.available_balance?.amount &&
summary.available_balance.amount >= 1000 // Minimum 10 USD threshold
Sources: clients/apps/app/app/(authenticated)/finance/index.tsx:50-55, clients/apps/web/src/app/(main)/dashboard/[organization]/(header)/finance/(wide)/payouts/PayoutsPage.tsx:210-240
Summary
The Payouts & Finance Ledger system ensures financial transparency by providing a detailed audit trail of all transactions and fees. By acting as a Merchant of Record and utilizing Stripe Connect Express, Polar abstracts the complexity of global payment processing and tax compliance into a simplified "manual withdrawal" workflow for developers.
Sources: clients/apps/web/src/components/Landing/features/FinancePage.tsx:100-115, server/polar/backoffice/DEVELOPMENT_GUIDE.md:80-100