# Stripe Connect

# Stripe Connect

Stripe Connect lets each company receive payouts on its own Stripe account while the platform takes a commission.

## Connecting an account

1. Go to **Company Settings** → **Payments** → Stripe accounts (`/companies/{company}/stripe-accounts`).
2. Click **Onboard** (`POST /companies/{company}/stripe/onboard`) — redirects to Stripe's onboarding flow.
3. Stripe returns to `stripe-accounts/{stripeAccount}/refresh`; the account row stores `stripe_account_id`, `type`, `country` and `email`. The **Sync** action (`POST stripe-accounts/{stripeAccount}/sync`) re-pulls the account state.

## Payouts & commissions

- Payments are **destination charges**: `transfer_data.destination` = the company's account, `application_fee_amount` = the package's flat + percentage fee. Refunds pass `refund_application_fee` so the platform fee is returned proportionally.
- `app:stripe-sync-payouts` (daily 03:15) syncs paid-out totals from Stripe payout history; each `Financial` row records `payout_id` and `paid_out_at`.
- `app:stripe-sync-commissions` (daily 03:00) reconciles the total Stripe fees (what Stripe charges the platform) per connected account.

## Webhooks

Three public endpoints — no session/CSRF, verified by Stripe signature:

- `POST /stripe/webhook` — payment intents, refunds, checkout completion.
- `POST /stripe/connect-webhook` — connected-account events.
- `POST /stripe/billing-webhook` — subscription lifecycle.

All are rate-limited by the `stripe-webhook` limiter: **1000 req/min per IP** (generous on purpose — Stripe retries on 5xx and one checkout produces several events). Events stuck in `processing_at` for over 5 minutes are reaped hourly (`app:stripe-reap-stale-webhook-events`).

## Permissions

- `stripeaccounts.view` — see connected accounts (owner + admin).
- `stripeaccounts.create` / `stripeaccounts.update` — onboard, edit and sync (owner by default).
- The embedded panels additionally check `companies.update` / the account's `view` policy.


---
> Source: https://placeful-app.com/en/docs/companies/stripe-connect
