Skip to main content
Experimental. This Module has no test or production evidence recorded yet. Read it, run it locally, and hold off on real Orders. See maturity levels.
The Affiliates Module runs an affiliate program inside your Store: partners apply through your Storefront, you approve them with a commission rate, and they share tracking links. When a referred visitor buys, the Module records a conversion and calculates the commission. You review conversions in Store Admin and issue payouts up to each affiliate’s available balance.

Installation

Add the Module to your store configuration:

Configuration

string
default:"\"10\""
Default commission percentage applied to newly approved affiliates. For example, "10" means 10% of the referred Order total.
string
default:"\"50\""
Minimum payout amount in your store’s currency. Affiliates cannot receive a payout below this threshold.
How long the referral tracking cookie persists (in days). Conversions attributed after this window are not credited to the affiliate.

How it works

1

Apply

Anyone submits an application via POST /affiliates/apply with their name, email, and optional website. Their account starts in pending status.
2

Approve

Review the application and approve it, optionally with a custom commission rate. The affiliate’s status moves to approved.
3

Create tracking links

Approved affiliates create tracking links via POST /affiliates/links/create. Each link gets a unique 10-character slug for URL tracking.
4

Track clicks

When a visitor clicks an affiliate link, POST /affiliates/track records the click and increments both the link’s click count and the affiliate’s total click count.
5

Record conversions

When a tracked visitor completes a purchase, the Module records a conversion and calculates commission as orderAmount × (commissionRate / 100).
6

Approve conversions

Review each conversion and approve it. Approval updates the affiliate’s aggregate totals: conversions, revenue, and commission.
7

Issue payouts

Create a payout up to the affiliate’s available balance (totalCommission − totalPaid). Marking a payout complete updates totalPaid.

Store endpoints

Submit an application (POST /affiliates/apply)

Each affiliate receives a unique 8-character tracking code on application.

Admin endpoints

Payouts cannot exceed an affiliate’s available balance (totalCommission − totalPaid). Attempting to create an overdraft returns null from the controller.

Types