KosmoKrator

data

Razorpay Lua API for KosmoKrator Agents

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

Lua Namespace

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

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.razorpay.list_payments({count = 1, skip = 1, from = 1, to = 1}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("razorpay"))' --json
kosmo integrations:lua --eval 'print(docs.read("razorpay.list_payments"))' --json

Workflow file

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

workflow.lua
local razorpay = app.integrations.razorpay
local result = razorpay.list_payments({count = 1, skip = 1, from = 1, to = 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.razorpay, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.razorpay.default.* or app.integrations.razorpay.work.* when you configured named credential accounts.

MCP-only Lua

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

Razorpay — Lua API Reference

list_payments

List payments from Razorpay. Supports pagination and date-range filters.

Parameters

NameTypeRequiredDescription
countintegernoNumber of payments to return (default: 10, max: 100)
skipintegernoNumber of payments to skip for pagination
fromintegernoUnix timestamp for the start of the date range
tointegernoUnix timestamp for the end of the date range

Examples

-- List recent payments
local result = app.integrations.razorpay.list_payments({
  count = 10
})

for _, payment in ipairs(result.items) do
  print(payment.id .. ": " .. payment.amount .. " " .. payment.currency .. " (" .. payment.status .. ")")
end
-- List payments from a specific date range
local result = app.integrations.razorpay.list_payments({
  count = 20,
  from = 1704067200,  -- 2024-01-01
  to = 1706745600     -- 2024-02-01
})

get_payment

Get details of a specific Razorpay payment by its ID.

Parameters

NameTypeRequiredDescription
payment_idstringyesThe Razorpay payment ID (e.g., “pay_1234567890”)

Examples

local result = app.integrations.razorpay.get_payment({
  payment_id = "pay_1234567890"
})

print("Amount: " .. result.amount .. " " .. result.currency)
print("Status: " .. result.status)
print("Method: " .. result.method)

list_orders

List orders from Razorpay. Supports pagination and date-range filters.

Parameters

NameTypeRequiredDescription
countintegernoNumber of orders to return (default: 10, max: 100)
skipintegernoNumber of orders to skip for pagination
fromintegernoUnix timestamp for the start of the date range
tointegernoUnix timestamp for the end of the date range

Examples

local result = app.integrations.razorpay.list_orders({
  count = 20,
  skip = 0
})

for _, order in ipairs(result.items) do
  print(order.id .. ": " .. order.amount .. " " .. order.currency .. " (" .. order.status .. ")")
end

get_order

Get details of a specific Razorpay order by its ID.

Parameters

NameTypeRequiredDescription
order_idstringyesThe Razorpay order ID (e.g., “order_1234567890”)

Examples

local result = app.integrations.razorpay.get_order({
  order_id = "order_1234567890"
})

print("Amount: " .. result.amount .. " " .. result.currency)
print("Status: " .. result.status)
print("Receipt: " .. (result.receipt or "N/A"))

create_order

Create a new payment order in Razorpay.

Parameters

NameTypeRequiredDescription
amountintegeryesAmount in smallest currency unit (e.g., 10000 for ₹100.00 in INR)
currencystringnoThree-letter currency code (default: “INR”)
receiptstringnoYour internal receipt identifier (max 40 characters)
notesobjectnoKey-value notes to attach to the order

Examples

-- Create an order for ₹500.00
local result = app.integrations.razorpay.create_order({
  amount = 50000,
  currency = "INR",
  receipt = "rcpt_001",
  notes = {
    customer_name = "John Doe",
    purpose = "Subscription"
  }
})

print("Order ID: " .. result.id)
print("Status: " .. result.status)
-- Create a simple order
local result = app.integrations.razorpay.create_order({
  amount = 100000  -- ₹1000.00
})

list_refunds

List refunds from Razorpay. Supports pagination and date-range filters.

Parameters

NameTypeRequiredDescription
countintegernoNumber of refunds to return (default: 10, max: 100)
skipintegernoNumber of refunds to skip for pagination
fromintegernoUnix timestamp for the start of the date range
tointegernoUnix timestamp for the end of the date range

Examples

local result = app.integrations.razorpay.list_refunds({
  count = 20
})

for _, refund in ipairs(result.items) do
  print(refund.id .. ": " .. refund.amount .. " (" .. refund.status .. ")")
end

list_customers

List customers from Razorpay. Supports pagination.

Parameters

NameTypeRequiredDescription
countintegernoNumber of customers to return (default: 10, max: 100)
skipintegernoNumber of customers to skip for pagination

Examples

local result = app.integrations.razorpay.list_customers({
  count = 20
})

for _, customer in ipairs(result.items) do
  print(customer.id .. ": " .. (customer.name or "N/A") .. " <" .. (customer.email or "N/A") .. ">")
end

get_current_user

Verify the Razorpay API connection with a lightweight payments request. Razorpay does not expose a general current-user endpoint in the payments API, so this returns the same collection shape as list_payments with count = 1.

Parameters

None.

Examples

local result = app.integrations.razorpay.get_current_user({})

print("Connected; sample count: " .. tostring(result.count))

Multi-Account Usage

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

-- Default account (always works)
app.integrations.razorpay.list_payments({count = 10})

-- Explicit default (portable across setups)
app.integrations.razorpay.default.list_payments({count = 10})

-- Named accounts
app.integrations.razorpay.production.list_payments({count = 10})
app.integrations.razorpay.staging.list_payments({count = 10})

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

Raw agent markdown
# Razorpay — Lua API Reference

## list_payments

List payments from Razorpay. Supports pagination and date-range filters.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `count` | integer | no | Number of payments to return (default: 10, max: 100) |
| `skip` | integer | no | Number of payments to skip for pagination |
| `from` | integer | no | Unix timestamp for the start of the date range |
| `to` | integer | no | Unix timestamp for the end of the date range |

### Examples

```lua
-- List recent payments
local result = app.integrations.razorpay.list_payments({
  count = 10
})

for _, payment in ipairs(result.items) do
  print(payment.id .. ": " .. payment.amount .. " " .. payment.currency .. " (" .. payment.status .. ")")
end
```

```lua
-- List payments from a specific date range
local result = app.integrations.razorpay.list_payments({
  count = 20,
  from = 1704067200,  -- 2024-01-01
  to = 1706745600     -- 2024-02-01
})
```

---

## get_payment

Get details of a specific Razorpay payment by its ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `payment_id` | string | yes | The Razorpay payment ID (e.g., "pay_1234567890") |

### Examples

```lua
local result = app.integrations.razorpay.get_payment({
  payment_id = "pay_1234567890"
})

print("Amount: " .. result.amount .. " " .. result.currency)
print("Status: " .. result.status)
print("Method: " .. result.method)
```

---

## list_orders

List orders from Razorpay. Supports pagination and date-range filters.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `count` | integer | no | Number of orders to return (default: 10, max: 100) |
| `skip` | integer | no | Number of orders to skip for pagination |
| `from` | integer | no | Unix timestamp for the start of the date range |
| `to` | integer | no | Unix timestamp for the end of the date range |

### Examples

```lua
local result = app.integrations.razorpay.list_orders({
  count = 20,
  skip = 0
})

for _, order in ipairs(result.items) do
  print(order.id .. ": " .. order.amount .. " " .. order.currency .. " (" .. order.status .. ")")
end
```

---

## get_order

Get details of a specific Razorpay order by its ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `order_id` | string | yes | The Razorpay order ID (e.g., "order_1234567890") |

### Examples

```lua
local result = app.integrations.razorpay.get_order({
  order_id = "order_1234567890"
})

print("Amount: " .. result.amount .. " " .. result.currency)
print("Status: " .. result.status)
print("Receipt: " .. (result.receipt or "N/A"))
```

---

## create_order

Create a new payment order in Razorpay.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `amount` | integer | yes | Amount in smallest currency unit (e.g., 10000 for ₹100.00 in INR) |
| `currency` | string | no | Three-letter currency code (default: "INR") |
| `receipt` | string | no | Your internal receipt identifier (max 40 characters) |
| `notes` | object | no | Key-value notes to attach to the order |

### Examples

```lua
-- Create an order for ₹500.00
local result = app.integrations.razorpay.create_order({
  amount = 50000,
  currency = "INR",
  receipt = "rcpt_001",
  notes = {
    customer_name = "John Doe",
    purpose = "Subscription"
  }
})

print("Order ID: " .. result.id)
print("Status: " .. result.status)
```

```lua
-- Create a simple order
local result = app.integrations.razorpay.create_order({
  amount = 100000  -- ₹1000.00
})
```

---

## list_refunds

List refunds from Razorpay. Supports pagination and date-range filters.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `count` | integer | no | Number of refunds to return (default: 10, max: 100) |
| `skip` | integer | no | Number of refunds to skip for pagination |
| `from` | integer | no | Unix timestamp for the start of the date range |
| `to` | integer | no | Unix timestamp for the end of the date range |

### Examples

```lua
local result = app.integrations.razorpay.list_refunds({
  count = 20
})

for _, refund in ipairs(result.items) do
  print(refund.id .. ": " .. refund.amount .. " (" .. refund.status .. ")")
end
```

---

## list_customers

List customers from Razorpay. Supports pagination.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `count` | integer | no | Number of customers to return (default: 10, max: 100) |
| `skip` | integer | no | Number of customers to skip for pagination |

### Examples

```lua
local result = app.integrations.razorpay.list_customers({
  count = 20
})

for _, customer in ipairs(result.items) do
  print(customer.id .. ": " .. (customer.name or "N/A") .. " <" .. (customer.email or "N/A") .. ">")
end
```

---

## get_current_user

Verify the Razorpay API connection with a lightweight payments request. Razorpay does not expose a general current-user endpoint in the payments API, so this returns the same collection shape as `list_payments` with `count = 1`.

### Parameters

None.

### Examples

```lua
local result = app.integrations.razorpay.get_current_user({})

print("Connected; sample count: " .. tostring(result.count))
```

---

## Multi-Account Usage

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

```lua
-- Default account (always works)
app.integrations.razorpay.list_payments({count = 10})

-- Explicit default (portable across setups)
app.integrations.razorpay.default.list_payments({count = 10})

-- Named accounts
app.integrations.razorpay.production.list_payments({count = 10})
app.integrations.razorpay.staging.list_payments({count = 10})
```

All functions are identical across accounts — only the credentials differ.
Metadata-derived Lua example
local result = app.integrations.razorpay.list_payments({count = 1, skip = 1, from = 1, to = 1})
print(result)

Functions

list_payments Read

List payments from Razorpay. Supports pagination and date-range filters. Returns payment IDs, amounts, statuses, and methods.

Lua path
app.integrations.razorpay.list_payments
Full name
razorpay.razorpay_list_payments
ParameterTypeRequiredDescription
count integer no Number of payments to return (default: 10, max: 100).
skip integer no Number of payments to skip for pagination.
from integer no Unix timestamp for the start of the date range.
to integer no Unix timestamp for the end of the date range.
get_payment Read

Get details of a specific Razorpay payment by its ID. Returns full payment information including amount, status, method, and metadata.

Lua path
app.integrations.razorpay.get_payment
Full name
razorpay.razorpay_get_payment
ParameterTypeRequiredDescription
payment_id string yes The Razorpay payment ID (e.g., "pay_1234567890").
list_orders Read

List orders from Razorpay. Supports pagination and date-range filters. Returns order IDs, amounts, currencies, and statuses.

Lua path
app.integrations.razorpay.list_orders
Full name
razorpay.razorpay_list_orders
ParameterTypeRequiredDescription
count integer no Number of orders to return (default: 10, max: 100).
skip integer no Number of orders to skip for pagination.
from integer no Unix timestamp for the start of the date range.
to integer no Unix timestamp for the end of the date range.
get_order Read

Get details of a specific Razorpay order by its ID. Returns full order information including amount, status, and payments.

Lua path
app.integrations.razorpay.get_order
Full name
razorpay.razorpay_get_order
ParameterTypeRequiredDescription
order_id string yes The Razorpay order ID (e.g., "order_1234567890").
create_order Write

Create a new payment order in Razorpay. Specify the amount (in smallest currency unit, e.g., paise for INR), currency, and an optional receipt identifier.

Lua path
app.integrations.razorpay.create_order
Full name
razorpay.razorpay_create_order
ParameterTypeRequiredDescription
amount integer yes Amount in smallest currency unit (e.g., 10000 for ₹100.00 in INR).
currency string no Three-letter currency code (default: "INR").
receipt string no Your internal receipt identifier (max 40 characters).
notes object no Key-value notes to attach to the order.
list_refunds Read

List refunds from Razorpay. Supports pagination and date-range filters. Returns refund IDs, amounts, payment references, and statuses.

Lua path
app.integrations.razorpay.list_refunds
Full name
razorpay.razorpay_list_refunds
ParameterTypeRequiredDescription
count integer no Number of refunds to return (default: 10, max: 100).
skip integer no Number of refunds to skip for pagination.
from integer no Unix timestamp for the start of the date range.
to integer no Unix timestamp for the end of the date range.
list_customers Read

List customers from Razorpay. Supports pagination. Returns customer IDs, names, emails, and contact numbers.

Lua path
app.integrations.razorpay.list_customers
Full name
razorpay.razorpay_list_customers
ParameterTypeRequiredDescription
count integer no Number of customers to return (default: 10, max: 100).
skip integer no Number of customers to skip for pagination.
connection_check Read

Verify the Razorpay API connection with a lightweight payments request.

Lua path
app.integrations.razorpay.connection_check
Full name
razorpay.razorpay_get_current_user
ParameterTypeRequiredDescription
No parameters.