KosmoKrator

other

Flutterwave Lua API for KosmoKrator Agents

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

7 functions 5 read 2 write API key auth

Lua Namespace

Agents call this integration through app.integrations.flutterwave.*. Use lua_read_doc("integrations.flutterwave") 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.

Flutterwave — Lua API Reference

list_transactions

List transactions from your Flutterwave account. Supports filtering by status and date range, with pagination.

Parameters

NameTypeRequiredDescription
pageintegernoPage number for pagination (default: 1)
statusstringnoFilter by transaction status (e.g., "successful", "failed", "pending")
fromstringnoStart date for filtering transactions (YYYY-MM-DD)
tostringnoEnd date for filtering transactions (YYYY-MM-DD)

Examples

List recent transactions

local result = app.integrations.flutterwave.list_transactions({
  page = 1
})

for _, tx in ipairs(result.data) do
  print(tx.id .. ": " .. tx.amount .. " " .. tx.currency .. " - " .. tx.status)
end

Filter by date range and status

local result = app.integrations.flutterwave.list_transactions({
  from = "2024-01-01",
  to = "2024-06-30",
  status = "successful"
})

get_transaction

Retrieve full details of a specific Flutterwave transaction by its ID.

Parameters

NameTypeRequiredDescription
idintegeryesThe Flutterwave transaction ID

Examples

Get transaction details

local result = app.integrations.flutterwave.get_transaction({
  id = 123456
})

print("Amount: " .. result.data.amount .. " " .. result.data.currency)
print("Status: " .. result.data.status)
print("Customer: " .. result.data.customer.email)

initiate_payment

Initiate a new payment on Flutterwave. Requires a transaction reference, amount, currency, and customer details.

Parameters

NameTypeRequiredDescription
tx_refstringyesYour unique transaction reference (e.g., "txn-001")
amountnumberyesPayment amount (e.g., 5000)
currencystringyesThree-letter currency code (e.g., "NGN", "USD", "KES")
customerobjectyesCustomer object with at least an email field. May also include name and phonenumber
redirect_urlstringnoURL to redirect the customer after payment completion

Examples

Initiate a payment

local result = app.integrations.flutterwave.initiate_payment({
  tx_ref = "txn-001",
  amount = 5000,
  currency = "NGN",
  customer = {
    email = "[email protected]",
    name = "John Doe",
    phonenumber = "08012345678"
  }
})

print("Payment link: " .. result.data.link)

Initiate with redirect URL

local result = app.integrations.flutterwave.initiate_payment({
  tx_ref = "txn-002",
  amount = 100.00,
  currency = "USD",
  customer = {
    email = "[email protected]"
  },
  redirect_url = "https://example.com/callback"
})

verify_transaction

Verify a Flutterwave transaction by its ID to confirm payment status and retrieve full details.

Parameters

NameTypeRequiredDescription
idintegeryesThe Flutterwave transaction ID to verify

Examples

Verify a transaction

local result = app.integrations.flutterwave.verify_transaction({
  id = 123456
})

if result.data.status == "successful" then
  print("Payment confirmed: " .. result.data.amount .. " " .. result.data.currency)
else
  print("Payment status: " .. result.data.status)
end

list_customers

List customers registered on your Flutterwave account, with pagination support.

Parameters

NameTypeRequiredDescription
pageintegernoPage number for pagination (default: 1)

Examples

List customers

local result = app.integrations.flutterwave.list_customers({
  page = 1
})

for _, customer in ipairs(result.data) do
  print(customer.name .. " <" .. customer.email .. ">")
end

create_customer

Create a new customer record on Flutterwave. Requires an email address.

Parameters

NameTypeRequiredDescription
emailstringyesCustomer email address
first_namestringnoCustomer first name
last_namestringnoCustomer last name
phonestringnoCustomer phone number

Examples

Create a customer

local result = app.integrations.flutterwave.create_customer({
  email = "[email protected]",
  first_name = "Jane",
  last_name = "Doe",
  phone = "+2348012345678"
})

print("Customer ID: " .. result.data.id)

get_banks

Get a list of supported banks for a given country from Flutterwave.

Parameters

NameTypeRequiredDescription
countrystringyesISO country code (e.g., "NG", "KE", "GH", "ZA")

Examples

Get Nigerian banks

local result = app.integrations.flutterwave.get_banks({
  country = "NG"
})

for _, bank in ipairs(result.data) do
  print(bank.name .. " (" .. bank.code .. ")")
end

Get Kenyan banks

local result = app.integrations.flutterwave.get_banks({
  country = "KE"
})

Multi-Account Usage

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

-- Default account (always works)
app.integrations.flutterwave.list_transactions({...})

-- Explicit default (portable across setups)
app.integrations.flutterwave.default.list_transactions({...})

-- Named accounts
app.integrations.flutterwave.production.list_transactions({...})
app.integrations.flutterwave.staging.list_transactions({...})

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

Raw agent markdown
# Flutterwave — Lua API Reference

## list_transactions

List transactions from your Flutterwave account. Supports filtering by status and date range, with pagination.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number for pagination (default: 1) |
| `status` | string | no | Filter by transaction status (e.g., `"successful"`, `"failed"`, `"pending"`) |
| `from` | string | no | Start date for filtering transactions (YYYY-MM-DD) |
| `to` | string | no | End date for filtering transactions (YYYY-MM-DD) |

### Examples

#### List recent transactions

```lua
local result = app.integrations.flutterwave.list_transactions({
  page = 1
})

for _, tx in ipairs(result.data) do
  print(tx.id .. ": " .. tx.amount .. " " .. tx.currency .. " - " .. tx.status)
end
```

#### Filter by date range and status

```lua
local result = app.integrations.flutterwave.list_transactions({
  from = "2024-01-01",
  to = "2024-06-30",
  status = "successful"
})
```

---

## get_transaction

Retrieve full details of a specific Flutterwave transaction by its ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The Flutterwave transaction ID |

### Examples

#### Get transaction details

```lua
local result = app.integrations.flutterwave.get_transaction({
  id = 123456
})

print("Amount: " .. result.data.amount .. " " .. result.data.currency)
print("Status: " .. result.data.status)
print("Customer: " .. result.data.customer.email)
```

---

## initiate_payment

Initiate a new payment on Flutterwave. Requires a transaction reference, amount, currency, and customer details.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `tx_ref` | string | yes | Your unique transaction reference (e.g., `"txn-001"`) |
| `amount` | number | yes | Payment amount (e.g., `5000`) |
| `currency` | string | yes | Three-letter currency code (e.g., `"NGN"`, `"USD"`, `"KES"`) |
| `customer` | object | yes | Customer object with at least an `email` field. May also include `name` and `phonenumber` |
| `redirect_url` | string | no | URL to redirect the customer after payment completion |

### Examples

#### Initiate a payment

```lua
local result = app.integrations.flutterwave.initiate_payment({
  tx_ref = "txn-001",
  amount = 5000,
  currency = "NGN",
  customer = {
    email = "[email protected]",
    name = "John Doe",
    phonenumber = "08012345678"
  }
})

print("Payment link: " .. result.data.link)
```

#### Initiate with redirect URL

```lua
local result = app.integrations.flutterwave.initiate_payment({
  tx_ref = "txn-002",
  amount = 100.00,
  currency = "USD",
  customer = {
    email = "[email protected]"
  },
  redirect_url = "https://example.com/callback"
})
```

---

## verify_transaction

Verify a Flutterwave transaction by its ID to confirm payment status and retrieve full details.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The Flutterwave transaction ID to verify |

### Examples

#### Verify a transaction

```lua
local result = app.integrations.flutterwave.verify_transaction({
  id = 123456
})

if result.data.status == "successful" then
  print("Payment confirmed: " .. result.data.amount .. " " .. result.data.currency)
else
  print("Payment status: " .. result.data.status)
end
```

---

## list_customers

List customers registered on your Flutterwave account, with pagination support.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number for pagination (default: 1) |

### Examples

#### List customers

```lua
local result = app.integrations.flutterwave.list_customers({
  page = 1
})

for _, customer in ipairs(result.data) do
  print(customer.name .. " <" .. customer.email .. ">")
end
```

---

## create_customer

Create a new customer record on Flutterwave. Requires an email address.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `email` | string | yes | Customer email address |
| `first_name` | string | no | Customer first name |
| `last_name` | string | no | Customer last name |
| `phone` | string | no | Customer phone number |

### Examples

#### Create a customer

```lua
local result = app.integrations.flutterwave.create_customer({
  email = "[email protected]",
  first_name = "Jane",
  last_name = "Doe",
  phone = "+2348012345678"
})

print("Customer ID: " .. result.data.id)
```

---

## get_banks

Get a list of supported banks for a given country from Flutterwave.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `country` | string | yes | ISO country code (e.g., `"NG"`, `"KE"`, `"GH"`, `"ZA"`) |

### Examples

#### Get Nigerian banks

```lua
local result = app.integrations.flutterwave.get_banks({
  country = "NG"
})

for _, bank in ipairs(result.data) do
  print(bank.name .. " (" .. bank.code .. ")")
end
```

#### Get Kenyan banks

```lua
local result = app.integrations.flutterwave.get_banks({
  country = "KE"
})
```

---

## Multi-Account Usage

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

```lua
-- Default account (always works)
app.integrations.flutterwave.list_transactions({...})

-- Explicit default (portable across setups)
app.integrations.flutterwave.default.list_transactions({...})

-- Named accounts
app.integrations.flutterwave.production.list_transactions({...})
app.integrations.flutterwave.staging.list_transactions({...})
```

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

Metadata-Derived Lua Example

local result = app.integrations.flutterwave.flutterwave_list_transactions({
  page = 1,
  status = "example_status",
  from = "example_from",
  to = "example_to"
})
print(result)

Functions

flutterwave_list_transactions

List transactions from your Flutterwave account. Supports filtering by status and date range, with pagination.

Operation
Read read
Full name
flutterwave.flutterwave_list_transactions
ParameterTypeRequiredDescription
page integer no Page number for pagination (default: 1).
status string no Filter by transaction status (e.g. "successful", "failed", "pending").
from string no Start date for filtering transactions (YYYY-MM-DD).
to string no End date for filtering transactions (YYYY-MM-DD).

flutterwave_get_transaction

Retrieve full details of a specific Flutterwave transaction by its ID.

Operation
Read read
Full name
flutterwave.flutterwave_get_transaction
ParameterTypeRequiredDescription
id integer yes The Flutterwave transaction ID.

flutterwave_initiate_payment

Initiate a new payment on Flutterwave. Requires a transaction reference, amount, currency, and customer details.

Operation
Write write
Full name
flutterwave.flutterwave_initiate_payment
ParameterTypeRequiredDescription
tx_ref string yes Your unique transaction reference (e.g. "txn-001").
amount number yes Payment amount (e.g. 5000).
currency string yes Three-letter currency code (e.g. "NGN", "USD", "KES").
customer object yes Customer object with at least an "email" field. May also include "name" and "phonenumber".
redirect_url string no URL to redirect the customer after payment completion.

flutterwave_verify_transaction

Verify a Flutterwave transaction by its ID to confirm payment status and retrieve full details.

Operation
Read read
Full name
flutterwave.flutterwave_verify_transaction
ParameterTypeRequiredDescription
id integer yes The Flutterwave transaction ID to verify.

flutterwave_list_customers

List customers registered on your Flutterwave account, with pagination support.

Operation
Read read
Full name
flutterwave.flutterwave_list_customers
ParameterTypeRequiredDescription
page integer no Page number for pagination (default: 1).

flutterwave_create_customer

Create a new customer record on Flutterwave. Requires an email address.

Operation
Write write
Full name
flutterwave.flutterwave_create_customer
ParameterTypeRequiredDescription
email string yes Customer email address.
first_name string no Customer first name.
last_name string no Customer last name.
phone string no Customer phone number.

flutterwave_get_banks

Get a list of supported banks for a given country from Flutterwave. Provide a country code like "NG" for Nigeria, "KE" for Kenya, "GH" for Ghana.

Operation
Read read
Full name
flutterwave.flutterwave_get_banks
ParameterTypeRequiredDescription
country string yes ISO country code (e.g. "NG", "KE", "GH", "ZA").