KosmoKrator

finance

Adyen Lua API for KosmoKrator Agents

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

8 functions 5 read 3 write API key auth

Lua Namespace

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

Adyen Integration

Adyen is a global payments platform that enables businesses to accept, process, and settle payments across online, mobile, and in-store channels.

Configuration

FieldTypeRequiredDescription
api_keysecretYesYour Adyen API key. Generate one in the Customer Area under Developers → API Credentials.
merchant_accounttextYesYour Adyen merchant account code (e.g., YourCompanyECOM).
urlurlNoAPI base URL. Use https://checkout-test.adyen.com for test, https://checkout-live.adyen.com for live.

Authentication

All requests use the x-API-key header for authentication. The API key must have the appropriate permissions (role) for the endpoints you intend to use.

Tools

adyen_list_transactions

List transactions from the Adyen transaction feed.

Parameters:

NameTypeRequiredDescription
pageintegerNoPage number for pagination (starts at 1).
sizeintegerNoNumber of transactions per page (default: 20).

Example:

adyen_list_transactions({ page = 1, size = 50 })

adyen_get_transaction

Get details of a specific transaction by its PSP reference.

Parameters:

NameTypeRequiredDescription
psp_referencestringYesThe PSP reference of the transaction.

Example:

adyen_get_transaction({ psp_reference = "8535296650153317" })

adyen_make_payment

Initiate a payment through Adyen. The merchant account is auto-injected.

Parameters:

NameTypeRequiredDescription
amountobjectYesAmount object with value (minor units) and currency. E.g., { value = "1000", currency = "EUR" }.
payment_methodobjectYesPayment method details (type, card details, etc.).
referencestringNoCustom reference (e.g., order number).
return_urlstringNoRedirect URL after payment.
shopper_referencestringNoUnique shopper ID for recurring payments.
shopper_emailstringNoShopper email address.

Example:

adyen_make_payment({
    amount = { value = "1000", currency = "EUR" },
    payment_method = { type = "scheme" },
    reference = "ORDER-123"
})

adyen_capture_payment

Capture a previously authorized payment. The merchant account is auto-injected.

Parameters:

NameTypeRequiredDescription
psp_referencestringYesThe PSP reference of the authorized payment.
amountobjectYesCapture amount with value (minor units) and currency.

Example:

adyen_capture_payment({
    psp_reference = "8535296650153317",
    amount = { value = "1000", currency = "EUR" }
})

adyen_refund_payment

Refund a captured or settled payment. The merchant account is auto-injected.

Parameters:

NameTypeRequiredDescription
psp_referencestringYesThe PSP reference of the payment to refund.
amountobjectYesRefund amount with value (minor units) and currency.

Example:

adyen_refund_payment({
    psp_reference = "8535296650153317",
    amount = { value = "1000", currency = "EUR" }
})

adyen_list_stores

List stores for the configured merchant account. The merchant account is auto-injected.

Parameters:

NameTypeRequiredDescription
limitintegerNoMaximum number of stores to return.
pagestringNoPagination cursor from a previous response.

Example:

adyen_list_stores({ limit = 20 })

adyen_get_current_user

Verify Adyen API connectivity and get merchant account information. Useful as a health check.

Parameters: None.

Example:

adyen_get_current_user()

Notes

  • Amount values are in minor units: 1000 = €10.00, 500 = $5.00.
  • The psp_reference is Adyen’s unique identifier for each payment/transaction.
  • Always test with the checkout-test.adyen.com base URL before switching to live.
Raw agent markdown
# Adyen Integration

Adyen is a global payments platform that enables businesses to accept, process, and settle payments across online, mobile, and in-store channels.

## Configuration

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `api_key` | secret | Yes | Your Adyen API key. Generate one in the Customer Area under **Developers → API Credentials**. |
| `merchant_account` | text | Yes | Your Adyen merchant account code (e.g., `YourCompanyECOM`). |
| `url` | url | No | API base URL. Use `https://checkout-test.adyen.com` for test, `https://checkout-live.adyen.com` for live. |

## Authentication

All requests use the `x-API-key` header for authentication. The API key must have the appropriate permissions (role) for the endpoints you intend to use.

## Tools

### adyen_list_transactions

List transactions from the Adyen transaction feed.

**Parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | No | Page number for pagination (starts at 1). |
| `size` | integer | No | Number of transactions per page (default: 20). |

**Example:**

```lua
adyen_list_transactions({ page = 1, size = 50 })
```

---

### adyen_get_transaction

Get details of a specific transaction by its PSP reference.

**Parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `psp_reference` | string | Yes | The PSP reference of the transaction. |

**Example:**

```lua
adyen_get_transaction({ psp_reference = "8535296650153317" })
```

---

### adyen_make_payment

Initiate a payment through Adyen. The merchant account is auto-injected.

**Parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `amount` | object | Yes | Amount object with `value` (minor units) and `currency`. E.g., `{ value = "1000", currency = "EUR" }`. |
| `payment_method` | object | Yes | Payment method details (type, card details, etc.). |
| `reference` | string | No | Custom reference (e.g., order number). |
| `return_url` | string | No | Redirect URL after payment. |
| `shopper_reference` | string | No | Unique shopper ID for recurring payments. |
| `shopper_email` | string | No | Shopper email address. |

**Example:**

```lua
adyen_make_payment({
    amount = { value = "1000", currency = "EUR" },
    payment_method = { type = "scheme" },
    reference = "ORDER-123"
})
```

---

### adyen_capture_payment

Capture a previously authorized payment. The merchant account is auto-injected.

**Parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `psp_reference` | string | Yes | The PSP reference of the authorized payment. |
| `amount` | object | Yes | Capture amount with `value` (minor units) and `currency`. |

**Example:**

```lua
adyen_capture_payment({
    psp_reference = "8535296650153317",
    amount = { value = "1000", currency = "EUR" }
})
```

---

### adyen_refund_payment

Refund a captured or settled payment. The merchant account is auto-injected.

**Parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `psp_reference` | string | Yes | The PSP reference of the payment to refund. |
| `amount` | object | Yes | Refund amount with `value` (minor units) and `currency`. |

**Example:**

```lua
adyen_refund_payment({
    psp_reference = "8535296650153317",
    amount = { value = "1000", currency = "EUR" }
})
```

---

### adyen_list_stores

List stores for the configured merchant account. The merchant account is auto-injected.

**Parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | No | Maximum number of stores to return. |
| `page` | string | No | Pagination cursor from a previous response. |

**Example:**

```lua
adyen_list_stores({ limit = 20 })
```

---

### adyen_get_current_user

Verify Adyen API connectivity and get merchant account information. Useful as a health check.

**Parameters:** None.

**Example:**

```lua
adyen_get_current_user()
```

---

## Notes

- Amount values are in **minor units**: `1000` = €10.00, `500` = $5.00.
- The `psp_reference` is Adyen's unique identifier for each payment/transaction.
- Always test with the `checkout-test.adyen.com` base URL before switching to live.

Metadata-Derived Lua Example

local result = app.integrations.adyen.adyen_capture_payment({
  psp_reference = "example_psp_reference",
  amount = "example_amount"
})
print(result)

Functions

adyen_capture_payment

Capture a previously authorized Adyen payment. Requires the PSP reference of the original payment and the amount to capture (value in minor units + currency). The merchant account is automatically injected.

Operation
Write write
Full name
adyen.adyen_capture_payment
ParameterTypeRequiredDescription
psp_reference string yes The PSP reference of the authorized payment to capture.
amount object yes Capture amount object with "value" (in minor units, e.g., "1000" for €10.00) and "currency" (e.g., "EUR"). Example: {"value": "1000", "currency": "EUR"}.

adyen_get_current_merchant

Get current merchant account information from Adyen. Verifies API connectivity and returns available payment methods for the merchant account.

Operation
Read read
Full name
adyen.adyen_get_current_merchant
ParameterTypeRequiredDescription
No parameters.

adyen_get_current_user

Verify Adyen API connectivity and retrieve current merchant account information. Useful as a health check to confirm the integration is properly configured.

Operation
Read read
Full name
adyen.adyen_get_current_user
ParameterTypeRequiredDescription
No parameters.

adyen_get_transaction

Get details of a specific Adyen transaction by its PSP reference. Returns the full transaction object including amount, status, and payment details.

Operation
Read read
Full name
adyen.adyen_get_transaction
ParameterTypeRequiredDescription
psp_reference string yes The PSP reference of the transaction to retrieve (e.g., "8535296650153317").

adyen_list_stores

List stores for the configured Adyen merchant account. Returns store details including store codes, names, and addresses. The merchant account is automatically injected.

Operation
Read read
Full name
adyen.adyen_list_stores
ParameterTypeRequiredDescription
limit integer no Maximum number of stores to return per page.
page string no Cursor for pagination — pass the value from a previous response to get the next page.

adyen_list_transactions

List transactions from the Adyen transaction feed. Returns a paginated list of transactions for the merchant account. Use page and size parameters to control pagination.

Operation
Read read
Full name
adyen.adyen_list_transactions
ParameterTypeRequiredDescription
page integer no Page number for pagination (starts at 1).
size integer no Number of transactions per page (default: 20).

adyen_make_payment

Initiate a payment through Adyen. Requires amount (value in minor units + currency) and payment method. The merchant account is automatically injected from the integration configuration. Returns the payment result including PSP reference.

Operation
Write write
Full name
adyen.adyen_make_payment
ParameterTypeRequiredDescription
amount object yes Payment amount object with "value" (in minor units, e.g., "1000" for €10.00) and "currency" (e.g., "EUR", "USD"). Example: {"value": "1000", "currency": "EUR"}.
payment_method object yes Payment method details. For example: {"type": "scheme", "encryptedCardNumber": "...", "encryptedExpiryMonth": "...", "encryptedExpiryYear": "...", "encryptedSecurityCode": "..."}.
reference string no A custom reference for this payment (e.g., an order number).
return_url string no URL to redirect the shopper back to after payment completion.
shopper_reference string no Unique identifier for the shopper (for recurring payments).
shopper_email string no Shopper email address.

adyen_refund_payment

Refund an Adyen payment (full or partial). Requires the PSP reference of the original payment and the amount to refund (value in minor units + currency). The merchant account is automatically injected.

Operation
Write write
Full name
adyen.adyen_refund_payment
ParameterTypeRequiredDescription
psp_reference string yes The PSP reference of the payment to refund.
amount object yes Refund amount object with "value" (in minor units, e.g., "1000" for €10.00) and "currency" (e.g., "EUR"). Example: {"value": "1000", "currency": "EUR"}.