# Demo: A campaign for a date: In-game charity event

> A game runs a timed charity event: each challenge cleared adds 0,10 € to a pot for a named charity, up to a set budget. The server sends each hour's pot; the studio pays.

One variant of **A campaign for a date**, in Software and apps: 0,10 € per challenge, into a capped pot.

A made-up site, event.your-game.example, walked through screen by screen with the Charitips API calls the product makes at each step. Rebuild it in your own project to start from a working flow.

The full guide, with edge cases: https://www.charitips.com/docs/use-cases/campaign-for-a-date.md.

**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 online game",
    "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 online game",
    "charitiesSelectionId": "<charitiesSelectionId>",
    "type": "TIME_BASED",
    "endDate": "2026-10-17",
    "amountType": "FIXED_AMOUNT",
    "budget": 1000000
  }
  ```
- [`POST /v1/campaigns/{campaignId}/activate`](https://www.charitips.com/docs/api-reference/activate-campaign.md) Activate a campaign: once: the campaign starts taking donations

## Screens and calls

### 1. With each challenge cleared

- Button: Start the fight

No call: this screen only shows the result.

### 2. At the end of the hour

- Button: Skip to 15:00

**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": 12050,
    "uniqueExternalId": "event_hour_14",
    "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.

### 3. Pot full

- Button: Start the fight

**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": 12040,
    "uniqueExternalId": "event_hour_15",
    "charityId": "<charityId>"
  }
  ```

## Clone it with a coding agent

```prompt
Clone the Charitips demo "A campaign for a date: In-game charity event" into this project. Read https://www.charitips.com/docs/demos/moment/game-event.md: it lists each screen and the Charitips API calls behind it. Build the same flow in this codebase, on the sandbox (https://api.sandbox.charitips.com), with my client id and secret read from environment variables, and follow the rules of https://www.charitips.com/docs/skill.md. Make every API call from the server, never from the browser. When it works, show me each call and its response.
```
