Investments
Enable your customers to earn yield on their cryptocurrency holdings through DeFi protocols
Investments allow your customers to earn yield on their cryptocurrency holdings through established DeFi protocols. Customers can subscribe (deposit) their crypto assets into investment products and redeem (withdraw) them along with any accrued earnings.
Overview
The investment lifecycle consists of three main phases:
| Phase | Action | Description |
|---|---|---|
| Discovery | Query available investments | Retrieve providers, rates, and available assets |
| Subscribe | Deposit crypto into investment | Customer's crypto is converted into yield-bearing tokens |
| Redeem | Withdraw crypto from investment | Yield-bearing tokens are converted back to crypto, plus earnings |
Subscribe: Customer Crypto (USDC) → Lirium → DeFi Protocol → Investment Token (aEthUSDC)
Redeem: Investment Token (aEthUSDC) → DeFi Protocol → Lirium → Customer Crypto (USDC)
Prerequisites
Before integrating investments, ensure:
- Your partner account has the
investmentsproduct enabled. Check Partner Details to verify. - Your customers are fully onboarded and verified. See KYC Flows.
- Customers have sufficient balance in the required
quote_assetcurrency to subscribe.
Available Investment Assets
The investments available to your partner account are listed in the available_investments field of the Partner Details response.
Each investment asset includes the following information:
| Field | Description | Example |
|---|---|---|
id | Unique identifier for the investment token | aEthUSDC |
name | Display name | Aave Ethereum USDC |
quote_asset | The crypto asset used to subscribe and redeem | USDC |
network | Blockchain network | ethereum |
provider_id | Investment provider identifier | aave |
enabled | Whether the investment is currently active | true |
subscription.min_amount / max_amount | Allowed range for subscriptions (in quote_asset) | 1 / 200000 |
redemption.min_amount / max_amount | Allowed range for redemptions (in quote_asset) | 1 / 0 |
fee.type | Type of fee charged by Lirium | earnings_percentage |
fee.value | Fee value corresponding to the type | 5 |
Quote AssetThe
quote_assetis the cryptocurrency that the customer must hold to subscribe to the investment, and the cryptocurrency they receive back when redeeming. For example, to subscribe toaEthUSDC, the customer needsUSDCin their balance.
Investment Providers
Providers are the DeFi protocols that power the investment products. Use Get Investment Providers to retrieve the list.
| Provider | Category | Description |
|---|---|---|
| Aave | Lending (APY) | Decentralized lending protocol. Customers earn yield by supplying assets to lending pools. |
| Lido | Liquid Staking (APY) | Liquid staking protocol. Customers earn staking rewards while maintaining liquidity. |
Investment Rates
Use Get Investment Rates to query the current rates and yields for all investment assets. This endpoint does not require authentication.
Each rate entry provides:
| Field | Description | Example |
|---|---|---|
id | Investment asset identifier | aEthDAI |
quote_asset | The underlying crypto asset | DAI |
rate | Current exchange rate (amount of quote_asset per investment token) | 1.038493663748107771 |
apy | Annual Percentage Yield | 4.7729 |
apr | Annual Percentage Rate | 4.6625 |
generated_at | Timestamp when the rate was calculated | 2024-02-01T08:56:35.000000+00:00 |
Rate, APY, and APRThe
rateindicates how muchquote_asseteach investment token is currently worth. This value increases over time as yield accrues. Theapyreflects compounded returns whileaprreflects simple interest. These values are variable and change based on market conditions.
How It Works
Subscribing to an Investment
Subscribing converts a customer's cryptocurrency into yield-bearing investment tokens through a two-step order process.
Flow:
- Initiate a
subscribe_investmentorder specifying the investment asset and the amount ofquote_assetto invest - Confirm the order (with security code if required)
- The customer's
quote_assetbalance is debited - Investment tokens are credited to the customer's investment balance
- The investment starts earning yield immediately
POST /customers/{customer_id}/orders{
"operation": "subscribe_investment",
"asset": {
"currency": "USDC",
"amount": "2000"
},
"subscribe_investment": {
"investment": {
"id": "aEthUSDC"
}
}
}{
"id": "3dfb5a...",
"operation": "subscribe_investment",
"state": "pending",
"created_at": "2024-02-01T10:00:00+00:00",
"customer_id": "d3488a...",
"asset": {
"type": "currency",
"id": "USDC",
"operation": "debit",
"amount": "2000"
},
"subscribe_investment": {
"requires_confirmation_code": true,
"expires_at": "2024-02-01T10:05:00+00:00",
"investment": {
"id": "aEthUSDC"
},
"rate": "1.03956"
}
}After confirming the order, the response transitions to completed state and includes the resulting investment token balance:
{
"id": "3dfb5a...",
"operation": "subscribe_investment",
"state": "completed",
"created_at": "2024-02-01T10:00:00+00:00",
"submitted_at": "2024-02-01T10:01:30+00:00",
"customer_id": "d3488a...",
"asset": {
"type": "currency",
"id": "USDC",
"operation": "debit",
"amount": "2000",
"balance": "500"
},
"subscribe_investment": {
"requires_confirmation_code": true,
"expires_at": "2024-02-01T10:05:00+00:00",
"investment": {
"id": "aEthUSDC",
"amount": "1923.87862",
"operation": "credit",
"order_id": "ac242..."
},
"rate": "1.03956"
}
}
Investment Token AmountThe amount of investment tokens received is calculated as:
asset.amount/rate. In this example: 2000 / 1.03956 = 1923.87862 aEthUSDC tokens.
Redeeming an Investment
Redeeming converts investment tokens back into the quote_asset cryptocurrency plus any accrued earnings.
There are two ways to redeem:
- Partial redemption: Specify the
asset.amountto indicate how muchquote_assetthe customer should receive after all fees are applied - Full redemption: Set
redeem_investment.investment.full_amounttotrueto redeem the entire investment position
POST /customers/{customer_id}/orders{
"operation": "redeem_investment",
"asset": {
"currency": "USDC",
"amount": "850"
},
"redeem_investment": {
"investment": {
"id": "aEthUSDC"
}
}
}{
"operation": "redeem_investment",
"asset": {
"currency": "USDC"
},
"redeem_investment": {
"investment": {
"id": "aEthUSDC",
"full_amount": true
}
}
}
Redeem Investment AmountWhen specifying
asset.amountfor a partial redemption, this is the net amount ofquote_assetthe customer will receive after all fees are applied. Lirium calculates how many investment tokens need to be redeemed to achieve this net amount.When using
full_amount: true, do not specifyasset.amount.
{
"id": "7bc9e2...",
"operation": "redeem_investment",
"state": "completed",
"created_at": "2024-06-15T14:00:00+00:00",
"submitted_at": "2024-06-15T14:01:00+00:00",
"customer_id": "d3488a...",
"asset": {
"type": "currency",
"id": "USDC",
"operation": "credit",
"amount": "850",
"balance": "1350"
},
"redeem_investment": {
"requires_confirmation_code": true,
"expires_at": "2024-06-15T14:05:00+00:00",
"investment": {
"id": "aEthUSDC",
"amount": "814.761562",
"operation": "debit",
"order_id": "b5ece..."
},
"rate": "1.04325",
"invested_amount": "846.993529",
"gross_amount": "850",
"earnings": "3.006471",
"fees": [
{
"source": "lirium_commission",
"type": "earnings_percentage",
"value": "5",
"mode": "collect",
"base_amount": "3.006471",
"base_operation": "deduct",
"amount": "0.15032355"
}
]
}
}Monitoring Customer Investments
Use Customer Investments to retrieve a customer's current investment positions with real-time valuation data.
GET /customers/{customer_id}/investmentsThe response includes each investment position with detailed performance metrics:
{
"investments": [
{
"id": "aEthUSDC",
"amount": "1109.117058",
"valued_position": {
"quote_asset": "USDC",
"invested_amount": "1153.006471",
"invested_price": "1.03956",
"last_price": "1.04325",
"valued_amount": "1157.100123",
"pnl": "4.093652",
"pnl_percentage": "0.35",
"net": {
"fee_amount": "0.204683",
"valued_amount": "1156.895440",
"pnl": "3.888969",
"pnl_percentage": "0.34"
}
}
}
]
}Valuation Fields
| Field | Description |
|---|---|
amount | Number of investment tokens the customer holds |
valued_position.quote_asset | The cryptocurrency used for valuation |
valued_position.invested_amount | Total quote_asset amount originally invested |
valued_position.invested_price | Weighted average price at which tokens were acquired |
valued_position.last_price | Current price per investment token |
valued_position.valued_amount | Current gross value of the position (amount * last_price) |
valued_position.pnl | Gross profit and loss (valued_amount - invested_amount) |
valued_position.pnl_percentage | Gross P&L as a percentage |
valued_position.net.fee_amount | Estimated fees if the position were fully redeemed now |
valued_position.net.valued_amount | Net value after estimated fees |
valued_position.net.pnl | Net profit and loss after estimated fees |
valued_position.net.pnl_percentage | Net P&L as a percentage |
Partner Commission in ValuationThe Customer Investments endpoint accepts an optional
fee_valuequery parameter. When provided, thenetfields in the response will include the partner's commission in the fee calculations, giving a more accurate view of what the customer would receive upon redemption.
Fees
Lirium Commission
Lirium charges a fee on investment redemptions based on the earnings generated. The fee type is earnings_percentage, meaning the fee is calculated as a percentage of the earnings only.
Example: If the fee value is 5 (5%) and the customer earned 3.006471 USDC, the fee would be 0.15032355 USDC (5% of 3.006471).
If a redemption has no earnings (the rate has not changed since subscription), no fees are collected.
Partner Commission
Partners can optionally charge their own commission on redeem_investment orders. This is a feature that requires enabling prior to usage.
To collect a partner commission, include the commission field in the redemption request:
{
"operation": "redeem_investment",
"asset": {
"currency": "USDC",
"amount": "850"
},
"redeem_investment": {
"investment": {
"id": "aEthUSDC"
},
"commission": {
"type": "earnings_percentage",
"value": "2"
}
}
}The supported commission types are:
| Type | Description |
|---|---|
earnings_percentage | Percentage of the redemption earnings |
percentage | Percentage of the total redeemed asset amount |
fixed | Fixed amount in the quote_asset currency |
Partner commissions are collected by Lirium and paid later into the partner's settlement balance.
Integration Guide
Step 1: Discover Available Investments
Query your partner's available investments and display them to customers with current rates.
# Get your available investments (from Partner Details)
GET /partner
# Get current rates and yields (no auth required)
GET /investments/rates
# Get provider information (no auth required)
GET /investments/providersStep 2: Subscribe
When a customer wants to invest, create a subscribe_investment order:
- Call Create Order with
operation: "subscribe_investment" - Display the order details to the customer (rate, token amount, expiration)
- Collect the security code if
requires_confirmation_codeistrue - Call Confirm Order to execute the investment
Step 3: Monitor Positions
Periodically query Customer Investments to display the customer's current positions, earnings, and P&L.
Step 4: Redeem
When a customer wants to withdraw their investment:
- Call Create Order with
operation: "redeem_investment" - Display the order details including earnings breakdown and fees
- Collect the security code if
requires_confirmation_codeistrue - Call Confirm Order to execute the redemption
Step 5: Track via Webhooks
Use webhooks to receive real-time notifications about order status changes via the order-updated event.
Best Practices
-
Display rates clearly: Show customers the current APY/APR and explain that rates are variable and subject to change.
-
Show net values: Use the
netfields from Customer Investments to display the actual value customers would receive after fees. -
Validate amounts: Check
subscription.min_amountandsubscription.max_amountbefore initiating orders to avoid validation errors. -
Handle expiration: Pending orders expire at
expires_at. If a customer doesn't confirm in time, the order will be automatically aborted and a new one must be created. -
Use webhooks: Subscribe to order-updated events rather than polling for order status changes.
-
Explain fees upfront: Clearly communicate Lirium's
earnings_percentagefee structure so customers understand the net returns.
API Reference
- Get Investment Providers
- Get Investment Rates
- Customer Investments
- Create Order (for
subscribe_investmentandredeem_investmentoperations) - Confirm Order
- Order Details
Updated about 1 month ago
