# Referral Program Examples

Real-world setups for common business types. Each example shows the campaign configuration, reward structure, and the code to make it work.

> For a full library of examples by industry, see [referralrocket.io/referral-program-examples](https://referralrocket.io/referral-program-examples/refer-a-friend).

***

## SaaS — Double-Sided Credit Reward

**Scenario:** A subscription SaaS product wants to reward existing users for referring new paying customers.

| Setting            | Value                               |
| ------------------ | ----------------------------------- |
| Campaign type      | Double-Sided Referral               |
| Referrer reward    | $20 account credit                  |
| Referee reward     | $10 off first month                 |
| Qualifying event   | First successful payment            |
| Integration method | JS SDK on payment confirmation page |

**How it works:**

1. Existing user shares their referral link from the in-app widget.
2. New user signs up via the referral link — `addParticipant` is called at sign up.
3. New user completes their first payment — `qualifyParticipant` is called with `rewardReferee: true`.
4. Both the referrer ($20 credit) and the new user ($10 discount) receive their rewards.

```javascript
// On sign up
window.Rocket.getCampaign().addParticipant({
  email: 'newuser@example.com',
  fName: 'Jane',
  lName: 'Smith'
});

// On first successful payment
window.Rocket.getCampaign().qualifyParticipant({
  email: 'newuser@example.com',
  amountPaid: 49.00,
  rewardReferee: true   // rewards both referrer and referee
});
```

***

## E-commerce — Promo Code Referral

**Scenario:** A Shopify store wants to give both the referrer and new customer a discount code when a purchase is made via a referral link.

| Setting            | Value                                       |
| ------------------ | ------------------------------------------- |
| Campaign type      | Double-Sided Referral                       |
| Referrer reward    | 15% off next order (Shopify discount code)  |
| Referee reward     | 10% off first order (Shopify discount code) |
| Qualifying event   | First purchase                              |
| Integration method | Stripe Payment Links or Shopify integration |

**How it works:**

1. Customer shares their referral link via a post-purchase email or account page.
2. Friend clicks the referral link and lands on the store — referral cookie is set.
3. Friend completes a purchase — Referral Rocket receives the Stripe or Shopify webhook and qualifies the referral automatically.
4. Discount codes are issued to both parties via Shopify.

No custom code required if using the hosted Stripe Payment Links or Shopify integration — configure it entirely from the dashboard.

***

## B2B / Affiliate — Cash Reward via Tremendous

**Scenario:** A B2B company runs an affiliate program where partners earn a cash reward for each paying customer they refer.

| Setting            | Value                                                 |
| ------------------ | ----------------------------------------------------- |
| Campaign type      | Affiliate / One-Sided                                 |
| Referrer reward    | $150 cash (via Tremendous gift card or bank transfer) |
| Referee reward     | None                                                  |
| Qualifying event   | Customer completes first paid invoice                 |
| Integration method | REST API (server-side)                                |

**How it works:**

1. Affiliate receives a unique referral link from the Affiliate Hub.
2. Referred prospect signs up — your backend calls `addParticipant` via the REST API.
3. Prospect pays their first invoice — your backend calls `qualifyParticipant`.
4. Affiliate reward is queued in Reward Management and issued via Tremendous.

```bash
# Step 1: Add the referred participant (server-side)
curl -X POST 'https://app.referralrocket.io/api/v1/addParticipant' \
  --header 'x-api-key: YOUR-API-KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "id": "YOUR-CAMPAIGN-ID",
    "email": "prospect@company.com",
    "fName": "Alex",
    "lName": "Johnson",
    "referredByCode": "AFFILIATE-CODE"
  }'

# Step 2: Qualify after first payment (server-side, in your billing webhook)
curl -X POST 'https://app.referralrocket.io/api/v1/qualifyParticipant' \
  --header 'x-api-key: YOUR-API-KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "id": "YOUR-CAMPAIGN-ID",
    "email": "prospect@company.com",
    "amountPaid": 500.00
  }'
```

***

## Community / Newsletter — Free Tier Upgrade

**Scenario:** A newsletter or community platform rewards members who refer new subscribers with an upgrade to a premium tier.

| Setting            | Value                                            |
| ------------------ | ------------------------------------------------ |
| Campaign type      | One-Sided Referral                               |
| Referrer reward    | 1 month premium access (manual or custom reward) |
| Referee reward     | None                                             |
| Qualifying event   | New subscriber confirms email (sign up)          |
| Integration method | JS SDK on sign up confirmation page              |

**How it works:**

1. Member shares their referral link in their own newsletter or social profile.
2. New subscriber clicks the link and signs up — both `addParticipant` and `qualifyParticipant` are called on the confirmation page (sign up is the qualifying event).
3. Referrer's reward is queued immediately — no payment step needed.

```javascript
// On sign up confirmation page — sign up IS the qualifying event
const campaign = window.Rocket.getCampaign();

campaign.addParticipant({
  email: 'newsubscriber@example.com',
  fName: 'Sam'
}).then(function() {
  return campaign.qualifyParticipant({
    email: 'newsubscriber@example.com'
  });
}).then(function() {
  console.log('Referral complete — referrer reward queued.');
});
```

***

## Ways to Display Your Referral Program

Regardless of campaign type, you have three options for how users interact with the referral widget:

**1. Hosted page** — share a Referral Rocket-hosted URL directly in emails or social posts. No code required.

**2. Embedded widget** — place the widget inside your site or app so users never leave your product.

```html
<div id="referral-rocket-widget"></div>
<script
  type="text/javascript"
  campaign-id="YOUR-CAMPAIGN-ID"
  participant-email="LOGGED-IN-USER-EMAIL"
  defer
  src="https://app.referralrocket.io/widget/widgetIndex.js">
</script>
```

**3. Custom UI powered by the API** — build your own referral UI and use the REST API or JS SDK to power it behind the scenes.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://referral-rocket.gitbook.io/docs/referral-program-examples.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
