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

# Payouts

> How creator payouts are calculated and processed

Payouts compensate creators for their content placements based on campaign rates and performance.

## Payout structure

### Pay period

* **Cycle:** Friday to Thursday (weekly)
* **Processing:** Following business day

### Calculation

```
Placements count × PPP rate = Total payout
```

Where:

* **Placements count** - Number of posts in the period
* **PPP rate** - Pay per post rate

## Rate hierarchy

Payout rate is determined by:

```
Campaign ppp_rate (if set)
  → Contract pay_per_post (fallback)
```

### Campaign rate

Set per-campaign when rates vary by initiative.

### Contract rate

Default rate for all campaigns under a contract.

## Payout export

Admins export payouts via the admin console.

### Export contents

| Field         | Description            |
| ------------- | ---------------------- |
| Creator name  | Full name              |
| Creator email | Payment email          |
| Brand         | Brand name             |
| Program       | Campaign name          |
| Post URL      | Direct link to content |
| Views         | View count             |
| Upload date   | When posted            |
| Amount        | Calculated payout      |

### Export format

CSV with:

* One row per placement
* Summary row per creator/campaign
* Totals at bottom

### Sync warnings

Export includes warnings for:

* Creators with sync issues
* Missing metrics data
* Attribution problems

## Deduplication

Posts are deduped to prevent double-counting:

| Platform  | Dedup key                             |
| --------- | ------------------------------------- |
| Instagram | `/p/CODE` or `/reel/CODE` → `ig:CODE` |
| TikTok    | `/video/ID` → `tt:ID`                 |
| YouTube   | Video ID                              |
| Facebook  | Post ID                               |

Same post never counts twice across:

* Multiple syncs
* Different social accounts
* Payout periods

## Brand hub display

Creators see payout information on their brand hub:

### Placements bar

Visual progress toward targets:

```
[██████████░░░░░░░░░░] 45/100 placements
```

### Paid amounts

<Warning>
  Paid amounts display is currently placeholder. Full payout system integration is in progress.
</Warning>

## Gamified pay display

Brand deals show gamified compensation:

### Base pay

Count-up animation on deal cards showing base rate.

### Bonus prizes

Top-3 cash bonuses per brand:

* 1st place: \$X
* 2nd place: \$Y
* 3rd place: \$Z

Prizes are admin-editable per brand.

## Processing workflow

<Steps>
  <Step title="Period closes">
    Thursday 11:59pm marks end of pay period
  </Step>

  <Step title="Export generated">
    Admin generates payout export CSV
  </Step>

  <Step title="Review">
    Review for anomalies, sync warnings
  </Step>

  <Step title="Process payment">
    Submit to payment processor (external)
  </Step>

  <Step title="Confirm">
    Update records as paid (manual)
  </Step>
</Steps>

## Troubleshooting

| Issue            | Check                                |
| ---------------- | ------------------------------------ |
| Missing posts    | Sync completed? Attribution correct? |
| Wrong rate       | Check campaign vs contract PPP       |
| Duplicate payout | Verify dedup working                 |
| Zero amount      | Rate set? Posts in period?           |

## Backend implementation

**Key files:**

* `app/services/payouts/` - Payout calculations
* `app/services/creator_campaigns/hub_serializer.rb` - Hub display
* `app/controllers/api/internal/payouts_controller.rb` - Export API

## Future enhancements

Planned payout improvements:

* Real-time payout display to creators
* Automatic payment processing
* Payment history in app
* Tax document generation
