KosmoKrator

data

Chargify Lua API for KosmoKrator Agents

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

Lua Namespace

Agents call this integration through app.integrations.chargify.*. Use lua_read_doc("integrations.chargify") 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 Chargify workflow without starting an interactive agent session.

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.chargify.list_subscriptions({page = 1, per_page = 1, state = "example_state"}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("chargify"))' --json
kosmo integrations:lua --eval 'print(docs.read("chargify.list_subscriptions"))' --json

Workflow file

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

workflow.lua
local chargify = app.integrations.chargify
local result = chargify.list_subscriptions({page = 1, per_page = 1, state = "example_state"})

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.chargify, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.chargify.default.* or app.integrations.chargify.work.* when you configured named credential accounts.

MCP-only Lua

If the script only needs configured MCP servers and does not need Chargify, 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.

Chargify / Maxio Advanced Billing

Chargify is now Maxio Advanced Billing. These tools call the Advanced Billing REST API for subscription billing, customers, products, invoices, and site metadata.

Namespace

chargify

Authentication

The API uses HTTP Basic Auth. Configure:

  • api_key - API key used as the Basic Auth username.
  • api_password - Basic Auth password. Most legacy API-key credentials use x; leave this unset unless your site has a specific password.
  • subdomain or url - either the site subdomain for https://{subdomain}.chargify.com, or a full custom base URL.

Available Tools

  • chargify_list_subscriptions - List subscriptions with page, per_page, and optional state.
  • chargify_get_subscription - Get a subscription by subscription_id.
  • chargify_list_customers - List customers with pagination.
  • chargify_get_customer - Get a customer by customer_id.
  • chargify_list_products - List products with pagination.
  • chargify_list_invoices - List invoices with optional status.
  • chargify_get_invoice - Get one invoice by UID, number, or ID.
  • chargify_get_current_user - Reads /site.json as a lightweight authenticated site check. Advanced Billing does not rely on an agent-facing /users/me endpoint for this package.

Examples

local subscriptions = chargify.chargify_list_subscriptions({
  page = 1,
  per_page = 50,
  state = "active"
})
local invoice = chargify.chargify_get_invoice({
  invoice_id = "inv_123"
})
local site = chargify.chargify_get_current_user({})

Responses are returned in the upstream Advanced Billing JSON shape, usually wrapping records under keys such as subscription, customer, product, invoice, or site.

Raw agent markdown
# Chargify / Maxio Advanced Billing

Chargify is now Maxio Advanced Billing. These tools call the Advanced Billing
REST API for subscription billing, customers, products, invoices, and site
metadata.

## Namespace

`chargify`

## Authentication

The API uses HTTP Basic Auth. Configure:

- `api_key` - API key used as the Basic Auth username.
- `api_password` - Basic Auth password. Most legacy API-key credentials use
  `x`; leave this unset unless your site has a specific password.
- `subdomain` or `url` - either the site subdomain for
  `https://{subdomain}.chargify.com`, or a full custom base URL.

## Available Tools

- `chargify_list_subscriptions` - List subscriptions with `page`, `per_page`, and optional `state`.
- `chargify_get_subscription` - Get a subscription by `subscription_id`.
- `chargify_list_customers` - List customers with pagination.
- `chargify_get_customer` - Get a customer by `customer_id`.
- `chargify_list_products` - List products with pagination.
- `chargify_list_invoices` - List invoices with optional `status`.
- `chargify_get_invoice` - Get one invoice by UID, number, or ID.
- `chargify_get_current_user` - Reads `/site.json` as a lightweight authenticated site check. Advanced Billing does not rely on an agent-facing `/users/me` endpoint for this package.

## Examples

```lua
local subscriptions = chargify.chargify_list_subscriptions({
  page = 1,
  per_page = 50,
  state = "active"
})
```

```lua
local invoice = chargify.chargify_get_invoice({
  invoice_id = "inv_123"
})
```

```lua
local site = chargify.chargify_get_current_user({})
```

Responses are returned in the upstream Advanced Billing JSON shape, usually
wrapping records under keys such as `subscription`, `customer`, `product`,
`invoice`, or `site`.
Metadata-derived Lua example
local result = app.integrations.chargify.list_subscriptions({page = 1, per_page = 1, state = "example_state"})
print(result)

Functions

list_subscriptions Read

List subscriptions from Chargify. Supports filtering by state (active, past_due, canceled, expired, trial, etc.) and pagination.

Lua path
app.integrations.chargify.list_subscriptions
Full name
chargify.chargify_list_subscriptions
ParameterTypeRequiredDescription
page integer no Page number for pagination (default: 1).
per_page integer no Number of results per page, max 200 (default: 20).
state string no Filter by subscription state: active, past_due, canceled, expired, trial, on_hold, pending, deferred, etc.
get_subscription Read

Get detailed information for a single Chargify subscription by ID.

Lua path
app.integrations.chargify.get_subscription
Full name
chargify.chargify_get_subscription
ParameterTypeRequiredDescription
subscription_id integer yes The Chargify subscription ID.
list_customers Read

List customers from Chargify. Supports pagination with page and per_page parameters.

Lua path
app.integrations.chargify.list_customers
Full name
chargify.chargify_list_customers
ParameterTypeRequiredDescription
page integer no Page number for pagination (default: 1).
per_page integer no Number of results per page, max 200 (default: 20).
get_customer Read

Get detailed information for a single Chargify customer by ID.

Lua path
app.integrations.chargify.get_customer
Full name
chargify.chargify_get_customer
ParameterTypeRequiredDescription
customer_id integer yes The Chargify customer ID.
list_products Read

List products available in Chargify. Supports pagination with page and per_page parameters.

Lua path
app.integrations.chargify.list_products
Full name
chargify.chargify_list_products
ParameterTypeRequiredDescription
page integer no Page number for pagination (default: 1).
per_page integer no Number of results per page, max 200 (default: 20).
list_invoices Read

List invoices from Chargify. Supports filtering by status (open, paid, pending, voided) and pagination.

Lua path
app.integrations.chargify.list_invoices
Full name
chargify.chargify_list_invoices
ParameterTypeRequiredDescription
page integer no Page number for pagination (default: 1).
per_page integer no Number of results per page, max 200 (default: 20).
status string no Filter by invoice status: open, paid, pending, voided.
get_invoice Read

Get detailed information for a single Chargify / Maxio Advanced Billing invoice by ID, UID, or invoice number.

Lua path
app.integrations.chargify.get_invoice
Full name
chargify.chargify_get_invoice
ParameterTypeRequiredDescription
invoice_id string yes The invoice UID, number, or ID.
get_site Read

Read the current Chargify / Maxio Advanced Billing site. Useful for verifying API credentials.

Lua path
app.integrations.chargify.get_site
Full name
chargify.chargify_get_current_user
ParameterTypeRequiredDescription
No parameters.