# Demo: Card cashback as a donation

> A bank turns 1 % of a customer's monthly card spending into one donation, at no cost to them. The customer picks the charity from the monthly notification; it is kept for later.

One variant of **A saved choice, a periodic statement**, in Banking and insurance: 1 % of card spending, each month.

A made-up site, your-bank.example/cashback, 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, their profiles and the thank-you card for a waiting cashback. Your own UI, built with the API: the cashback summary and transactions, the button that saves the charity, and the card that confirms each gift.

The full guide, with edge cases: https://www.charitips.com/docs/use-cases/card-cashback.md.

The full guide, with edge cases: https://www.charitips.com/docs/use-cases/card-cashback.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": "Cashback charities",
    "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": "Cashback donations",
    "charitiesSelectionId": "<charitiesSelectionId>"
  }
  ```
- [`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. Choose your cashback charity

Optional: the customer saves a charity ahead. Your app keeps it on its side; nothing is sent to Charitips yet.

- The customer picks a charity from your selection.
- Button: Save my choice

No call: this screen only shows the result.

### 2. Your October cashback

At the end of the month, one donation per customer, at no cost to them. With a saved charity it is assigned at once; without one it waits for the customer's choice, and is never lost.

- Card spending: 412,00 €
- Cashback: 1 %
- **Donation: 4,12 €**
- Button: Close the month

**Your server calls:**

- [`POST /v1/donations`](https://www.charitips.com/docs/api-reference/create-donation.md) Create a donation: at the end of the month; with the saved charity as charityId, or without it when none is saved yet, so the donation waits for the choice; amount in cents

  ```json
  {
    "campaignId": "<campaignId>",
    "amount": 412,
    "charityId": "<charityId>",
    "uniqueExternalId": "2026-10_customer_204",
    "externalId": "customer_204"
  }
  ```

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

### 3. Your October cashback is waiting

Your monthly notification opens this screen. The customer picks the charity of the waiting donation; your app also saves it for the next months.

- The customer picks a charity from your selection.
- Button: Give 4,12 €

**Your server calls:**

- [`POST /v1/donations/{donationId}/claim`](https://www.charitips.com/docs/api-reference/claim-donation.md) Claim a donation: donationId from the create-donation response

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

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

## Clone it with a coding agent

```prompt
Clone the Charitips demo "Card cashback as a donation" into this project. Read https://www.charitips.com/docs/demos/cashback.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.
```
