KosmoKrator

data

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.

PayPal CLI Setup

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

Install, configure, and verify
# 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 reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.

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

Command Patterns

The generic command is stable across every integration. The provider shortcut is shorter for humans.

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

Discovery

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

Discovery commands
kosmo integrations:docs paypal --json
kosmo integrations:docs paypal.paypal_get_order --json
kosmo integrations:schema paypal.paypal_get_order --json
kosmo integrations:search "PayPal" --json
kosmo integrations:list --json

Automation Contexts

The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.

CLI Functions

Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.

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.

Read read
Parameters
order_id
Generic call
kosmo integrations:call paypal.paypal_get_order '{"order_id":"example_order_id"}' --json
Shortcut
kosmo integrations:paypal paypal_get_order '{"order_id":"example_order_id"}' --json

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.

Write write
Parameters
intent, purchase_units, payer, payment_source
Generic 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
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_capture_order

Capture a previously approved PayPal checkout order by order ID. Use after the payer approves an order created with intent CAPTURE.

Write write
Parameters
order_id, payment_source
Generic call
kosmo integrations:call paypal.paypal_capture_order '{"order_id":"example_order_id","payment_source":"example_payment_source"}' --json
Shortcut
kosmo integrations:paypal paypal_capture_order '{"order_id":"example_order_id","payment_source":"example_payment_source"}' --json

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.

Read read
Parameters
count, start_id, start_time, end_time, sort_by, sort_order
Generic 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
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

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

Read read
Parameters
payment_id
Generic call
kosmo integrations:call paypal.paypal_get_payment '{"payment_id":"example_payment_id"}' --json
Shortcut
kosmo integrations:paypal paypal_get_payment '{"payment_id":"example_payment_id"}' --json

paypal.paypal_list_invoices

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

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

paypal.paypal_get_current_user

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

Read read
Parameters
schema
Generic call
kosmo integrations:call paypal.paypal_get_current_user '{"schema":"example_schema"}' --json
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_get_order 1 parameters
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 4 parameters
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_capture_order 2 parameters
Schema command
kosmo integrations:schema paypal.paypal_capture_order --json
ParameterTypeRequiredDescription
order_id string yes The approved PayPal checkout order ID.
payment_source array no Optional payment source data to include in the capture request.
paypal.paypal_list_payments 6 parameters
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 1 parameters
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 4 parameters
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 1 parameters
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.