---
title: "A donation for every referral"
description: "Reward the customer who brings a friend with a donation to the charity they pick."
canonical: https://www.charitips.com/docs/use-cases/referral
---

# A donation for every referral

> Reward the customer who brings a friend with a donation to the charity they pick.

This use case is one variant of **A donation for an achievement**: https://www.charitips.com/docs/use-cases/achievement.md
- **Who pays**: Your company
- **Starts with**: A customer action
- **Tax receipt**: In your company's name
- Needs [API access](https://www.charitips.com/docs/overview/plans.md#api-access-for-webhooks-and-credentials) on a validated account. [Plans](https://www.charitips.com/docs/overview/plans.md#what-every-flow-needs)

Interactive demo on the page. The same flow as a build spec: https://www.charitips.com/docs/demos/referral.md

**This demo is one example**: 10 € when the friend signs up. The same flow also covers:

- [Charitips emails the referrer](https://www.charitips.com/docs/use-cases/referral.md#let-charitips-email-the-referrer): A time-limited campaign sends the referrer a link to pick the charity: you only pass their name and email.
- [Both sides get a donation](https://www.charitips.com/docs/use-cases/referral.md#give-the-friend-a-welcome-gift): The referrer and the new customer each get a donation to give.
- [After the first purchase](https://www.charitips.com/docs/use-cases/donation-per-order.md): The donation waits for the friend's first order instead of the sign-up, so only real customers count.

## Build it
- **Calls**: [`create-charities-selection`](https://www.charitips.com/docs/api-reference/create-charities-selection.md), [`create-campaign`](https://www.charitips.com/docs/api-reference/create-campaign.md), [`activate-campaign`](https://www.charitips.com/docs/api-reference/activate-campaign.md), [`create-donation`](https://www.charitips.com/docs/api-reference/create-donation.md), [`claim-donation`](https://www.charitips.com/docs/api-reference/claim-donation.md)
- **Webhooks**: `donation_create`, `donation_update`
- **Before you start**: For the email variant: a `TIME_BASED` campaign and a `donor`.

### Set up the campaign

Once, create a charities selection, a campaign with its `charitiesSelectionId`, then activate it, as in [steps 3 to 5 of Your first donation](https://www.charitips.com/docs/get-started/first-donation.md#3-pick-your-charities).

```bash
curl -X POST https://api.sandbox.charitips.com/v1/campaigns \
  -H "Authorization: Bearer $CHARITIPS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Referral program",
    "charitiesSelectionId": "<charitiesSelectionId>"
  }'
```

### Let the referrer pick a charity

On your referral page, the referrer picks the charity upfront, so every invite can name it. Your app saves the `charityId` on its side.

### Give when the friend signs up

When the friend's account is confirmed, create the referrer's donation with the saved `charityId`. It is assigned at once, with no separate claim.

```bash
curl -X POST https://api.sandbox.charitips.com/v1/donations \
  -H "Authorization: Bearer $CHARITIPS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "campaignId": "<campaignId>",
    "amount": 1000,
    "charityId": "<charityId>",
    "uniqueExternalId": "referral_3301",
    "externalId": "customer_118"
  }'
```

### Give the friend a welcome gift

To reward the friend too, create a second donation without `charityId`, with the friend's id as `externalId`. Their first screen offers the charities.

```bash
curl -X POST https://api.sandbox.charitips.com/v1/donations \
  -H "Authorization: Bearer $CHARITIPS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "campaignId": "<campaignId>",
    "amount": 1000,
    "uniqueExternalId": "referral_3301_friend",
    "externalId": "customer_119"
  }'
```

### Let the friend pick a charity

When the friend picks, [claim the donation](https://www.charitips.com/docs/api-reference/claim-donation.md) for that charity. Without a choice, it is assigned automatically when it expires or when the campaign closes: none is lost.

```bash
curl -X POST https://api.sandbox.charitips.com/v1/donations/<donationId>/claim \
  -H "Authorization: Bearer $CHARITIPS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "charityId": "<charityId>"
  }'
```

### Let Charitips email the referrer

create the campaign with `sendingMode` set to `EMAIL`. Then pass the referrer as `donor` with both `email` and `firstName`, and the day to send the email in `sendingDate`: Charitips emails them a link to choose the charity. On an `EMAIL` campaign, the API returns `400` when `donor` is missing or has neither, or when `sendingDate` is missing.

```bash
curl -X POST https://api.sandbox.charitips.com/v1/donations \
  -H "Authorization: Bearer $CHARITIPS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "campaignId": "<campaignId>",
    "amount": 1000,
    "uniqueExternalId": "referral_3301",
    "externalId": "customer_118",
    "sendingDate": "2026-06-30T09:00:00Z",
    "donor": {
      "firstName": "Camille",
      "email": "camille.martin@example.com"
    }
  }'
```

## Edge cases

- **The friend cancels during a trial.** [Delete the donations](https://www.charitips.com/docs/api-reference/delete-donation.md) before they are billed.
- **Fiscal receipts.** You pay both donations, so the receipt goes to your company.

## Related pages

- [Campaigns](https://www.charitips.com/docs/concepts/campaigns.md)
- [Donation lifecycle](https://www.charitips.com/docs/concepts/donation-lifecycle.md)
