# Revenue mode

How Trinity turns offers, acquisition runs, orders, approvals, revenue, and spend into auditable operations.

Status: implemented
Version: latest
Review: source-backed

## Production revenue loop

Revenue mode connects offer pages, Stripe checkout, signed webhooks, customers, orders, deal updates, order intakes, acquisition runs, revenue events, spend events, and proof ledger rows.

| Record | Created from | Operational purpose |
| --- | --- | --- |
| Offer | Public product configuration or owner workflow | Defines what can be purchased |
| CheckoutSession | Stripe checkout creation | Links buyer intent to offer/order metadata |
| StripeWebhookEvent | Signed Stripe event | Makes webhook processing replay-safe and inspectable |
| Order | Completed payment or accepted order intake | Converts payment into work |
| RevenueEvent | Idempotent payment processing | Links money to CRM and ledger proof |
| Deal | Built-in CRM | Shows stage, amount, owner, and account context |
| OrderIntake | Paid/approved work request | Launches acquisition fulfillment |
| AcquisitionRun | Project/runtime context | Gives Hermes a bounded operation to complete |
| Ledger entry | Revenue/tool/model/audit records | Explains what happened without exposing secrets |

## Agent role

Hermes can help draft outreach, prepare payment links, summarize lead context, recommend next steps, and package acquisition deliverables. It does not own payment authority. Stripe creates the payment event, Phoenix validates and persists the event, and ToolRouter/approvals govern any external action.

Operators can trace a buyer path from public page to checkout return, Order, RevenueEvent, Deal, RunEvent, ToolCall, ApprovalRequest, and AuditEvent without exposing private customer data.

## Guardrails

| Guardrail | Why it exists |
| --- | --- |
| Signed webhook verification | Prevents spoofed revenue events outside explicit test bypass |
| Idempotent event processing | Prevents duplicate orders/revenue rows on webhook retry |
| CRM source of truth | Keeps HubSpot optional rather than required |
| Approval-gated spend | Allows future agent purchasing without uncontrolled charges |
| Sample/live labels | Prevents demo records from being presented as real revenue proof |


Source paths:
- `lib/autonomous_agency/revenue.ex`
- `lib/autonomous_agency/acquisition.ex`
- `lib/autonomous_agency/orders.ex`
