---
title: "Happy hour: donations with the Charitips API"
description: "A restaurant's charity happy hour puts 5 % of each order into the evening's pot for a named charity."
canonical: https://www.charitips.com/docs/use-cases/campaign-for-a-date/happy-hour
---

# Happy hour: donations with the Charitips API

> A restaurant's charity happy hour puts 5 % of each order into the evening's pot for a named charity. At 8 pm, the till sends the pot as one donation; the restaurant pays.

- **Use case**: [A campaign for a date](https://www.charitips.com/docs/use-cases/campaign-for-a-date.md)
- **Sector**: Hotels and restaurants
- **Who pays**: Your company
- **What starts the donation**: A purchase
- **Example**: 5 % of the evening's happy-hour sales
- **Calls**: [`POST /v1/charities-selections`](https://www.charitips.com/docs/api-reference/create-charities-selection.md), [`POST /v1/campaigns`](https://www.charitips.com/docs/api-reference/create-campaign.md), [`POST /v1/campaigns/{campaignId}/activate`](https://www.charitips.com/docs/api-reference/activate-campaign.md), [`POST /v1/donations`](https://www.charitips.com/docs/api-reference/create-donation.md), [`GET /v1/campaigns/{campaignId}/metrics`](https://www.charitips.com/docs/api-reference/get-campaign-metrics.md)
- **Webhooks**: `donation_create`

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

## How it works

The screens of the demo in order, with the calls your server makes at each one.

### Once, before the first customer

- [`POST /v1/charities-selections`](https://www.charitips.com/docs/api-reference/create-charities-selection.md) Create a charities selection: once: the charities you offer, from the catalog

  ```json
  {
    "name": "Your restaurant",
    "charityIds": [
      "<charityId>"
    ]
  }
  ```
- [`POST /v1/campaigns`](https://www.charitips.com/docs/api-reference/create-campaign.md) Create a campaign: once: the campaign the donations go to

  ```json
  {
    "name": "Your restaurant",
    "charitiesSelectionId": "<charitiesSelectionId>",
    "type": "PERMANENT",
    "amountType": "FREE_AMOUNT"
  }
  ```
- [`POST /v1/campaigns/{campaignId}/activate`](https://www.charitips.com/docs/api-reference/activate-campaign.md) Activate a campaign: once: the campaign starts taking donations

### 1. With each order

- Button: Send the order

No call: this screen only shows the result.

### 2. At the end of happy hour

- Button: Skip to 8 pm

**Your server calls:**

- [`POST /v1/donations`](https://www.charitips.com/docs/api-reference/create-donation.md) Create a donation: from your server, when it happens; amount in cents

  ```json
  {
    "campaignId": "<campaignId>",
    "amount": 6280,
    "uniqueExternalId": "happy_hour_evening_412",
    "charityId": "<charityId>"
  }
  ```
- [`GET /v1/campaigns/{campaignId}/metrics`](https://www.charitips.com/docs/api-reference/get-campaign-metrics.md) Get campaign metrics: what the campaign has received so far, for the gauge

Charitips then sends the `donation_create` webhook to your endpoint.

## Other ways to run it

- [A date with a budget](https://www.charitips.com/docs/use-cases/campaign-for-a-date/campaign-for-a-date.md) (Retail): A fixed budget spent on the orders of Earth Day
- [Flash sale](https://www.charitips.com/docs/use-cases/campaign-for-a-date/flash-sale.md) (Retail): 5 % of the sales during the slot
- [In-game charity event](https://www.charitips.com/docs/use-cases/campaign-for-a-date/game-event.md) (Software and apps): 0,10 € per challenge, into a capped pot
- [Full guide: edge cases, webhooks, receipts](https://www.charitips.com/docs/use-cases/campaign-for-a-date.md)
- [All use cases](https://www.charitips.com/docs/use-cases.md)
