Install and enable
Turning the AI Investments addon on — the extension row, the hourly settlement task, the fifteen permission keys, the KYC gate, the affiliate condition and the Super Admin the revenue side depends on.
AI Investments installs as part of the platform tree. There is no separate archive to extract into a subdirectory and no migration to run by hand — the four tables are created by the same auto-sync that creates the core schema. What you have to do is switch the extension on, confirm the scheduled task exists, hand out the permissions and decide whether verification is required.
Do core install first. This addon assumes a working platform with wallets, a running cron process and a Super Admin.
Turn the extension on
-
Open the extensions screen — sign in as an administrator and go to
/admin/system/extension. You need theedit.extensionpermission; Super Admin has it. -
Find the AI Investments row — it is seeded under the internal name
ai_investmentwith the title AI Investments and product ID35988984. If the row is missing entirely, your database predates the extensions seeder; re-run the seeders rather than inserting the row by hand. -
Flip the status switch to on. The backend writes the row and clears the settings cache in the same request.
-
Reload the admin panel. The AI Investment entry under Extensions → Investment Products is gated on the extension flag, as is the AI Investment tab in the trade order form. Neither appears until the row is active.
The admin section is additionally wrapped in a licence gate keyed to
ai_investment. The header and footer render regardless, but the content of
every /admin/ai/investment page is held back until the licence check for that
extension name resolves.
If the toggle animates on and then reverts on reload, the update threw. Check the
backend log for EXTENSION. The extension flag is read from the database in
several places — the cron scheduler reads it directly rather than from cache — so
a half-written toggle produces a menu that appears and a settlement task that
never registers.
Confirm the scheduled task
Everything automatic in this product is one cron entry.
The task is registered as processAiInvestments under the ai_investment
category, with a period of one hour. Its title on screen is Process AI
Investments, described as "Processes active AI investments." It scans every
investment at ACTIVE, settles the ones whose term has expired, and leaves the
rest alone.
Go to /admin/system/cron and confirm Process AI Investments is listed. It
runs on the dedicated cron process (port 4001), not on the API process.
The registry is gated on the extension flag and re-syncs periodically, so enabling the extension schedules the job without a backend restart — and disabling it deregisters the job the same way.
Unusually for this platform, the hourly task is not the only settlement path. The
two user-facing read endpoints — the investment list and a single investment —
run the same settlement routine in-line for any matured ACTIVE investment
belonging to the caller before they return.
The practical consequence: with the cron stopped, a user who opens the AI Investments tab is paid, and a user who does not open it is not. Two people who bought the same plan on the same day can be settled days apart. Failures in the in-line path are swallowed deliberately so a broken settlement never blocks a page load, which means nothing on any screen will tell you the cron is down.
The task is safe to run repeatedly. Every payout is written through the wallet service with an idempotency key derived from the investment id and its outcome, the investment row is locked for update inside the settlement transaction, and an already-recorded payout is treated as proof the money was paid rather than as an error to retry.
Make sure a Super Admin exists
A LOSS settlement is revenue: the part of the principal the user does not get
back is credited to the wallet of the oldest user holding the Super Admin
role and recorded as platform profit.
If there is no Super Admin role, or the role exists with no users, the fee
collector logs [CRITICAL] Dropped platform fee — no Super Admin configured and
returns nothing. The settlement itself still completes — the user is paid the
correct amount — but the revenue leg is gone and there is no retry.
One more consequence worth knowing: when the investor is the Super Admin, the
revenue leg is skipped entirely rather than credited back to themselves. Testing
LOSS plans from the Super Admin account will show no platform revenue at all.
That is correct behaviour, not a bug.
WIN settlements are unaffected by any of this — they are recorded as a platform
loss and need no wallet credit.
Grant the permissions
Fifteen keys control the addon, in three families of five. Assign them at
/admin/crm/role.
| Key | Opens |
|---|---|
access.ai.investment |
The admin dashboard at /admin/ai/investment and its statistics endpoint |
view.ai.investment |
The Investment Logs table and a single investment |
create.ai.investment |
The raw investment-create endpoint |
edit.ai.investment |
The investment edit form and both status actions |
delete.ai.investment |
Deleting and restoring an investment |
access.ai.investment.plan |
The Plans screen |
view.ai.investment.plan |
The plan list and a single plan |
create.ai.investment.plan |
Creating a plan |
edit.ai.investment.plan |
Editing a plan and toggling its status |
delete.ai.investment.plan |
Deleting plans, single and bulk |
access.ai.investment.duration |
The Durations screen |
view.ai.investment.duration |
The duration list and the duration picker used by the plan form |
create.ai.investment.duration |
Creating a duration |
edit.ai.investment.duration |
Editing a duration |
delete.ai.investment.duration |
Deleting durations, single and bulk |
It looks like an edit key and it is not. The same permission gates the two status
actions, and setting an ACTIVE investment to COMPLETED pays out principal
plus profit while CANCELLED or REJECTED refunds the principal. The bulk
action does it for every row selected. Treat it as a finance-desk permission, not
a support one.
access.ai.investment.plan and access.ai.investment.duration gate the admin
pages in the frontend; the endpoints behind them check the view.* key. See
Permissions for how a key maps to an
admin path.
Set the KYC gate
One feature gate applies, enforced server-side:
| Feature | Blocks | Enforced on |
|---|---|---|
invest_ai |
Opening an investment | POST /api/ai/investment/log |
Nothing else in the addon is gated — browsing plans, reading your own investments and cancelling are all ungated.
To make the gate real you need two platform toggles, both under Admin → Settings → Features, Verification: KYC Verification on, and Enforce KYC Feature Access on. The second is off by default, so enabling verification alone changes nothing. Then tick AI Investments on each verification level that should be allowed to invest, in the level builder under Admin → CRM → KYC.
Before the 6.1.1 release AI investments carried no verification requirement at all. This is a new capability rather than a hole being closed, so switching enforcement on will lock out every user whose level does not have the feature ticked. Review every level before you do it.
The purchase panel reads the same gate client-side and replaces the form with an explanation of what is required, so a blocked user sees why rather than a failing submit.
Affiliate rewards
Two referral conditions are seeded for this addon. They only do anything if the
mlm extension is enabled and the MLM system is configured.
AI_INVESTMENT— AI Managed Portfolio Bonus. Fires when a referred user opens an investment, calculated on the invested amount. Seeded at 2% with a minimum of 25, and enabled.AI_INVESTMENT_PROFIT— AI Investment Profit Share. Seeded at 1% with a minimum of 5, and disabled. Nothing in this addon fires it: settlement deliberately does not process rewards, to avoid paying the referrer twice for the same investment. Enabling it in the affiliate conditions screen will not make it pay out.
The reward is processed after the funding transaction commits and is best-effort — a failure there is logged and never rolls back the investment.
Notification templates
Three templates are seeded and can be edited at
/admin/system/notification/template:
| Template | Sent when | Placeholders |
|---|---|---|
NewAiInvestmentCreated |
An investment is opened | FIRSTNAME, PLAN_NAME, AMOUNT, CURRENCY, DURATION, TIMEFRAME, STATUS |
AiInvestmentCompleted |
An investment settles at maturity | FIRSTNAME, PLAN_NAME, AMOUNT, PROFIT, CURRENCY, STATUS |
AiInvestmentCanceled |
Never — see below | FIRSTNAME, PLAN_NAME, AMOUNT, CURRENCY |
AiInvestmentCanceled is seeded and the email helper accepts it, but no route in
the addon sends it. A user who cancels an investment gets their refund and no
message. Neither the admin status action nor the admin delete sends anything
either.
An in-app notification is created on creation and on completion, linking to
/ai/investment/{id}. That path does not exist as a page in this build, so the
notification's action button lands on a not-found screen. The notification text
itself is still the useful part.
Setting MAIL_DISABLED=true in .env stops the platform attempting any outbound
delivery, which is worth doing while you exercise these flows — settlement emits
one completion email per investment.
Verify the install
Work through this on a staging install before you publish a plan:
- The AI Investments extension row shows as active at
/admin/system/extension - AI Investment appears under Extensions → Investment Products in the admin menu
- Process AI Investments is listed at
/admin/system/cron - A Super Admin user exists and is not the account you test with
- Your admin role holds at least
access.ai.investmentandview.ai.investment.plan -
/admin/ai/investmentloads and shows figures rather than an error card - At least one duration exists at
/admin/ai/investment/duration - At least one active plan exists at
/admin/ai/investment/plan, with durations attached - A test user sees the AI Investment tab in the order form on
/trade - A test investment on a 1 HOUR duration settles, and the wallet balance moves by the amount you expect
Then read Creating plans — two fields on the plan form decide what every investor is paid, three more are shown to users but never enter any calculation, and one of those three is a figure you have to keep accurate by hand.