KosmoKrator

data

Stripe Connect Lua API for KosmoKrator Agents

Agent-facing Lua documentation and function reference for the Stripe Connect KosmoKrator integration.

Lua Namespace

Agents call this integration through app.integrations.stripe_connect.*. Use lua_read_doc("integrations.stripe-connect") inside KosmoKrator to discover the same reference at runtime.

Call Lua from the Headless CLI

Use kosmo integrations:lua when a shell script, CI job, cron job, or another coding CLI should run a deterministic Stripe Connect workflow without starting an interactive agent session.

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.stripe_connect.list_accounts({limit = 1}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("stripe-connect"))' --json
kosmo integrations:lua --eval 'print(docs.read("stripe-connect.list_accounts"))' --json

Workflow file

Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.

workflow.lua
local stripe_connect = app.integrations.stripe_connect
local result = stripe_connect.list_accounts({limit = 1})

dump(result)
Run the workflow
kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json
Namespace note. integrations:lua exposes app.integrations.stripe_connect, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.stripe_connect.default.* or app.integrations.stripe_connect.work.* when you configured named credential accounts.

MCP-only Lua

If the script only needs configured MCP servers and does not need Stripe Connect, use the narrower mcp:lua command.

MCP Lua command
# Use mcp:lua for MCP-only scripts; use integrations:lua for this integration namespace.
kosmo mcp:lua --eval 'dump(mcp.servers())' --json

Agent-Facing Lua Docs

This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.

Stripe Connect — Lua API Reference

Overview

The Stripe Connect integration provides 7 tools for managing connected accounts, payouts, balance transactions, and capabilities. All calls go through app.integrations["stripe-connect"].<method>({ ... }).

Amounts are always in cents (smallest currency unit). For example, $10.00 → 1000, €25.50 → 2550.

ID prefixes — Stripe objects use recognizable prefixes:

PrefixObject
acct_Connect Account
po_Payout
txn_Balance Transaction

Authentication

Stripe Connect uses a Bearer token (your Stripe API key). Configure it in the integration settings under Access Token. Find yours at Stripe Dashboard → Developers → API keys.

Accounts

app.integrations["stripe-connect"].list_accounts(...)

List Stripe Connect accounts with optional pagination.

local result = app.integrations["stripe-connect"].list_accounts({
    limit = 25,
})
-- Returns: { accounts = { { id = "acct_...", business_type = "company", display_name = "Acme Corp", email = "admin@acme.com", country = "US", created = 1712304000 } }, has_more = false }

app.integrations["stripe-connect"].get_account(...)

Retrieve a Stripe Connect account by ID with full details.

local account = app.integrations["stripe-connect"].get_account({
    id = "acct_1234567890",
})
-- Returns: { id = "acct_...", business_type = "company", display_name = "Acme Corp", email = "admin@acme.com", country = "US", default_currency = "usd", capabilities = { card_payments = "active", transfers = "active" }, charges_enabled = true, payouts_enabled = true, created = 1712304000 }

Payouts

app.integrations["stripe-connect"].list_payouts(...)

List Stripe Connect payouts with optional filtering by status and arrival date.

-- List all payouts
local result = app.integrations["stripe-connect"].list_payouts({
    limit = 25,
})
-- Returns: { payouts = { { id = "po_...", amount = 10000, currency = "usd", status = "paid", arrival_date = 1712304000, method = "standard", created = 1712200000 } }, has_more = false }

-- Filter by status
local result = app.integrations["stripe-connect"].list_payouts({
    status = "paid",
    limit = 10,
})

-- Status values: "paid", "pending", "in_transit", "canceled", "failed"

-- Filter by arrival date (Unix timestamp)
local result = app.integrations["stripe-connect"].list_payouts({
    arrival_date = { gte = 1712304000 },
    limit = 25,
})

app.integrations["stripe-connect"].get_payout(...)

Retrieve a Stripe Connect payout by ID with full details.

local payout = app.integrations["stripe-connect"].get_payout({
    id = "po_1234567890",
})
-- Returns: { id = "po_...", amount = 10000, currency = "usd", status = "paid", arrival_date = 1712304000, method = "standard", destination = "ba_...", failure_code = nil, failure_message = nil, metadata = {}, created = 1712200000 }

Balance Transactions

app.integrations["stripe-connect"].list_balances(...)

List Stripe Connect balance transactions with optional pagination.

local result = app.integrations["stripe-connect"].list_balances({
    limit = 25,
})
-- Returns: { balance_transactions = { { id = "txn_...", type = "charge", amount = 10000, currency = "usd", net = 9710, fee = 290, description = "Payment for order #1234", status = "available", created = 1712304000 } }, has_more = false }

Capabilities

app.integrations["stripe-connect"].list_capabilities(...)

List capabilities for a specific Stripe Connect account.

local result = app.integrations["stripe-connect"].list_capabilities({
    account = "acct_1234567890",
})
-- Returns: { capabilities = { { id = "card_payments", account = "acct_...", status = "active", requested = true } }, has_more = false }

Current User

app.integrations["stripe-connect"].get_current_user(...)

Get the currently authenticated Stripe Connect user.

local user = app.integrations["stripe-connect"].get_current_user({})
-- Returns: { id = "usr_...", name = "John Doe", email = "john@example.com", created = 1712304000 }

Pagination

All list endpoints (list_accounts, list_payouts, list_balances) return a has_more field. Use limit to control page size (1–100, default 10).

Notes

  • All monetary amounts are in cents — the smallest currency unit. $10.00 is 1000, €5.50 is 550.
  • Currency codes are lowercase three-letter ISO 4217 codes: "usd", "eur", "gbp", etc.
  • Error handling — API errors include the HTTP status code and Stripe error message. Common errors: 401 (invalid access token), 403 (insufficient permissions), 404 (object not found), 429 (rate limit exceeded).

Multi-Account Usage

If you have multiple stripe-connect accounts configured, use account-specific namespaces:

-- Default account (always works)
app.integrations["stripe-connect"].function_name({...})

-- Explicit default (portable across setups)
app.integrations["stripe-connect"].default.function_name({...})

-- Named accounts
app.integrations["stripe-connect"].work.function_name({...})
app.integrations["stripe-connect"].personal.function_name({...})

All functions are identical across accounts — only the credentials differ.

Raw agent markdown
# Stripe Connect — Lua API Reference

## Overview

The Stripe Connect integration provides 7 tools for managing connected accounts, payouts, balance transactions, and capabilities. All calls go through `app.integrations["stripe-connect"].<method>({ ... })`.

**Amounts are always in cents** (smallest currency unit). For example, $10.00 → `1000`, €25.50 → `2550`.

**ID prefixes** — Stripe objects use recognizable prefixes:

| Prefix | Object              |
|--------|---------------------|
| `acct_`| Connect Account     |
| `po_`  | Payout              |
| `txn_` | Balance Transaction |

## Authentication

Stripe Connect uses a **Bearer token** (your Stripe API key). Configure it in the integration settings under **Access Token**. Find yours at **Stripe Dashboard → Developers → API keys**.

## Accounts

### `app.integrations["stripe-connect"].list_accounts(...)`

List Stripe Connect accounts with optional pagination.

```lua
local result = app.integrations["stripe-connect"].list_accounts({
    limit = 25,
})
-- Returns: { accounts = { { id = "acct_...", business_type = "company", display_name = "Acme Corp", email = "admin@acme.com", country = "US", created = 1712304000 } }, has_more = false }
```

### `app.integrations["stripe-connect"].get_account(...)`

Retrieve a Stripe Connect account by ID with full details.

```lua
local account = app.integrations["stripe-connect"].get_account({
    id = "acct_1234567890",
})
-- Returns: { id = "acct_...", business_type = "company", display_name = "Acme Corp", email = "admin@acme.com", country = "US", default_currency = "usd", capabilities = { card_payments = "active", transfers = "active" }, charges_enabled = true, payouts_enabled = true, created = 1712304000 }
```

## Payouts

### `app.integrations["stripe-connect"].list_payouts(...)`

List Stripe Connect payouts with optional filtering by status and arrival date.

```lua
-- List all payouts
local result = app.integrations["stripe-connect"].list_payouts({
    limit = 25,
})
-- Returns: { payouts = { { id = "po_...", amount = 10000, currency = "usd", status = "paid", arrival_date = 1712304000, method = "standard", created = 1712200000 } }, has_more = false }

-- Filter by status
local result = app.integrations["stripe-connect"].list_payouts({
    status = "paid",
    limit = 10,
})

-- Status values: "paid", "pending", "in_transit", "canceled", "failed"

-- Filter by arrival date (Unix timestamp)
local result = app.integrations["stripe-connect"].list_payouts({
    arrival_date = { gte = 1712304000 },
    limit = 25,
})
```

### `app.integrations["stripe-connect"].get_payout(...)`

Retrieve a Stripe Connect payout by ID with full details.

```lua
local payout = app.integrations["stripe-connect"].get_payout({
    id = "po_1234567890",
})
-- Returns: { id = "po_...", amount = 10000, currency = "usd", status = "paid", arrival_date = 1712304000, method = "standard", destination = "ba_...", failure_code = nil, failure_message = nil, metadata = {}, created = 1712200000 }
```

## Balance Transactions

### `app.integrations["stripe-connect"].list_balances(...)`

List Stripe Connect balance transactions with optional pagination.

```lua
local result = app.integrations["stripe-connect"].list_balances({
    limit = 25,
})
-- Returns: { balance_transactions = { { id = "txn_...", type = "charge", amount = 10000, currency = "usd", net = 9710, fee = 290, description = "Payment for order #1234", status = "available", created = 1712304000 } }, has_more = false }
```

## Capabilities

### `app.integrations["stripe-connect"].list_capabilities(...)`

List capabilities for a specific Stripe Connect account.

```lua
local result = app.integrations["stripe-connect"].list_capabilities({
    account = "acct_1234567890",
})
-- Returns: { capabilities = { { id = "card_payments", account = "acct_...", status = "active", requested = true } }, has_more = false }
```

## Current User

### `app.integrations["stripe-connect"].get_current_user(...)`

Get the currently authenticated Stripe Connect user.

```lua
local user = app.integrations["stripe-connect"].get_current_user({})
-- Returns: { id = "usr_...", name = "John Doe", email = "john@example.com", created = 1712304000 }
```

## Pagination

All list endpoints (`list_accounts`, `list_payouts`, `list_balances`) return a `has_more` field. Use `limit` to control page size (1–100, default 10).

## Notes

- **All monetary amounts are in cents** — the smallest currency unit. `$10.00` is `1000`, `€5.50` is `550`.
- **Currency codes** are lowercase three-letter ISO 4217 codes: `"usd"`, `"eur"`, `"gbp"`, etc.
- **Error handling** — API errors include the HTTP status code and Stripe error message. Common errors: `401` (invalid access token), `403` (insufficient permissions), `404` (object not found), `429` (rate limit exceeded).

---

## Multi-Account Usage

If you have multiple stripe-connect accounts configured, use account-specific namespaces:

```lua
-- Default account (always works)
app.integrations["stripe-connect"].function_name({...})

-- Explicit default (portable across setups)
app.integrations["stripe-connect"].default.function_name({...})

-- Named accounts
app.integrations["stripe-connect"].work.function_name({...})
app.integrations["stripe-connect"].personal.function_name({...})
```

All functions are identical across accounts — only the credentials differ.
Metadata-derived Lua example
local result = app.integrations.stripe_connect.list_accounts({limit = 1})
print(result)

Functions

list_accounts Read

List Stripe Connect accounts. Returns a paginated list of connected accounts with ID, business type, display name, and email.

Lua path
app.integrations.stripe_connect.list_accounts
Full name
stripe-connect.stripe_connect_list_accounts
ParameterTypeRequiredDescription
limit integer no Number of accounts to return (1–100, default 10).
get_account Read

Retrieve a Stripe Connect account by ID. Returns full account details including business profile, capabilities, and metadata.

Lua path
app.integrations.stripe_connect.get_account
Full name
stripe-connect.stripe_connect_get_account
ParameterTypeRequiredDescription
id string yes Stripe Connect account ID (e.g., "acct_...").
list_payouts Read

List Stripe Connect payouts with optional filtering. Supports filtering by status (paid, pending, in_transit, canceled, failed) and arrival date, and pagination with limit.

Lua path
app.integrations.stripe_connect.list_payouts
Full name
stripe-connect.stripe_connect_list_payouts
ParameterTypeRequiredDescription
limit integer no Number of payouts to return (1–100, default 10).
status string no Filter by payout status: paid, pending, in_transit, canceled, or failed.
arrival_date string no Filter by arrival date. A Unix timestamp (e.g., 1712304000), or a hash with "gt", "gte", "lt", "lte" keys.
get_payout Read

Retrieve a Stripe Connect payout by ID. Returns full payout details including amount, status, arrival date, and destination.

Lua path
app.integrations.stripe_connect.get_payout
Full name
stripe-connect.stripe_connect_get_payout
ParameterTypeRequiredDescription
id string yes Stripe payout ID (e.g., "po_...").
list_balances Read

List Stripe Connect balance transactions. Returns a paginated list of balance transactions with type, amount, currency, and description.

Lua path
app.integrations.stripe_connect.list_balances
Full name
stripe-connect.stripe_connect_list_balances
ParameterTypeRequiredDescription
limit integer no Number of balance transactions to return (1–100, default 10).
list_capabilities Read

List Stripe Connect account capabilities. Returns capabilities for a specified connected account, including activation status (active, inactive, pending).

Lua path
app.integrations.stripe_connect.list_capabilities
Full name
stripe-connect.stripe_connect_list_capabilities
ParameterTypeRequiredDescription
account string yes Stripe Connect account ID (e.g., "acct_...").
get_current_user Read

Get the currently authenticated Stripe Connect user. Returns user profile information including ID, name, and email.

Lua path
app.integrations.stripe_connect.get_current_user
Full name
stripe-connect.stripe_connect_get_current_user
ParameterTypeRequiredDescription
No parameters.