KosmoKrator

payments

Razorpay Lua API for KosmoKrator Agents

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

8 functions 7 read 1 write API key auth

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.

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

Get current user information from Razorpay. Returns details about the authenticated account.

Parameters

None.

Examples

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

-- Inspect the returned data
for k, v in pairs(result) do
  print(k .. ": " .. tostring(v))
end

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

Get current user information from Razorpay. Returns details about the authenticated account.

### Parameters

None.

### Examples

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

-- Inspect the returned data
for k, v in pairs(result) do
  print(k .. ": " .. tostring(v))
end
```

---

## 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.razorpay_list_payments({
  count = 1,
  skip = 1,
  from = 1,
  to = 1
})
print(result)

Functions

razorpay_list_payments

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

Operation
Read read
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.

razorpay_get_payment

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

Operation
Read read
Full name
razorpay.razorpay_get_payment
ParameterTypeRequiredDescription
payment_id string yes The Razorpay payment ID (e.g., "pay_1234567890").

razorpay_list_orders

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

Operation
Read read
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.

razorpay_get_order

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

Operation
Read read
Full name
razorpay.razorpay_get_order
ParameterTypeRequiredDescription
order_id string yes The Razorpay order ID (e.g., "order_1234567890").

razorpay_create_order

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.

Operation
Write write
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.

razorpay_list_refunds

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

Operation
Read read
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.

razorpay_list_customers

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

Operation
Read read
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.

razorpay_get_current_user

Get current user information from Razorpay. Returns details about the authenticated Razorpay account.

Operation
Read read
Full name
razorpay.razorpay_get_current_user
ParameterTypeRequiredDescription
No parameters.