KosmoKrator

payments

PayPal CLI for AI Agents

Use the PayPal CLI from KosmoKrator to call PayPal tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

7 functions 6 read 1 write Bearer token auth

PayPal CLI Setup

PayPal can be configured headlessly with `kosmokrator integrations:configure paypal`.

# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure paypal --set access_token="$PAYPAL_ACCESS_TOKEN" --enable --read allow --write ask --json
kosmokrator integrations:doctor paypal --json
kosmokrator integrations:status --json

Credentials

Authentication type: Bearer token bearer_token. Configure credentials once, then use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

KeyEnv varTypeRequiredLabel
access_token PAYPAL_ACCESS_TOKEN Secret secret yes Access Token
url PAYPAL_URL URL url no API Base URL

Call PayPal Headlessly

Use the generic call form when another coding CLI or script needs a stable universal interface.

kosmo integrations:call paypal.paypal_list_orders '{
  "page_size": 1,
  "start_id": "example_start_id",
  "start_time": "example_start_time",
  "end_time": "example_end_time",
  "status": "example_status"
}' --json

Use the provider shortcut form for shorter human-facing commands.

kosmo integrations:paypal paypal_list_orders '{
  "page_size": 1,
  "start_id": "example_start_id",
  "start_time": "example_start_time",
  "end_time": "example_end_time",
  "status": "example_status"
}' --json

Agent Discovery Commands

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

kosmo integrations:docs paypal --json
kosmo integrations:docs paypal.paypal_list_orders --json
kosmo integrations:schema paypal.paypal_list_orders --json
kosmo integrations:search "PayPal" --json
kosmo integrations:list --json

All CLI Functions

Every function below can be called headlessly. The generic form is stable across all integrations; the provider shortcut is shorter but specific to PayPal.

paypal.paypal_list_orders

Read read

List PayPal checkout orders. Returns order IDs, statuses, and amounts. Use filters to narrow results by status or date range.

Parameters
page_size, start_id, start_time, end_time, status

Generic CLI call

kosmo integrations:call paypal.paypal_list_orders '{"page_size":1,"start_id":"example_start_id","start_time":"example_start_time","end_time":"example_end_time","status":"example_status"}' --json

Provider shortcut

kosmo integrations:paypal paypal_list_orders '{"page_size":1,"start_id":"example_start_id","start_time":"example_start_time","end_time":"example_end_time","status":"example_status"}' --json

paypal.paypal_get_order

Read read

Get details of a specific PayPal checkout order by its order ID. Returns full order information including status, payer details, and line items.

Parameters
order_id

Generic CLI call

kosmo integrations:call paypal.paypal_get_order '{"order_id":"example_order_id"}' --json

Provider shortcut

kosmo integrations:paypal paypal_get_order '{"order_id":"example_order_id"}' --json

paypal.paypal_create_order

Write write

Create a new PayPal checkout order. Specify the intent, purchase units with amounts, and optional payer details. Returns the created order with approval links.

Parameters
intent, purchase_units, payer, payment_source

Generic CLI call

kosmo integrations:call paypal.paypal_create_order '{"intent":"example_intent","purchase_units":"example_purchase_units","payer":"example_payer","payment_source":"example_payment_source"}' --json

Provider shortcut

kosmo integrations:paypal paypal_create_order '{"intent":"example_intent","purchase_units":"example_purchase_units","payer":"example_payer","payment_source":"example_payment_source"}' --json

paypal.paypal_list_payments

Read read

List PayPal payments. Returns payment IDs, states, amounts, and transaction details. Use filters to narrow results by count or date range.

Parameters
count, start_id, start_time, end_time, sort_by, sort_order

Generic CLI call

kosmo integrations:call paypal.paypal_list_payments '{"count":1,"start_id":"example_start_id","start_time":"example_start_time","end_time":"example_end_time","sort_by":"example_sort_by","sort_order":"example_sort_order"}' --json

Provider shortcut

kosmo integrations:paypal paypal_list_payments '{"count":1,"start_id":"example_start_id","start_time":"example_start_time","end_time":"example_end_time","sort_by":"example_sort_by","sort_order":"example_sort_order"}' --json

paypal.paypal_get_payment

Read read

Get details of a specific PayPal payment by its payment ID. Returns full payment information including state, amount, payer details, and transactions.

Parameters
payment_id

Generic CLI call

kosmo integrations:call paypal.paypal_get_payment '{"payment_id":"example_payment_id"}' --json

Provider shortcut

kosmo integrations:paypal paypal_get_payment '{"payment_id":"example_payment_id"}' --json

paypal.paypal_list_invoices

Read read

List PayPal invoices. Returns invoice IDs, numbers, statuses, amounts, and recipient details. Use pagination parameters to navigate through results.

Parameters
page, page_size, total_required, fields

Generic CLI call

kosmo integrations:call paypal.paypal_list_invoices '{"page":1,"page_size":1,"total_required":true,"fields":"example_fields"}' --json

Provider shortcut

kosmo integrations:paypal paypal_list_invoices '{"page":1,"page_size":1,"total_required":true,"fields":"example_fields"}' --json

paypal.paypal_get_current_user

Read read

Get the authenticated PayPal user's profile information. Returns the user's name, email, and other account details.

Parameters
schema

Generic CLI call

kosmo integrations:call paypal.paypal_get_current_user '{"schema":"example_schema"}' --json

Provider shortcut

kosmo integrations:paypal paypal_get_current_user '{"schema":"example_schema"}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

paypal.paypal_list_orders

List PayPal checkout orders. Returns order IDs, statuses, and amounts. Use filters to narrow results by status or date range.

Operation
Read read
Schema command
kosmo integrations:schema paypal.paypal_list_orders --json
ParameterTypeRequiredDescription
page_size integer no Number of orders to return per page (default: 20, max: 100).
start_id string no The ID of the first order to return. Used for pagination.
start_time string no Start time for filtering (ISO 8601, e.g., "2025-01-01T00:00:00Z").
end_time string no End time for filtering (ISO 8601, e.g., "2025-12-31T23:59:59Z").
status string no Filter by order status: CREATED, SAVED, APPROVED, VOIDED, COMPLETED, PAYER_ACTION_REQUIRED.

paypal.paypal_get_order

Get details of a specific PayPal checkout order by its order ID. Returns full order information including status, payer details, and line items.

Operation
Read read
Schema command
kosmo integrations:schema paypal.paypal_get_order --json
ParameterTypeRequiredDescription
order_id string yes The PayPal order ID (e.g., "5O190127TN364715T").

paypal.paypal_create_order

Create a new PayPal checkout order. Specify the intent, purchase units with amounts, and optional payer details. Returns the created order with approval links.

Operation
Write write
Schema command
kosmo integrations:schema paypal.paypal_create_order --json
ParameterTypeRequiredDescription
intent string yes The order intent: "CAPTURE" to capture funds immediately, or "AUTHORIZE" to authorize and capture later.
purchase_units array yes Array of purchase units. Each unit must have an "amount" object with "currency_code" and "value". May include "description", "items", and "shipping".
payer array no Payer information: name, email_address, address, phone.
payment_source array no Payment source configuration (e.g., paypal, card).

paypal.paypal_list_payments

List PayPal payments. Returns payment IDs, states, amounts, and transaction details. Use filters to narrow results by count or date range.

Operation
Read read
Schema command
kosmo integrations:schema paypal.paypal_list_payments --json
ParameterTypeRequiredDescription
count integer no Number of payments to return (default: 10, max: 20).
start_id string no The ID of the first payment to return. Used for pagination.
start_time string no Start time for filtering (ISO 8601, e.g., "2025-01-01T00:00:00Z").
end_time string no End time for filtering (ISO 8601, e.g., "2025-12-31T23:59:59Z").
sort_by string no Sort field: "create_time" or "update_time".
sort_order string no Sort direction: "asc" or "desc".

paypal.paypal_get_payment

Get details of a specific PayPal payment by its payment ID. Returns full payment information including state, amount, payer details, and transactions.

Operation
Read read
Schema command
kosmo integrations:schema paypal.paypal_get_payment --json
ParameterTypeRequiredDescription
payment_id string yes The PayPal payment ID (e.g., "PAY-1AB23456CD789012EFGHIJKL").

paypal.paypal_list_invoices

List PayPal invoices. Returns invoice IDs, numbers, statuses, amounts, and recipient details. Use pagination parameters to navigate through results.

Operation
Read read
Schema command
kosmo integrations:schema paypal.paypal_list_invoices --json
ParameterTypeRequiredDescription
page integer no Page number for pagination (default: 1).
page_size integer no Number of invoices per page (default: 20, max: 100).
total_required boolean no Whether to include the total count of invoices in the response (default: false).
fields string no Comma-separated list of fields to return (e.g., "items,payments").

paypal.paypal_get_current_user

Get the authenticated PayPal user's profile information. Returns the user's name, email, and other account details.

Operation
Read read
Schema command
kosmo integrations:schema paypal.paypal_get_current_user --json
ParameterTypeRequiredDescription
schema string no Schema to return: "paypalv1.1" or "openid". Default: "paypalv1.1".

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.