Quickstart: Launch Your Partner Program

Configure a commission rate, onboard affiliates with discount-code attribution, and process payouts through the self-service Portal — the full setup in 6 steps, in under 15 minutes.

1

Create an Affiliate Program

FieldWhat it controlsCommon values
NameWhat you (and, via the Portal, the affiliate) see"Gold Partners", "Influencer Affiliates"
DescriptionInternal notes on the program's purposeFree text
ActiveWhether the program is currently accepting new commission activityOn / off
Commission type`percentage` (of order total) or `fixed_amount`Percentage is standard for most e-commerce
Commission valueFor percentage: e.g. `10` means 10%. For fixed: cents value10, 500 (=$5.00)
Cookie daysAttribution bookkeeping window in days (`0` = no expiry)30 (default)
2

Add Affiliates — Attribution Runs Through Discount Codes

Aeion Affiliates doesn't track referral clicks or cookies against a ?ref= URL parameter. Instead, an affiliate's tracking code is a Discounts promo code with the affiliate's ID attached to its metadata. When a customer applies that code at checkout, the commission is attributed automatically.

Add an affiliate:

typescript const affiliate = await aeion.api.post("/v1/affiliates", { userId: "usr_acme_influencer", programId: program.id, code: "ACME25", status: "active", payoutMethod: "bank_transfer", // free-text — whatever your finance team uses payoutDetails: { accountRef: "acct_..." }, });

Link a matching discount code (Admin → Marketing → Discounts, or via the Discounts API) with:

  • code: the same value as the affiliate's code (e.g., ACME25)
  • metadata.affiliateId: the affiliate's record ID

Once linked, every order where a customer applies ACME25 at checkout fires a discounts.usage.recorded event; the Affiliates module looks up the promo code's metadata.affiliateId, calculates commission from the affiliate's program (commissionType / commissionValue against the order total), and writes a commission entry to that affiliate's ledger — no manual bookkeeping required.

3

Understand Commission Calculation + Refunds

Commission is computed automatically when a discount-linked order comes through:

  • Percentage programs: commission = round(orderTotal × commissionValue / 100)
  • Fixed-amount programs: commission = commissionValue (flat, regardless of order size)

Both the affiliate's running balance and totalEarned update immediately, and a commission row lands in affiliate_ledger.

Refunds claw back automatically. If the original order is refunded (commerce.order.refunded), the module finds the matching commission ledger entry and reverses it — no manual balance correction needed.

4

Process Payouts

Payouts aren't wired to a payment processor automatically — payoutMethod is a free-text field you set per affiliate (bank transfer, PayPal, check, whatever your finance process uses), and payout requests land as pending ledger entries for your team to clear.

Affiliate-initiated request (from the Portal):

typescript await aeion.api.post("/v1/affiliates/portal/payout-request", { amount: 15000, // cents — guarded against requesting more than (balance − already-pending) });

This creates a pending payout entry in the ledger. It does not decrement the affiliate's balance yet — that happens when an admin clears the entry.

Admin-initiated payout (Admin → Affiliates → Dashboard):

typescript await aeion.api.post("/v1/affiliates/dashboard/payout", { affiliateId: affiliate.id, amount: 15000, method: "bank_transfer", });

Clearing a payout is a manual step in your own finance workflow — Aeion tracks the ledger; it doesn't move money.

5

Give Affiliates Their Portal

Every affiliate can view their own record, ledger, and stats through a lightweight self-service Portal, scoped to their own userId — one affiliate can never see another's data.

typescript const { data } = await aeion.api.get("/v1/affiliates/portal/me"); // data.affiliate — their affiliate record // data.ledger — their last 100 ledger entries // data.stats — { totalEarned, pendingBalance, conversions, clearedCommissions }

From there they can call POST /v1/affiliates/portal/payout-request to request a payout against their available balance.

6

Monitor with AI Agents + the Admin Dashboard

Three purpose-built AI agents ship with the module — each honors the platform's honest-fallback contract (if no AI provider is configured, they say so rather than fabricating a result):

  • Compliance Agent (fraud detection) — auto-triggers on every new affiliate_ledger entry. Scores fraud risk and recommends an action (hold_payout, manual_review, suspend_affiliate, clear), writing to fraudScore + aiFlagged + aiFraudAnomalies so the admin's "Suspicious" segment reflects ground truth from day one.
  • Recruiting Agent (partner-fit scoring) — operator-initiated. Scores how strong a fit a partner is and recommends a tier (bronze / silver / gold / vip) based on identity + earnings signal + program context. Writes to matchScore + aiSuggestedTier. This is a recommendation for you to review, not an automatic rate change.
  • Affiliate Manager Agent (commission optimization) — operator-initiated. Analyzes a program's recent ledger performance and recommends a commission-rate adjustment (raise / lower / hold) with reasoning and expected impact. Requires your explicit approval before the new rate is applied — commission changes affect what partners get paid.

Admin → Affiliates → Dashboard surfaces:

  • KPI stats — total + active affiliates, total earned, pending payouts (amount + count), commissions this month vs. last month (with trend %), active/total programs
  • Top performers — ranked by earnings
  • Recent ledger — latest commission / payout / adjustment entries across all affiliates
  • Commissions trend — month-over-month commission volume

Integration Recipes

Discounts → affiliate attribution. This is the core attribution mechanism, not an optional add-on: link a Discounts promo code to an affiliate via metadata.affiliateId, and every order that applies the code fires commission calculation automatically.

CRM linkage. Affiliates are tied to a userId — the same identity your CRM already tracks, so account-management activity and commission history can be cross-referenced from the same user record.

Compliance-first fraud review. The Compliance Agent flags suspicious ledger entries automatically; pair with the Sentinel module if you want broader anomaly monitoring across self-referrals or unusual order-velocity patterns at the commerce layer.

Multi-program partner networks. A tenant can run several active programs simultaneously — e.g., separate percentage-based and fixed-amount programs for different partner types — with dashboard KPIs rolling up across all of them.

Troubleshooting

Affiliate says their order wasn't attributed. Attribution runs through the linked Discounts promo code, not a URL parameter or cookie. Confirm: (1) the customer actually applied the discount code at checkout, (2) the promo code's metadata.affiliateId matches the affiliate record, (3) the affiliate's status is active (inactive affiliates don't accrue commission), (4) the affiliate's program has isActive: true.

Commission amount looks wrong. Check the program's commissionTypepercentage commission is computed against the full order total passed into processOrder; fixed_amount pays the same amount regardless of order size. There's no attribution-basis toggle (subtotal vs. total) — the order total used is whatever the calling event passed in.

Payout request rejected. Payout requests are guarded against exceeding balance − already-pending-requests, so a chain of requests can't overdraw the affiliate's account. Check the Portal stats (pendingBalance) before requesting.

Duplicate commission on a refunded order. Refund clawback looks for a commission-type ledger entry matching the orderId. If none is found (e.g., the order was never attributed), no reversal happens — check the ledger for the original entry.

AI agent recommendation not appearing. All three agents (Compliance, Recruiting, Affiliate Manager) are honest no-ops if no AI provider is configured for the tenant — check Admin → AI → Providers first. The Affiliate Manager and Recruiting agents are operator-initiated, not automatic; trigger them from the relevant record's workflow actions.

Frequently Asked Questions

Every affiliate can call `GET /v1/affiliates/portal/me` to see their own record, ledger (last 100 entries), and derived stats (total earned, pending balance, conversions, cleared commissions) — scoped strictly to their own `userId`.

An affiliate links to one program at a time via `programId`. To move them to a different program, update that field — historical ledger entries stay attributed to whatever program was active when they were earned.

Automatically. When `commerce.order.refunded` fires, the module finds the matching commission ledger entry for that `orderId` and reverses it. If no matching entry exists, nothing happens (the order was never attributed to an affiliate).

Discount-code attribution, not URL-click/cookie tracking. An affiliate's tracking code is a Discounts promo code with `metadata.affiliateId` set; when a customer applies that code at checkout, a `discounts.usage.recorded` event triggers commission calculation.

Not as an automated rule today — each program has exactly one `commissionType` (`percentage` or `fixed_amount`) and one `commissionValue`. The Recruiting Agent can recommend a tier label (bronze/silver/gold/vip) per affiliate based on performance, and the Affiliate Manager Agent can recommend a rate change for a whole program, but both require your explicit approval to apply — there's no self-adjusting tier ladder.

`payoutMethod` and `payoutDetails` are free-text/JSON fields you set per affiliate — Aeion doesn't integrate with a payment processor for payouts. Affiliates can self-request a payout (guarded against overdrawing their balance) via the Portal; your team clears it manually using whatever payment rail you already use.

There's no public self-serve signup flow — affiliates are added directly (Admin → Affiliates → New, or via the API), which is effectively invite-only by default.

The Compliance Agent runs automatically on every new ledger entry, scoring fraud risk and recommending an action (hold payout, manual review, suspend, clear). It's LLM-backed and honest about it — if no AI provider is configured for your tenant, it says so rather than fabricating a score.

Not currently — since payouts route through your own payment method rather than a built-in processor, tax-form generation and VAT reporting are your responsibility today.

Ready to grow through partners?