# Payouts

> Let sellers set up payouts with Stripe's embedded onboarding, and show them where their money is.

Sellers are paid through Stripe Connect on the marketplace's Stripe account. A seller sets up payouts once, inside your shop, with Stripe's embedded onboarding form. Until they do, sales still happen; the payout waits.

## Check where they are

```http
GET /v1/me/payouts
```

The answer has `status`:

| `status` | Show |
|---|---|
| `none` | "Set up payouts". |
| `action_required` | "Finish setting up payouts". `due` lists what Stripe still needs. |
| `pending` | "Stripe is checking your details". |
| `ready` | Nothing to do: they'll be paid. |

## Run the onboarding form

1. Ask whether they sell as a private person or a company, and where they live.
2. Start the session from your server:

   ```http
   POST /v1/me/payouts/session
   { "country": "SE", "business_type": "individual" }
   ```

   The answer has a `client_secret`. `country` and `business_type` are used the first time only.

3. Show Stripe's [account onboarding component](https://docs.stripe.com/connect/supported-embedded-components/account-onboarding) with it, asking only for what's needed now:

   ```ts
   import { loadConnectAndInitialize } from '@stripe/connect-js'

   const connect = loadConnectAndInitialize({
     publishableKey: STRIPE_PUBLISHABLE_KEY,
     fetchClientSecret: async () => (await startPayoutSetup()).client_secret, // your server calls POST /v1/me/payouts/session
   })
   const onboarding = connect.create('account-onboarding')
   onboarding.setCollectionOptions({ fields: 'currently_due', futureRequirements: 'omit' })
   onboarding.setOnExit(() => refreshPayoutStatus())
   document.querySelector('#payouts')?.append(onboarding)
   ```

4. When they leave the form, read `GET /v1/me/payouts` again.

## When sellers are paid

- An order's `payout` shows the seller's side: `subtotal`, `commission`, `storage_fee` and `amount`.
- It's `pending` until the buyer has the listing (`received`), then `paid`.
- `waiting_for_payout_details` means the sale is done but the seller hasn't finished setting up payouts. It's paid as soon as they do.
- `held_for_chargeback` means the buyer's bank disputed the payment. The marketplace's team handles it.
