> ## Documentation Index
> Fetch the complete documentation index at: https://afrizon-admin.tunzaa.co.tz/llms.txt
> Use this file to discover all available pages before exploring further.

# Set up and run an affiliate program with Meneja

> Set up and manage an affiliate program for your marketplace — track links, approve applications, and monitor commissions from a single dashboard.

Meneja's affiliate program lets you recruit and manage affiliates who promote your marketplace in exchange for a commission on the orders they drive. Affiliates apply to join your program, receive trackable links once approved, and earn commissions that you can monitor through the analytics dashboard. As an admin, you control who joins the program, review vendor partnership requests, and have full visibility into link performance.

## Affiliate profiles

Each affiliate in your program has a profile that captures their contact details, payout information, and verification status.

| Field                    | Type    | Description                                                     |
| ------------------------ | ------- | --------------------------------------------------------------- |
| `name`                   | string  | Display name of the affiliate                                   |
| `email`                  | string  | Contact email address                                           |
| `phone`                  | string  | Contact phone number                                            |
| `bio`                    | string  | Short description of the affiliate                              |
| `website`                | string  | Affiliate's website URL                                         |
| `social_media`           | object  | Instagram, Twitter, and Facebook handles                        |
| `bank_account`           | object  | Bank name, account number, account name, SWIFT/BIC, branch code |
| `verification_documents` | array   | KYC documents submitted for identity verification               |
| `status`                 | enum    | `pending`, `approved`, or `rejected`                            |
| `is_active`              | boolean | Whether the affiliate is currently active                       |
| `rejection_reason`       | string  | Populated when status is `rejected`                             |

### Verification documents

Affiliates submit verification documents during the application process. Each document record includes:

| Field              | Description                                                   |
| ------------------ | ------------------------------------------------------------- |
| `document_type`    | Category of the document (e.g. national ID, business license) |
| `document_url`     | Hosted URL of the uploaded file                               |
| `status`           | `pending`, `approved`, or `rejected`                          |
| `rejection_reason` | Reason provided when a document is rejected                   |
| `submitted_at`     | Timestamp of submission                                       |
| `verified_at`      | Timestamp when the document was reviewed                      |

<Info>
  Accepted document formats are JPG, JPEG, PNG, WEBP, and PDF. The maximum file size per document is 5 MB.
</Info>

## Affiliate links

Once you approve an affiliate, they receive trackable affiliate links. Each link is scoped to a specific vendor and product.

| Field              | Description                                     |
| ------------------ | ----------------------------------------------- |
| `code`             | Unique tracking code embedded in the link       |
| `vendor_id`        | The vendor this link is associated with         |
| `product_id`       | The product being promoted                      |
| `clicks`           | Total number of times the link has been visited |
| `orders`           | Number of orders attributed to this link        |
| `total_commission` | Cumulative commission earned through this link  |
| `is_active`        | Whether the link is currently accepting traffic |
| `expiry_date`      | Optional expiration date for the link           |

## Affiliate requests

Affiliates can submit requests — for example, to partner with a specific vendor. Each `AffiliateRequest` record tracks the full lifecycle of that request.

| Field              | Description                                  |
| ------------------ | -------------------------------------------- |
| `request_type`     | Category of the request                      |
| `vendor_id`        | The vendor the request is directed at        |
| `product_id`       | Optional product associated with the request |
| `status`           | `pending`, `approved`, or `rejected`         |
| `message`          | Message from the affiliate                   |
| `response_message` | Your response when approving or rejecting    |
| `responded_at`     | Timestamp of your response                   |

## Analytics

The analytics dashboard gives you a program-wide view of performance.

<CardGroup cols={2}>
  <Card title="Total clicks" icon="cursor-arrow-rays">
    The combined number of clicks across all active affiliate links.
  </Card>

  <Card title="Total orders" icon="bag-shopping">
    Orders placed through affiliate links across your program.
  </Card>

  <Card title="Total commission" icon="coins">
    The sum of all commissions earned by affiliates to date.
  </Card>

  <Card title="Conversion rate" icon="chart-line">
    The ratio of orders to clicks, expressed as a percentage.
  </Card>
</CardGroup>

The **Top affiliates** list surfaces your highest-performing affiliates by commission earned, showing their name, email, total commission, and order count.

The affiliate status breakdown shows how many affiliates are `pending`, `approved`, and `rejected` at a glance.

## Vendor partner requests

`VendorPartnerRequest` records represent partnerships between an affiliate and a vendor. Each record includes:

| Field             | Description                                                |
| ----------------- | ---------------------------------------------------------- |
| `vendor_id`       | ID of the vendor in the partnership                        |
| `vendor_name`     | Display name of the vendor                                 |
| `commission_rate` | Agreed commission rate for this partnership                |
| `status`          | `pending`, `approved`, `rejected`, `active`, or `inactive` |
| `joined_at`       | Date the partnership became active                         |

## Approving and rejecting affiliates

When a new affiliate applies, their status is `pending`. You review their profile and verification documents before making a decision.

<Steps>
  <Step title="Open the Affiliates list">
    Navigate to **Growth Tools → Affiliates** in the sidebar. The list defaults to showing pending applications at the top.
  </Step>

  <Step title="Review the applicant's profile">
    Click an affiliate to open their profile. Check their contact details, social media handles, bank account information, and any uploaded verification documents.
  </Step>

  <Step title="Review verification documents">
    Expand the **Verification documents** section. For each document, confirm it matches the declared `document_type` and is legible. Documents are individually marked as `pending`, `approved`, or `rejected`.
  </Step>

  <Step title="Approve or reject the application">
    Use the **Approve** or **Reject** action on the affiliate's profile.

    * **Approve** sets the affiliate's status to `approved` and stamps `approved_at`.
    * **Reject** sets the status to `rejected`. Enter a `rejection_reason` so the affiliate understands why their application was declined.
  </Step>

  <Step title="Manage affiliate requests">
    Once an affiliate is active, they may submit `AffiliateRequest` records — for instance, to promote a specific vendor's products. Open **Affiliate Requests**, review the request's `message`, then approve or reject it. Add a `response_message` to communicate your decision.
  </Step>
</Steps>

<Warning>
  Rejecting an affiliate does not delete their record. You can reverse a rejection by updating their status to `approved` at any time.
</Warning>

## Activating and deactivating affiliates

Approved affiliates can be temporarily deactivated without changing their `status`. Set `is_active` to `false` to pause their links and exclude them from analytics without revoking their approval. Set it back to `true` to resume.

<AccordionGroup>
  <Accordion title="What happens to affiliate links when an affiliate is deactivated?">
    Links belonging to a deactivated affiliate have their `is_active` flag set to `false`, which stops them from generating tracked traffic. Existing click and order data is preserved.
  </Accordion>

  <Accordion title="Can an affiliate belong to multiple vendors?">
    Yes. A single affiliate can hold multiple `VendorPartnerRequest` records, each with a different `vendor_id` and its own `commission_rate`.
  </Accordion>

  <Accordion title="How is commission calculated?">
    Commission is accumulated per affiliate link and stored in `total_commission` on the `AffiliateLink` record. The specific calculation logic is configured at the vendor partnership level via `commission_rate`.
  </Accordion>
</AccordionGroup>
