> ## Documentation Index
> Fetch the complete documentation index at: https://viewerdocs.planpoint.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Stripe merchant connections

> Onboard a merchant, connect an existing Stripe account, refresh status, and open payout components.

All operations require **customer-dashboard authentication**, not a Portal buyer token. See [access and identifiers](https://viewerdocs.planpoint.io/api-documentation/payments/overview.md#access-and-identifiers).

These operations affect the customer's merchant connection, not their subscription billing. Connection flows are for the account owner, not for linking a payout destination on somebody else's behalf.

## Create or resume onboarding

`POST /api/stripe/connect`

| JSON field | Required | Description |
| - | - | - |
| `userId` | Yes | Must equal the signed-in customer's ID. |
| `refresh_url` | Yes | Valid URL to return to when an onboarding link expires. |
| `return_url` | Yes | Valid URL for returning after onboarding. |

```json Request theme={null}
{
  "userId": "000000000000000000000006",
  "refresh_url": "https://example.com/payments/retry",
  "return_url": "https://example.com/payments/connected"
}
```

```json Response (200) theme={null}
{ "url": "https://connect.stripe.com/setup/s/EXAMPLE" }
```

Uses an existing linked account when it can be verified; otherwise, if no account is linked, creates a Standard account and stores its ID. Open the returned onboarding URL. For connecting an already-existing but unlinked Stripe account, use OAuth below.

Errors: `400` invalid input, `401` unauthenticated, `403` non-self request, `404` missing customer, `409` existing connection cannot be verified, or `500` provider failure. A `409` is not permission to automatically replace the merchant account; resolve the connection with support.

## Start existing-account OAuth

`POST /api/stripe/oauth-start`

Send a valid `redirect_uri` URL registered for the integration's Stripe OAuth flow.

```json Request theme={null}
{ "redirect_uri": "https://example.com/stripe/callback" }
```

```json Response (200) theme={null}
{ "url": "https://connect.stripe.com/oauth/authorize?response_type=code&client_id=EXAMPLE&scope=read_write&redirect_uri=https%3A%2F%2Fexample.com%2Fstripe%2Fcallback&state=EXAMPLE" }
```

Navigate to the returned URL unchanged. After Stripe redirects back, retain its `code` and `state` for completion. State is scoped to the signed-in customer and expires after 30 minutes.

Errors: `400` invalid URI, `401` unauthenticated, `403` disallowed delegated access, `409` an account is already linked, and `503` existing-account connection unavailable.

## Complete existing-account OAuth

`POST /api/stripe/oauth-complete`

Required `code` is 1-200 characters; required `state` is 1-2000 characters. Use the exact callback values and the same customer identity.

```json Request theme={null}
{ "code": "<STRIPE_AUTHORIZATION_CODE>", "state": "<OAUTH_STATE>" }
```

```json Response (200) theme={null}
{
  "stripeAccountId": "acct_EXAMPLE",
  "stripeOnboardingDone": true,
  "stripeDetailsSubmitted": true,
  "stripeAccountEmail": null,
  "stripeAccountName": "Example Merchant"
}
```

Exchanges the one-use code, verifies provider mode, and saves the merchant connection. Email and name may be null.

Errors: `400` invalid input/code exchange or wrong provider mode, `401` unauthenticated, `403` expired/mismatched state or disallowed access, `409` an account is already linked (including a concurrent connection), and `500` failure to save/retrieve the connection.

## Refresh account status

`GET /api/stripe/account-status`

No query fields. Reads the signed-in customer's linked account from Stripe and can update saved onboarding flags.

```json Response (200) theme={null}
{
  "stripeAccountId": "acct_EXAMPLE",
  "stripeOnboardingDone": true,
  "stripeDetailsSubmitted": true,
  "stripeAccountEmail": null,
  "stripeAccountName": "Example Merchant"
}
```

With no linked account:

```json Response (200, no connection) theme={null}
{
  "stripeAccountId": null,
  "stripeOnboardingDone": false,
  "stripeDetailsSubmitted": false
}
```

If Stripe cannot be reached or the account cannot be retrieved, the endpoint returns the saved ID/flags with `stale: true` and omits the display fields. Do not interpret stale data as fresh confirmation of capability or as evidence the account was deleted. Missing authentication returns `401`.

## Create a payouts session

`GET /api/stripe/create-payouts-session`

Required query `accountId` is the signed-in customer's linked Stripe account ID.

```bash theme={null}
curl 'https://app.planpoint.io/api/stripe/create-payouts-session?accountId=acct_EXAMPLE' \
  -H 'Authorization: Bearer <DASHBOARD_TOKEN>'
```

```json Response (200) theme={null}
{ "accountClientSecret": "<STRIPE_ACCOUNT_SESSION_CLIENT_SECRET>" }
```

Despite using GET, this creates a Stripe Account Session for embedded payout components, including instant/standard payouts, payout schedule editing, and external-account collection. It does not itself request a payout. Keep the returned secret private and do not cache/share this response.

Errors use `error`: `400` missing/invalid account ID, `401` unauthenticated, `403` account does not belong to the caller, and `500` provider failure.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.