# Run an affiliate program for your store

> Let your shoppers share the store and earn a commission on the orders they bring, then pay them, send their rewards and set the program's rates.

Source: https://www.coritan.com/docs/organizations/commerce/affiliates/

In the dashboard:

- /dashboard/organizations/…/commerce/affiliates: https://www.coritan.com/dashboard/organizations

**Affiliates** runs the store's affiliate program. A shopper with an account on your storefront joins it and gets a code. When an order is credited to them, through their link, their code or a coupon you gave them, they earn a commission on it: a referral. You pay what they earned outside Coritan and record it here, and every few paid referrals can earn them a reward item they claim from their affiliate page.

The section has five views, in the strip under the store's tabs: **Affiliates**, **Referrals**, **Payouts**, **Claims** and **Program**.

## Before you begin

- The program is off until you turn it on under **Program**. You need the Admin role to change the program, Tier 1 support or higher to see affiliates, referrals, payouts and claims, and Tier 3 support or higher to change them. Linking a coupon lists the store's promotions, which needs the Admin role.
- Your storefront has to serve the referral links, keep the code on the cart and give shoppers an affiliate page. [Run an affiliate program](/docs/organizations/storefront/store-api/#run-an-affiliate-program) in the Store API guide shows each call.
- To give an affiliate a coupon, create a promotion with a code first in [Discounts](/docs/organizations/commerce/discounts/).

## Set up the program

Open **Program**, change what you need and select **Save changes**.

**Run the affiliate program**
: On, shoppers can join and credited orders earn a commission. Off, nobody can join and no new order earns anything. Affiliates and what they already earned stay either way.

**On a shopper's first order** and **On later orders**
: The commission rates, as a percentage from 0 to 100 with up to two decimals. A first order is the first one the store has from that email address.

**Keep referred shoppers for life**
: A shopper an affiliate referred stays theirs: each later order is credited to them without their link or code.

**A referral link counts for**
: How many days the storefront keeps an affiliate's code after a shopper follows their link, from 1 to 36,500.

**Credit nothing to orders from paid ads**
: An order whose cart the storefront marked as coming from a paid ad earns no commission, so an affiliate cannot buy ads on your store's own name. It is on by default.

**One reward every**
: How many qualified referrals earn one reward. A referral qualifies once its order is paid. Set it to 0 for no rewards. With rewards on, choose the items an affiliate may pick under **Reward items**. Gift cards cannot be rewards.

Minimum payout
: The least a payout may be in each of the store's currencies. Leave a currency empty for no minimum.

## How an order is credited

An order is credited to one affiliate at most, the first of these that applies:

1. The affiliate whose coupon the order used.
2. The affiliate whose code the storefront saved on the cart, from their referral link.
3. With **Keep referred shoppers for life** on, the affiliate who first referred the shopper's email address.

Nothing is credited when the affiliate is the shopper, by their customer account or their email, or when paid ads are blocked and the cart came from one. An affiliate who is turned off is skipped.

The commission is the rate applied to what the order's items cost after discounts. Tax, shipping, fees, gift card payments and gift cards sold are left out. It is in the order's currency.

## Referral statuses

| Status | What it means |
| --- | --- |
| Draft | The order was placed and is not paid yet. |
| Unpaid | The order is paid, and the store owes the commission. |
| Paid | A payout you recorded covers it. |
| Rejected | The order was cancelled or refunded in full, or you rejected it. |

A referral that was paid stays paid if its order is refunded later: that money already went to the affiliate.

## Manage an affiliate

**Affiliates** lists everyone who joined, with their code, clicks, qualified orders and what the store owes them. Search by email or code, or filter by status. Select a row to open the affiliate. Their page shows their referrals, payouts and claims, and the menu next to **Record payout** holds the changes:

- **Change code** gives them a new code, 3 to 32 letters, digits and hyphens. Links and carts with the old code stop crediting them. Shoppers they referred for life stay theirs.
- **Link a coupon** makes one of the store's coded promotions theirs: any order that uses it is credited to them. A coupon belongs to one affiliate at a time.
- **Turn off** stops new orders being credited to them and stops them claiming rewards. What they earned stays, and you can still pay it. **Turn on** turns them back on.

## Reject or restore a referral

On **Referrals**, or on an affiliate's page, open a referral's menu and choose **Reject referral** to take its commission off what the store owes. **Restore referral** makes a rejected referral unpaid again. A paid referral cannot change. Filter the list by status or by affiliate to find one.

## Record a payout

A payout is a record of money you already sent. Coritan does not send it.

1. Pay the affiliate by bank transfer, PayPal or however you agreed.
2. Select **Record payout**, on the affiliate's page or on **Payouts**.
3. Choose the affiliate if you started from **Payouts**, and the currency if they have unpaid referrals in more than one.
4. Select the referrals the payout covers. Every unpaid referral starts selected, and the total fills in.
5. Add the method and the transfer's reference so you can find it later.
6. Select **Record payout**, type the amount to confirm, and select **Record payout** again.

The referrals become paid. A payout below the program's minimum in its currency is refused. A recorded payout cannot be changed or removed.

## Answer a reward claim

**Claims** opens on the claims waiting for an answer, and the tab shows how many there are. Select **Review** on a claim to see the item and the address to ship it to.

- **Approve claim**, then ship the item yourself.
- **Reject claim** with a note that says why. The affiliate gets the reward back and can claim again.
- Once the item is on its way, open the claim again and select **Mark shipped**. Add the tracking number as a note.

## Webhooks

An organization webhook can receive `commerce.affiliate.referral.created` when an order is credited, `commerce.affiliate.referral.updated` when a referral changes status, and `commerce.affiliate.claim.created` when an affiliate claims a reward. [Receive commerce webhooks](/docs/organizations/storefront/commerce-api/#receive-commerce-webhooks) explains how to add one and check its signature.

## API

- `GET /api/v1/orgs/{org_slug}/commerce/affiliates`: Newest first, each with its clicks, qualified orders and earnings (https://www.coritan.com/docs/api/reference/organizations/commerce/commerce/#op-get-api-v1-orgs-org-slug-commerce-affiliates)
- `GET /api/v1/orgs/{org_slug}/commerce/affiliates/claims`: Reward claims, newest first, by status and affiliate (https://www.coritan.com/docs/api/reference/organizations/commerce/commerce/#op-get-api-v1-orgs-org-slug-commerce-affiliates-claims)
- `PATCH /api/v1/orgs/{org_slug}/commerce/affiliates/claims/{claim_id}`: Approve or reject a requested claim, or mark an approved one shipped (https://www.coritan.com/docs/api/reference/organizations/commerce/commerce/#op-patch-api-v1-orgs-org-slug-commerce-affiliates-claims-claim-id)
- `GET /api/v1/orgs/{org_slug}/commerce/affiliates/payouts`: The payouts the merchant recorded, newest first, for one affiliate or all of them (https://www.coritan.com/docs/api/reference/organizations/billing-payouts/commerce/#op-get-api-v1-orgs-org-slug-commerce-affiliates-payouts)
- `GET /api/v1/orgs/{org_slug}/commerce/affiliates/program`: The affiliates store setting with every default filled in (https://www.coritan.com/docs/api/reference/organizations/commerce/commerce/#op-get-api-v1-orgs-org-slug-commerce-affiliates-program)
- `GET /api/v1/orgs/{org_slug}/commerce/affiliates/referrals`: The store's referrals, newest first, by affiliate and status; every filter is in the query (https://www.coritan.com/docs/api/reference/organizations/commerce/commerce/#op-get-api-v1-orgs-org-slug-commerce-affiliates-referrals)
- `PATCH /api/v1/orgs/{org_slug}/commerce/affiliates/referrals/{referral_id}`: Reject a referral, or restore one to unpaid (https://www.coritan.com/docs/api/reference/organizations/commerce/commerce/#op-patch-api-v1-orgs-org-slug-commerce-affiliates-referrals-referral-id)
- `GET /api/v1/orgs/{org_slug}/commerce/affiliates/{affiliate_id}`: One affiliate with its earnings, rewards and lifetime customers; 404 for another store's (https://www.coritan.com/docs/api/reference/organizations/commerce/commerce/#op-get-api-v1-orgs-org-slug-commerce-affiliates-affiliate-id)
- `PATCH /api/v1/orgs/{org_slug}/commerce/affiliates/{affiliate_id}`: Change an affiliate's status, code or coupon (https://www.coritan.com/docs/api/reference/organizations/commerce/commerce/#op-patch-api-v1-orgs-org-slug-commerce-affiliates-affiliate-id)
- `POST /api/v1/orgs/{org_slug}/commerce/affiliates/{affiliate_id}/payouts`: Record a payout the merchant made; the referrals it names become paid (https://www.coritan.com/docs/api/reference/organizations/billing-payouts/commerce/#op-post-api-v1-orgs-org-slug-commerce-affiliates-affiliate-id-payouts)
