# Demo: Customers vote on a budget: Visitors vote at an exhibition

> A museum funds a pot of 1 € per ticket for an exhibition. Each ticket is one vote on a screen at the exit; the pot is split by the votes when the exhibition closes.

One variant of **Customers vote on a budget**, in Culture and events: 1 € per ticket, split by the votes.

A made-up site, kiosk.your-museum.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 charity choice in this demo is the Charitips [charity selection widget](https://www.charitips.com/docs/widgets/charity_selection.md), a ready-made proposal. Use it whole, use parts of it, or build your own experience from scratch with the API: [List charities](https://www.charitips.com/docs/api-reference/list-charities.md) gives the charities to show, and the calls below carry the chosen `charityId`.

Charitips widget: the charity cards and their profiles. Your own UI, built with the API: the ballot, the vote button and the results.

The full guide, with edge cases: https://www.charitips.com/docs/use-cases/vote-on-a-budget.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": "Oceans exhibition vote",
    "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": "Oceans exhibition vote",
    "charitiesSelectionId": "<charitiesSelectionId>",
    "type": "TIME_BASED",
    "endDate": "2027-01-14",
    "amountType": "FIXED_AMOUNT",
    "donationType": "DISTRIBUTION",
    "budget": 1200000
  }
  ```
- [`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. When the ticket is scanned

- Button: Scan my ticket

**Your server calls:**

- [`POST /v1/votes`](https://www.charitips.com/docs/api-reference/create-vote.md) Create a vote: one vote per person; weight is how much it counts

  ```json
  {
    "campaignId": "<campaignId>",
    "weight": 1,
    "uniqueExternalId": "ticket_2026_10_18_0457",
    "externalId": "visitor_0457"
  }
  ```

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

### 2. When the visitor votes

- The customer picks a charity from your selection.
- Button: Choose the charity

**Your server calls:**

- [`POST /v1/votes/{voteId}/cast`](https://www.charitips.com/docs/api-reference/cast-vote.md) Cast a vote: voteId from the create-vote response

  ```json
  {
    "charityId": "<charityId>"
  }
  ```

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

## Clone it with a coding agent

```prompt
Clone the Charitips demo "Customers vote on a budget: Visitors vote at an exhibition" into this project. Read https://www.charitips.com/docs/demos/vote/exhibition-ballot.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.
```
