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

# Refer-a-friend

> Create viral refer-a-friend campaigns with double-sided rewards

## Overview

Refer-a-friend programs are a specific type of referral program where both the referrer AND the referred friend receive rewards. This double-sided incentive creates viral growth loops.

## How It Works

```mermaid theme={null}
flowchart TD
    A[Customer Shares Link] --> B[Friend Clicks Link]
    B --> C[Friend Signs Up]
    C --> D[Friend Gets Welcome Bonus]
    C --> E[Friend Makes Purchase]
    E --> F[Referrer Gets Reward]
    E --> G[Friend Gets Reward]
```

## Setting Up Refer-a-Friend

### Step 1: Create the Program

1. Navigate to **Programs → Create Program**
2. Select **Refer-a-Friend Program**
3. Configure your program name and branding

### Step 2: Configure Double-Sided Rewards

Set up rewards for both parties:

```json theme={null}
{
  "referrer_reward": {
    "type": "credit",
    "amount": 20,
    "trigger": "friend_first_purchase"
  },
  "friend_reward": {
    "type": "discount",
    "amount": 20,
    "unit": "percentage",
    "trigger": "signup"
  }
}
```

### Common Reward Configurations

<AccordionGroup>
  <Accordion title="Give $20, Get $20">
    Classic double-sided cash/credit reward.

    * **Referrer**: \$20 account credit on friend's purchase
    * **Friend**: \$20 off first order
  </Accordion>

  <Accordion title="Percentage Discounts">
    Give discount percentages to both parties.

    * **Referrer**: 25% off next order
    * **Friend**: 25% off first order
  </Accordion>

  <Accordion title="Free Month">
    Great for subscription products.

    * **Referrer**: 1 month free
    * **Friend**: 1 month free trial
  </Accordion>
</AccordionGroup>

## Embeddable Signup Forms

### Pop-up Form

Add a pop-up signup form to your website:

```html theme={null}
<script>
  po('showReferralPopup', {
    program_id: 'YOUR_PROGRAM_ID',
    trigger: 'exit_intent', // or 'delay', 'scroll', 'click'
    delay: 5000 // if using delay trigger
  });
</script>
```

### Embedded Form

Embed a signup form directly in your page:

```html theme={null}
<div id="refer-friend-form"></div>

<script>
  po('renderReferralForm', {
    container: '#refer-friend-form',
    program_id: 'YOUR_PROGRAM_ID',
    customer_key: 'CURRENT_CUSTOMER_KEY' // optional
  });
</script>
```

## API Integration

### Register a Referral

When a friend signs up through a referral:

```bash theme={null}
curl -X POST https://api.partnero.com/v1/pub_api/refer-a-friend/{program_id}/activate \
  -H "Content-Type: application/json" \
  -d '{
    "email": "friend@partnero.com",
    "name": "Friend Name",
    "referral_code": "JANE20"
  }'
```

### Check Referral Status

```bash theme={null}
curl -X GET https://api.partnero.com/v1/customers/cust_123/referrals \
  -H "Authorization: Bearer YOUR_API_KEY"
```

Response:

```json theme={null}
{
  "referrals": [
    {
      "email": "friend@partnero.com",
      "status": "converted",
      "reward_status": "paid",
      "created_at": "2024-01-15T10:30:00Z"
    },
    {
      "email": "friend2@partnero.com", 
      "status": "pending",
      "reward_status": "pending",
      "created_at": "2024-01-20T14:00:00Z"
    }
  ]
}
```

## Sharing Options

Enable multiple sharing methods for referrers:

### Direct Link

```
https://yoursite.com/?ref=JANE20
```

### Email Sharing

Pre-populated email template:

```javascript theme={null}
po('shareViaEmail', {
  customer_key: 'cust_123',
  subject: 'Get 20% off at YourApp!',
  body: 'Use my referral link to get 20% off your first order: {referral_url}'
});
```

### Social Sharing

Add social sharing buttons:

```html theme={null}
<div id="social-share"></div>

<script>
  po('renderSocialShare', {
    container: '#social-share',
    customer_key: 'cust_123',
    platforms: ['twitter', 'facebook', 'linkedin', 'whatsapp']
  });
</script>
```

## Tracking & Analytics

Monitor your refer-a-friend program performance:

| Metric                | Description                                |
| --------------------- | ------------------------------------------ |
| **Shares**            | Number of times referral links were shared |
| **Clicks**            | Clicks on referral links                   |
| **Sign-ups**          | New users from referrals                   |
| **Conversions**       | Referred users who purchased               |
| **Viral Coefficient** | Average referrals per user                 |

## Fraud Prevention

Protect your program from abuse:

<CardGroup cols={2}>
  <Card title="Email Verification" icon="envelope-circle-check">
    Require email verification before rewards
  </Card>

  <Card title="IP Limits" icon="shield">
    Limit sign-ups from same IP address
  </Card>

  <Card title="Purchase Requirement" icon="cart-shopping">
    Only reward after actual purchase
  </Card>

  <Card title="Manual Review" icon="eye">
    Flag suspicious referrals for review
  </Card>
</CardGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Transactions" icon="receipt" href="/guides/tracking/transactions">
    Track purchases and conversions
  </Card>

  <Card title="Rewards" icon="gift" href="/guides/rewards/commissions">
    Configure commission structures
  </Card>
</CardGroup>
