The attribution chain
Every conversion follows this path:Click tracking
When a visitor clicks an affiliate’s referral link, AgentRef’s tracking script handles attribution automatically:-
Referral link redirect. The visitor clicks a link like
https://www.agentref.co/r/abc123. AgentRef resolves the affiliate code, records the click, and redirects to the target URL. -
Cookie placement. The tracking script sets first-party cookies on your domain:
agentref_cid– a click identifier for conversion matchingagentref_src– the traffic sourceagentref_pid– the active program ID
- Cookie duration. Cookies persist for your configured duration (default: 30 days). If a visitor returns within that window and converts, the affiliate still gets credit.
- Click deduplication. Multiple clicks from the same visitor within a short window are deduplicated to prevent inflated metrics.
The tracking script is a lightweight, first-party JavaScript snippet that runs on your domain. It does not use third-party cookies or fingerprinting.
Conversion attribution
When a tracked visitor makes a purchase, AgentRef connects the sale to the affiliate:-
Stripe webhook. After a successful payment, Stripe sends a
checkout.session.completed(orinvoice.paidfor subscriptions) webhook to AgentRef. -
Metadata matching. AgentRef looks for the
agentref_cidin the Stripe session metadata. This links the payment back to the original click. -
Conversion record. A conversion is created with status
pending. It includes the revenue amount, the affiliate ID, and the click that drove the sale. - Last-click attribution. If multiple affiliates drove clicks for the same visitor, the most recent click before conversion wins. This is the industry-standard attribution model.
How metadata flows into Stripe
For Stripe Payment Links, Buy Buttons, and Pricing Tables, the tracking script automatically instruments the hosted Stripe surface with the click token viaclient_reference_id – no server code needed.
For server-created Checkout Sessions, you read the metadata from the tracking script on the client side and pass it to your server:
Commission calculation
Once a conversion is recorded, AgentRef calculates the affiliate’s commission based on your program settings:
Commissions are calculated in the currency of the Stripe payment. AgentRef supports multi-currency programs.
Fraud detection
Every conversion passes through automated fraud checks before commissions are approved:- Duplicate click detection. Flags unusual click patterns from the same IP or device within a short timeframe.
- Self-referral detection. Catches affiliates who try to refer themselves by matching affiliate identity against the buyer.
- Suspicious conversion patterns. Identifies statistically unusual spikes in conversions that deviate from an affiliate’s normal baseline.
- Geographic anomalies. Flags when click geography and conversion geography don’t match expected patterns.
review_flag tool.
Payouts
When an affiliate’s approved commissions reach the payout threshold, they become eligible for payout:- Threshold check. Default payout threshold is $50 (configurable per program). Commissions accumulate until this amount is reached.
- Payout schedule. Payouts are processed on your configured frequency: weekly, monthly, or quarterly.
- Payout execution. AgentRef creates the payout record and handles the commission state transitions. You complete the actual payment through your preferred method (Stripe, PayPal, Wise, bank transfer).
-
CSV export. For bulk payouts, export a CSV in PayPal, Wise, SEPA, or generic format using the MCP
export_payouts_csvtool.
Conversion status flow
Every conversion moves through a defined lifecycle:- Pending – Conversion recorded, awaiting fraud checks and approval window.
- Approved – Passed all checks. Commission is locked in and counts toward payout.
- Rejected – Failed fraud checks or manually rejected by merchant.
- Paid – Commission has been included in a completed payout.
- Partially refunded – Part of the Stripe payment was refunded. Commission is reduced proportionally.
- Refunded – The original Stripe payment was fully refunded. Commission is reversed.
Integration points
AgentRef provides multiple ways to integrate with your stack:Next steps
Quickstart
Set up your first program in 5 minutes.
Agent Setup
Connect AgentRef to your AI assistant via MCP.