Stripe Integration
Relevant source files
The following files were used as context for generating this wiki page:
Polar utilizes Stripe as its core payment processing infrastructure, functioning as a Merchant of Record (MoR) to handle global tax compliance, VAT, and subscriptions on behalf of developers. While Stripe operates as the underlying Payment Service Provider (PSP), Polar provides an abstraction layer that manages the complexities of international remittance, liability, and automated benefit delivery.
Sources: CLAUDE.md:78, clients/apps/web/src/components/Landing/comparison/PolarStripePage.tsx:21-25, clients/apps/web/src/components/Landing/resources/MORPage.tsx:142-150
Integration Architecture
The integration follows a hybrid model where Polar uses Stripe's "rails" for processing reliability while maintaining its own business logic layer for entitlements and unit economics.
The diagram above illustrates the bidirectional communication between Polar's backend services and Stripe's specialized infrastructure components.
Sources: DEVELOPMENT.md:12-25, server/polar/organization_review/analyzer.py:530-550, clients/apps/web/src/components/Landing/resources/WhyPolarPage.tsx:245-250
Merchant of Record (MoR) vs. PSP
The primary distinction in Polar's integration is the assumption of liability. In a standard Stripe integration (PSP), the developer is responsible for tax registration and remittance. In Polar's integration, Polar acts as the reseller.
| Responsibility | Standard Stripe (PSP) | Polar (MoR) |
|---|---|---|
| Tax Compliance | Developer's Responsibility | Handled by Polar |
| Global Remittance | Developer files in each country | Polar files globally |
| Liability | Developer carries liability | Polar takes on liability |
| Payouts | Standard Payouts | Stripe Connect Express |
Sources: clients/apps/web/src/components/Landing/comparison/PolarStripePage.tsx:150-180, clients/apps/web/src/components/Landing/resources/MORPage.tsx:44-80
Key Components
1. Stripe Connect & Payouts
Polar uses Stripe Connect Express to facilitate payouts across more countries than standard Stripe Payments supports directly. This allows developers to receive funds even in regions with complex financial regulations.
Sources: clients/apps/web/src/components/Landing/resources/WhyPolarPage.tsx:245-250, server/polar/organization_review/analyzer.py:530-540
2. Risk and Compliance Analysis
Polar performs automated reviews of organizations using Stripe Identity and Stripe requirements data.
- Stripe Identity Verification: Checks for
selfie_mismatch,document_expired, orrejected.fraudstatuses. - Capabilities Check: Monitors if Stripe capabilities are
active,restricted, orpending. - Disabled Reasons: Evaluates Stripe's internal
disabled_reasonto flag potential fraud.
Sources: server/polar/organization_review/analyzer.py:530-545
3. Tax Calculation (Stripe Tax)
Polar integrates Stripe Tax to monitor and automate the capturing of taxes such as VAT and GST at the point of transaction, specifically for EU B2B reverse charges and B2C collections.
Sources: clients/apps/web/src/components/Landing/resources/MORPage.tsx:105-115, DEVELOPMENT.md:118-120
Webhook Handling
Polar handles two distinct types of Stripe webhooks: Account webhooks and Connect webhooks.
Local Development Configuration
Setting up the integration locally requires specific environment variables and the Stripe CLI for webhook forwarding.
Required Environment Variables
| Variable | Description |
|---|---|
POLAR_STRIPE_SECRET_KEY | Stripe Test Secret Key (sk_test_...) |
POLAR_STRIPE_PUBLISHABLE_KEY | Stripe Test Publishable Key (pk_test_...) |
POLAR_STRIPE_WEBHOOK_SECRET | Signing secret for account webhooks |
POLAR_STRIPE_CONNECT_WEBHOOK_SECRET | Signing secret for Connect webhooks |
Sources: CLAUDE.md:70-75, DEVELOPMENT.md:110-125
CLI Webhook Forwarding
The dev stripe --listen command automates the forwarding of Stripe events to the local API:
stripe listen --forward-to http://127.0.0.1:8000/v1/integrations/stripe/webhook \
--forward-connect-to http://127.0.0.1:8000/v1/integrations/stripe/webhook-connect
Sources: dev/cli/commands/stripe.py:126-140
Automated Risk Assessment Logic
The integration includes a sophisticated ReviewAnalyzer that evaluates Stripe-specific metrics to determine merchant legitimacy:
- Sample Size Rule: Rate-based metrics (refunds/disputes) are only considered statistically significant after 10 succeeded payments.
- High Risk Thresholds:
- One-time products over $1,000 USD.
- Monthly subscriptions over $500 USD for new organizations.
- Any
rejected.fraudsignal from Stripe.
Sources: server/polar/organization_review/analyzer.py:53-70, server/polar/organization_review/analyzer.py:545-560
Polar's Stripe integration effectively transforms a low-level payment processor into a high-level monetization platform, insulating developers from the regulatory and technical overhead of global commerce.