Fees
Learn how to charge your customers a fee that lemon.markets collects on your behalf: find the cash account, create the fee and follow its status.
Overview
A fee is a charge that you calculate and that lemon.markets collects from a cash account of the customer on your behalf. You send the amount; lemon.markets collects it and passes it on to you.
The fee type agio is a one-off fee on a pay-in of the customer: the customer pays in, you charge e.g. a percentage of the pay-in as a fee, and once the fee is collected, you invest the remaining cash.
Sequence
- Find the cash account to charge, through the securities account of the product.
- Create the fee on that cash account.
- Follow the fee until it is
processed.
sequenceDiagram
participant P as Partner
participant L as lemon.markets
P->>L: GET /accounts/{account_id}/products?type=retirement
L-->>P: the retirement product (id ret_…)
P->>L: GET /accounts/{account_id}/securities_accounts
L-->>P: the securities account with product ret_…, and its cash_account
P->>L: POST /accounts/{account_id}/fees (cash_account, type agio, amount)
L-->>P: 201, status created
P->>L: GET /accounts/{account_id}/fees/{fee_id}
L-->>P: status processed, collected_amount = amount
P->>L: POST /accounts/{account_id}/orders for the remaining cash
Find the Cash Account
A fee is charged on a cash account of the account. The cash account is associated with a securities account, e.g. the securities account of the retirement product. You find it through that securities account:
- Call GET /accounts/{account_id}/products with the product type, e.g.
type=retirement, and take theidof the product, e.g.ret_7d1a8c0e5b8f4f3a9c2e6b1d4f0a9e57. - Call GET /accounts/{account_id}/securities_accounts and take the securities account whose
productis the product'sid. - Its
cash_accountis the cash account to charge, e.g.casha_2b1b6dd0e1514bf5bb1f382f249bfb35.
Example response of GET /accounts/{account_id}/securities_accounts:
{
"data": [
{
"id": "sec_ac_00e49aeab85844c89de57929bcb0f76a",
"account_number": "LMM867947731",
"status": "opened",
"cash_account": "casha_9a6d5fa6b7454b87befe4478dc8577be",
"product": "brok_c4ad0c3244bb4a7d97ee760290627dc2",
"history": [{"status": "opened", "timestamp": "2026-07-14T11:36:28.157491+00:00"}]
},
{
"id": "sec_ac_2f532772b8f84da9859215754a50f091",
"account_number": "LMM000000127",
"status": "opened",
"cash_account": "casha_2b1b6dd0e1514bf5bb1f382f249bfb35",
"product": "ret_7d1a8c0e5b8f4f3a9c2e6b1d4f0a9e57",
"history": [{"status": "opened", "timestamp": "2026-07-14T16:14:22.645530+00:00"}]
}
],
"pagination": {"next_cursor": null}
}For the retirement product ret_7d1a8c0e5b8f4f3a9c2e6b1d4f0a9e57, the cash account to charge is casha_2b1b6dd0e1514bf5bb1f382f249bfb35.
Create the Fee
Call POST /accounts/{account_id}/fees with the cash account, the type, the amount and your reference:
{
"cash_account": "casha_2b1b6dd0e1514bf5bb1f382f249bfb35",
"type": "agio",
"amount": "20.00",
"currency": "EUR",
"reference": "AGIO-2026-000123"
}The fee is returned with status created and its id, e.g. pfee_92e87fce676d44898353edc240cd78f6.
referenceidentifies your charge and is unique across all your fees. A second fee with the samereferencefails with a409, also when the request is the same. Use your own identifier of the charge, e.g. the invoice or booking number.- To retry a request safely, e.g. after a timeout, send an
Idempotency-Keyheader. A retry with the same key and the same body returns the fee of the first request. See the Idempotency guide.
Follow the Fee
A fee changes status as it is collected.
stateDiagram-v2
[*] --> created: POST /accounts/{account_id}/fees
created --> processing: the fee is being collected
processing --> processed: the full amount is collected
processed --> [*]
| Status | Meaning |
|---|---|
created | The fee has been created. |
processing | The fee is being collected. |
processed | The full amount of the fee is collected. |
Call GET /accounts/{account_id}/fees/{fee_id} to see the status, collected_amount (collected so far) and open_amount (still to be collected). GET /accounts/{account_id}/fees lists the fees of the account, newest first, and can be filtered by cash_account, type, status and reference.
For an agio fee, wait until the fee is processed before you place orders for the remaining cash.
Updated 33 minutes ago