# POST /api/v1/credit/lines/{credit_line_id}/cards/stripe-issuing/connect

> Provision or update a credit line's Stripe Connect Issuing account and CreditPolicy

- **Tag:** credit
- **Operation ID:** `provision_line_stripe_issuing_connect`

## Description

Creates or updates a Stripe Custom connected account (`card_issuing` + `transfers` + optional `funding_credit`) for a merchant credit line, generates an `account_onboarding` link when `return_url` and `refresh_url` are supplied, and optionally activates a Stripe Issuing Credit `CreditPolicy` or records a `FundingObligation` repayment. Accounts must belong to the business and per-line accounts must match this line. Omitted accounts reuse an existing line account or create one idempotently. Onboarding URLs must use the configured app origin. Live business operator action (an API token receives `403`); sandbox businesses are refused before Stripe calls.

## Authentication

Bearer token in `Authorization` header.
Required header: `x-business-id: <business uuid>`.

## Parameters

- `credit_line_id` (path, string, required) — Credit line UUID to bind the Stripe Connect account to.

## Request body

Schema: `CreditStripeLineConnectRequest`

- `stripe_account_id` (string) — Owned connected Stripe account ID (`acct_...`). Per-line accounts require Stripe metadata matching this business and this line. Omit to reuse a verified existing line account, recover one after a failed save, or create a Custom account with a stable per-business/per-line idempotency key. Editable issuer_config alone is not ownership proof; `platform` is refused.
- `country` (string) — Two-letter country code for a newly created connected account.
- `enable_funding_credit` (boolean) — Also request the `funding_credit` capability (Charge Card beta) on the connected account.
- `return_url` (string) — Return URL for Stripe-hosted onboarding. Supply with refresh_url; both must use the configured product-app origin (scheme, host and port), without credentials or fragments. Validated before Stripe mutations.
- `refresh_url` (string) — Refresh URL for Stripe-hosted onboarding. Supply with return_url; both must use the configured product-app origin (scheme, host and port), without credentials or fragments. Validated before Stripe mutations.
- `activate_credit_policy` (boolean) — Configure and activate the connected account's `CreditPolicy` (`POST /v1/issuing/credit_policy`).
- `credit_limit_cents` (integer) — Override credit limit in cents for `CreditPolicy`; defaults to the credit line's limit.
- `days_until_due` (integer) — Days until due after the credit period ends on the `CreditPolicy`.
- `funding_obligation_id` (string) — Optional `FundingObligation` ID (`ifo_...`) to record a repayment against.
- `pay_amount_cents` (integer) — Repayment amount in cents to record on `funding_obligation_id` (`/pay`).

## Responses

### 201 — Successful Response

Schema: `SuccessEnvelope_CreditStripeLineConnectResponse_`

- `success` (boolean)
- `message` (string)
- `code` (string)
- `data` (CreditStripeLineConnectResponse)

### 400 — Bad Request - Invalid input

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 401 — Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 403 — Forbidden - Insufficient permissions

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 404 — Not Found - Resource does not exist

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 422 — Validation Error

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

## Code samples

### cURL

```bash
curl -X POST 'https://api.ondayzero.com/api/v1/credit/lines/{credit_line_id}/cards/stripe-issuing/connect' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "stripe_account_id": "string",
  "country": "string",
  "enable_funding_credit": false,
  "return_url": "string",
  "refresh_url": "string",
  "activate_credit_policy": false
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/credit/lines/{credit_line_id}/cards/stripe-issuing/connect', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "stripe_account_id": "string",
  "country": "string",
  "enable_funding_credit": false,
  "return_url": "string",
  "refresh_url": "string",
  "activate_credit_policy": false
}),
});
const data = await response.json();
```

### Python

```python
import httpx

headers = {
    "Authorization": "Bearer dz_your_token",
    "x-business-id": "YOUR_BUSINESS_ID",
}

payload = {'stripe_account_id': 'string',
 'country': 'string',
 'enable_funding_credit': False,
 'return_url': 'string',
 'refresh_url': 'string',
 'activate_credit_policy': False}

response = httpx.post("https://api.ondayzero.com/api/v1/credit/lines/{credit_line_id}/cards/stripe-issuing/connect", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/credit/provision-line-stripe-issuing-connect
- OpenAPI slice: https://www.ondayzero.com/docs/reference/credit/provision-line-stripe-issuing-connect/openapi.json
- Other endpoints in **credit**: https://www.ondayzero.com/docs/reference/credit (markdown bundle: https://www.ondayzero.com/docs/reference/credit.md, OpenAPI: https://www.ondayzero.com/docs/reference/credit/openapi.json)
- Endpoint catalog: https://www.ondayzero.com/docs/reference/index.md
