Skip to main content
Docs

Stripe connections

A connection links your Stripe account to one mode. You paste a restricted key; Holdyn checks its permissions, reads the account, stores the publishable key and creates the webhook endpoints it needs on your account. Connecting is asynchronous: the request answers 202 and you poll GET /connections for progress. The key is stored encrypted and is never returned (only its last four characters). See Connect your Stripe account.

The base is https://holdyn-fb2e34c7cbae.herokuapp.com/api/v1/b2b. Every endpoint below lists who may call it.

At a glance#

Objects

StripeConnection

StripeConnection (example values)
{
  "id": "sconn_6543a1b2c3d4e5f6a7b8ca30",
  "object": "stripe_connection",
  "mode": "test",
  "livemode": false,
  "status": "active",
  "health": "connected",
  "health_reason": null,
  "health_changed_at": "2026-11-02T09:20:00.000Z",
  "last_checked_at": "2026-11-05T12:00:00.000Z",
  "connect_job": { "kind": "connect", "step": "done", "started_at": "2026-11-02T09:19:58.000Z", "finished_at": "2026-11-02T09:20:09.000Z", "error": null },
  "method": "restricted_key",
  "key_prefix": "rk_test_",
  "key_last4": "x9Qa",
  "key_added_at": "2026-11-02T09:20:00.000Z",
  "key_added_by": "mem_6543a1b2c3d4e5f6a7b8c9d1",
  "key_rotated_at": null,
  "stripe_account_id": "acct_1QabcDEF",
  "account_id_verified": true,
  "account_id_verified_at": "2026-11-02T09:20:04.000Z",
  "publishable_key": "pk_test_51Qabc…",
  "publishable_key_verified_at": "2026-11-02T09:21:30.000Z",
  "api_version": "2024-06-20",
  "account": {
    "country": "US", "default_currency": "usd", "display_name": "Acme (test)", "charges_enabled": true, "payouts_enabled": true,
    "ach_capability": "active", "card_capability": "active", "payout_interval": "manual", "payout_delay_days": 2, "fetched_at": "2026-11-05T12:00:00.000Z"
  },
  "payout_protection": {
    "state": "manual_payouts", "interval": "manual", "checked_at": "2026-11-05T12:00:00.000Z", "attestation": null, "lost_at": null
  },
  "connect_platform": { "ready": true, "checked_at": "2026-11-02T09:20:07.000Z", "error_code": null },
  "probe": {
    "ran_at": "2026-11-02T09:20:05.000Z",
    "results": [ { "permission": "transfer_write", "check": "POST /v1/transfers/tr_holdynprobe", "status": "ok", "error_code": null } ],
    "missing_by_flow": { "hold_and_transfer": [], "charge_on_release": [] },
    "ach_partial_refund_check": { "ran_at": "2026-11-02T09:20:08.000Z", "outcome": "supported", "refund_id": "re_1Qprobe" }
  },
  "fund_flows": {
    "hold_and_transfer": { "available": true, "reasons": [], "label_key": "rail.hold.prevents", "party_label_key": "rail.hold.party" },
    "charge_on_release": { "available": true, "reasons": [], "label_key": "rail.cor.notHeld", "party_label_key": "rail.cor.notHeld" },
    "direct_charge": { "available": false, "reasons": ["not_available_v1"], "label_key": "rail.direct.unavailable", "party_label_key": null }
  },
  "webhooks": {
    "account": { "endpoint_id": "we_1Qabc…", "url": "https://api.holdyn.io/api/v1/b2b/tenant-webhooks/stripe/sconn_6543a1b2c3d4e5f6a7b8ca30/account", "status": "enabled", "last_event_at": "2026-11-05T11:58:00.000Z", "repairs_count": 0, "repair_suspended_reason": null },
    "connect": { "endpoint_id": "we_1Qdef…", "url": "https://api.holdyn.io/api/v1/b2b/tenant-webhooks/stripe/sconn_6543a1b2c3d4e5f6a7b8ca30/connect", "status": "enabled", "last_event_at": "2026-11-04T20:01:00.000Z", "repairs_count": 0, "repair_suspended_reason": null }
  },
  "balance": {
    "checked_at": "2026-11-05T12:00:00.000Z", "available_amount": 1200000, "pending_amount": 0, "held_amount": 900000,
    "required_amount": 900000, "fees_funded_by_tenant_amount": 26100, "shortfall_amount": 0, "status": "ok"
  },
  "ach_partial_refunds": "unknown",
  "warnings": [],
  "disconnected_at": null,
  "disconnected_by": null,
  "disconnect_reason": null,
  "secrets_purge_at": null,
  "created_at": "2026-11-02T09:20:00.000Z",
  "updated_at": "2026-11-05T12:00:00.000Z"
}

RailCapability (DESIGN §6.10)

RailCapability (DESIGN §6.10) (example values)
{
  "object": "rail_capability",
  "rail": "stripe",
  "fund_flow": "hold_and_transfer",
  "available": true,
  "reasons": [],
  "payout_protected": true,
  "rows": [
    { "path": "releases_through_holdyn", "holdyn_can": "prevent", "label_key": "rail.hold.prevents", "party_label_key": "rail.hold.party",
      "text": "Held on Acme's Stripe account. Acme's releases run through Holdyn's checks: a release that fails an agreed condition is blocked.",
      "party_text": "Your payments are held on Acme's Stripe account and paid to the Provider only when the agreed conditions are met." },
    { "path": "actions_directly_in_stripe", "holdyn_can": "detect", "label_key": "rail.hold.detects", "party_label_key": null,
      "text": "Payments or refunds made directly in Acme's Stripe account bypass these checks; they are detected and recorded.", "party_text": null }
  ]
}

Endpoints

GET/connections

Credential
Member session
Permission
connection.read
Mode
both
Pagination
none (`has_more: false`)

Request

include_disconnected boolean (default false; true also lists disconnected and recent failed rows).

Response

200 ListResponse<StripeConnection> (at most one connecting|active|disconnecting connection per mode).

GET/connections/:mode

Credential
Member session
Permission
connection.read
Mode
both

Request

:mode = test or live.

Response

200 StripeConnection (the connecting, active or disconnecting one; else the most recent failed one within 7 days).

Errors

404 resource_missing (none).

GET/connections/checklist

Credential
Member session
Permission
connection.read
Mode
both

Request

mode required (test or live).

Response

200 StripeChecklist : the restricted-key permission table, platform payout protection (manual payouts or an attested minimum balance; held is not locked otherwise), the fees float, ACH enablement, "do not tag as an agent key", the 180-day limited-access rule, on_behalf_of capability needs, a second approver-capable member.

POST/connections

Credential
Member session
Permission
connection.manage
Mode
both
Step-up
live (mode: live)

Request

mode string required (test, live); secret_key string required (^(rk|sk)_(test|live)_[A-Za-z0-9]{10,}$); publishable_key string required (^pk_(test|live)_); account_id string required (^acct_[A-Za-z0-9]+$). All three must match mode. force_account_change boolean optional (owner only, recorded: proceed although non-terminal mandates were sent on another acct_; those mandates stay blocked).

Response

202 {"object": "connection_result", "connection": StripeConnection (status connecting, connect_job running), "publishable_key_check": null}. A retry while the row is connecting returns the same row (unique slot per tenant+mode). When connect_job finishes with status: active, the dashboard calls POST /connections/:mode/publishable-key-check, runs stripe.retrieveSetupIntent(client_secret) with the pasted pk_ and, on success, POST /connections/:mode/verify-publishable-key.

Errors

400 key_mode_mismatch (param); 403 live_not_enabled (tenant pending), insufficient_permission (force_account_change by a non-owner); 409 connection_exists (an active row, or disconnecting on another acct_ without force_account_change), connection_account_changed (+ open_mandates, account_id); 503 b2b_secrets_unconfigured, b2b_public_url_unconfigured. Background failures (status: failed, connect_job.error.code): stripe_key_invalid, account_mismatch, stripe_account_in_use, stripe_webhook_limit, missing_permission, stripe_unavailable.

Record and events

connection.connected (mode, acct_, accountIdVerified, key prefix + last4, probe summary, fund-flow availability, payout protection) or connection.connect_failed, connection.probe_completed, connection.webhooks_created, connection.account_change_forced (when forced), connection.ach_partial_refund_checked (test) · Events: connection.health_changed (on finish).

Notes

flow (validate shapes → account-change guard → insert the row connecting → background: probe → GET /v1/account proves the acct_ (only a PROVEN id can answer stripe_account_in_use) and reads the payout schedule → delete our stale endpoints → create both webhook endpoints with the TENANT key, api_version: 2024-06-20 → encrypt key + both secrets → active). POST /connections on the same acct_ while that connection is disconnecting reactivates the row. sk_ keys are accepted with warnings: ["secret_key_used"]. Test connections also run the Connect-readiness and ACH partial-refund checks.

PATCH/connections/:mode

Credential
Member session
Permission
connection.manage
Mode
both
Step-up
live (:mode live)
Idempotency
honoured

Request

publishable_key string required (^pk_(test|live)_, matching :mode).

Response

200 ConnectionResult (publishable_key_verified_at reset to null; a fresh publishable_key_check to run in the browser).

Errors

400 key_mode_mismatch; 404 (no active connection).

Record and events

connection.key_rotated (data.keyType: "publishable", old/new key suffixes) · Notes: the secret key and the acct_ cannot change here (rotate-key; a different account means disconnect and connect). Portal payment setup is blocked until re-verified.

POST/connections/:mode/publishable-key-check

Credential
Member session
Permission
connection.manage
Mode
both
Idempotency
honoured

Response

200 {"object": "publishable_key_check", "setup_intent_id": "seti_…", "client_secret": "…", "publishable_key": "pk_…"} (a fresh probe SetupIntent with metadata.holdyn_probe=true; the previous one is cancelled).

Errors

404 (no active connection); money-route errors.

POST/connections/:mode/verify-publishable-key

Credential
Member session
Permission
connection.manage
Mode
both
Idempotency
honoured

Request

setup_intent_id string required (the probe SetupIntent the dashboard retrieved with the pk_).

Response

200 StripeConnection (publishable_key_verified_at set; the probe SetupIntent is cancelled).

Errors

400 parameter_invalid (not the current probe SetupIntent).

Record and events

connection.publishable_key_verified · Notes: until verified, portal payment setup answers 409 publishable_key_unverified.

POST/connections/:mode/probe

Credential
Member session
Permission
connection.manage
Mode
both
Idempotency
honoured

Response

202 StripeConnection (connect_job.kind: "probe"; probe, fund flows, payout protection and health refresh in the background).

Errors

404 (no active connection); 409 invalid_state_transition (a job is already running: poll it).

Record and events

connection.probe_completed (+ connection.health_changed when health changes) · Events: connection.health_changed (when changed).

POST/connections/:mode/rotate-key

Credential
Member session
Permission
connection.manage
Mode
both
Step-up
live (:mode live)
Idempotency
honoured (HMAC of the key)

Request

secret_key string required (same mode, same acct_); reason string required (10–500).

Response

202 StripeConnection (connect_job.kind: "rotate_key"). The OLD key stays in use until the new one is probed and proves the same acct_; then an atomic swap evicts the cached client. A failed rotation (connect_job.error.code: stripe_key_invalid, account_mismatch, missing_permission) leaves the connection unchanged.

Errors

400 key_mode_mismatch; 409 invalid_state_transition (a job is already running); 503 b2b_secrets_unconfigured.

Record and events

connection.key_rotated (old and new last4; never key material) on success.

POST/connections/:mode/payout-protection

Credential
Member session
Permission
connection.attest_payout_protection (owner only)
Mode
both
Step-up
live (:mode live)
Idempotency
honoured

Request

state string required (minimum_balance · clear); with minimum_balance: minimum_amount integer required (> 0, minor units: the minimum balance the owner set in Stripe) and note string required (10–1000: where and when it was set).

Response

200 StripeConnection (payout_protection recomputed: minimum_balance_attested while payouts are automatic and an attestation exists; manual_payouts when Stripe reports manual payouts whatever the attestation).

Errors

400 parameter_invalid; 403 insufficient_permission; 404 (no active connection).

Record and events

connection.payout_protection_attested (amount, owner) · connection.payout_protection_lost (when clearing leaves no protection) · Events: connection.payout_protection_lost / connection.payout_protection_restored. - Notes : in live, hold_and_transfer needs payout protection; the monitor warns while balance.required_amount exceeds the attested minimum (attested_minimum_below_required), and losing protection flips the mandates' labels to the not-locked family with a mandatory notice to both parties (where_money_is_held_changed).

POST/connections/:mode/rotate-webhook-secrets

Credential
Member session
Permission
connection.manage
Mode
both
Step-up
live
Idempotency
honoured

Request

reason string optional (≤ 500).

Response

200 StripeConnection (new endpoints created; old secrets accepted 24 h; old endpoints deleted by b2b-housekeeping).

Errors

409 stripe_webhook_limit (+ free_slots). · Records: connection.webhook_secrets_rotated.

DELETE/connections/:mode

Credential
Member session
Permission
connection.manage
Mode
both
Step-up
live
Idempotency
honoured

Request

reason string required (10–500); acknowledge_open_mandates boolean optional (only an owner may set it true); acknowledge_return_exposure boolean optional (owner only; on a disconnecting connection: finish now although ACH debits younger than 65 days could still be returned, recorded).

Response

200 StripeConnection with status: disconnecting (money writes stop at once: gate C2 pending, collections skipped, money stays on the tenant's Stripe; endpoints and secrets are KEPT so late ACH failures, disputes and refund results still arrive and are mirrored), or disconnected when called again on a disconnecting connection with acknowledge_return_exposure: true.

Errors

409 connection_has_money_in_flight (+ in_flight; any collection processing, refund processing|pending|waiting_balance, release executing or open processor dispute; no override), connection_has_open_mandates (+ open_mandates) unless acknowledged by an owner; 403 insufficient_permission (non-owner acknowledging).

Record and events

connection.disconnecting, then connection.disconnected (automatic once the last succeeded ACH charge is older than 65 days, or on the owner's acknowledgement) · Events: connection.health_changed.

Notes

after disconnected, our tenant endpoints are deleted (best effort) and the encrypted secrets purged 30 days later (secrets_purge_at). Reconnecting the same acct_ restores open mandates; a different acct_ answers 409 connection_account_changed unless an owner forces it (those mandates stay blocked).

GET/rails/capabilities

Credential
Member session or API key
Permission
tenant.read
API key scope
any
Mode
scoped (availability and payout protection read from this mode's connection)

Request

fund_flow optional (hold_and_transfer, charge_on_release, direct_charge).

Response

200 ListResponse<RailCapability> (one per fund flow, or one when filtered). The only source of rail label text, tenant and party variants.

Stripe connections · Holdyn Business docs