# Payments tools

[All tool areas](/docs/tools.md). Each tool acts within your access.

## Payments

### create_payment_account

Create a payment provider account for an entity whose operator has none (Stripe: a connected account in the entity's country and currency, with the operator's own full Stripe Dashboard; they pay Stripe's fees and handle disputes there). It starts pending: then get the onboarding link with get_payment_account_link and send it to the operator to give their business and bank details. For an operator who already has a Stripe account, link it with get_payment_account_link instead. Returns a preview to confirm; can't be undone.

Changes · Members of an organization · Needs payments:write

#### Input

- `entityId` — string; required. The entity's id, from get_setup
- `provider` — string; optional.  Allowed: "stripe"; default: "stripe"
- `country` — string; optional. ISO 3166-1 alpha-2; defaults to the entity's address, or its currency's country pattern: "^\[A-Za-z\]\{2\}$"
- `email` — string; optional. The operator's contact for the provider; asked in onboarding otherwise format: "email"

#### Output

- `paymentAccountId` — string; required. 
- `entityId` — string; required. 
- `provider` — string; required. 
- `externalAccountId` — string; required. 
- `status` — string; required.  Allowed: "pending", "active", "restricted", "disconnected"

### get_payment_account_link

Get the link an operator opens to set up an entity's payment provider account. For an account Lokl created (create_payment_account), it's the provider's onboarding, where the operator gives their business and bank details; each link works once and lasts a few minutes, so ask for a new one whenever it's needed, including to fix details Stripe asks for later. Otherwise it links the operator's existing account (Stripe: they sign in and approve Lokl; open it within 30 minutes). Only the person who asked for the link can finish it, in the browser they opened it in: after approving, they land on Lokl's dashboard, signed in there as themselves, see which account it is, and press Connect. Never send the link to someone else to open; a finish by anyone else, or from another browser, uses the link up. Linking again replaces the entity's account with that provider. list_payment_accounts shows the status afterwards.

Reads · Members of an organization · Needs payments:write

#### Input

- `entityId` — string; required. The entity's id, from get_setup
- `provider` — string; optional.  Allowed: "stripe"; default: "stripe"

#### Output

- `kind` — string; required. connect: links an existing account; onboarding: finishes setting up one Lokl created Allowed: "connect", "onboarding"
- `url` — string; required.  format: "uri"
- `expiresAt` — string; required.  format: "date-time"

### list_payment_accounts

List the payment provider accounts linked to the organization's entities, with their status: pending (onboarding not finished), active (can take payments), restricted (the provider is holding it back: missing details or under review), or disconnected (unlinked by the operator; link it again).

Reads · Members of an organization · Needs setup:read

No input.

#### Output

- `paymentAccounts` — array; required. 
  - `paymentAccounts[]` — object; optional. 
    - `paymentAccounts[].id` — string; required. 
    - `paymentAccounts[].entityId` — string; required. 
    - `paymentAccounts[].entityName` — string; required. 
    - `paymentAccounts[].provider` — string; required. 
    - `paymentAccounts[].externalAccountId` — string; required. 
    - `paymentAccounts[].status` — string; required.  Allowed: "pending", "active", "restricted", "disconnected"
    - `paymentAccounts[].origin` — string; required. linked: the operator's own account; created: Lokl created it, and the operator finishes onboarding through get_payment_account_link Allowed: "linked", "created"
    - `paymentAccounts[].linkedAt` — string; required.  format: "date-time"
    - `paymentAccounts[].walletDomains` — object; optional. Whether the booking site's domain is registered for Apple Pay and Google Pay on the account. failed or unknown (from before this was recorded): register_wallet_domains tries again; card payments work either way
      - `paymentAccounts[].walletDomains.status` — string; required.  Allowed: "pending", "registered", "failed", "unknown"
      - `paymentAccounts[].walletDomains.error` — string or null; required. 
