# Demo: Round-up on every payment

> A bank rounds each card payment up to the next euro and gives the difference. The customer opts in, sets a multiplier and a monthly cap, pays the round-ups and gets the receipt.

One variant of **Round-up on every payment**, in Banking and insurance: Each card payment rounded up to the next euro.

A made-up site, your-bank.example/app, 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 round-up settings, the multiplier, the save button and the card payments.

The full guide, with edge cases: https://www.charitips.com/docs/use-cases/round-up.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": "Round-up charities",
    "charityIds": [
      "<charityId>"
    ]
  }
  ```
- [`POST /v1/campaigns`](https://www.charitips.com/docs/api-reference/create-campaign.md) Create a campaign: once: the campaign, on an account with the B2C use case

  ```json
  {
    "name": "Round up",
    "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. Turn on round-ups

The customer picks a charity, a multiplier and a monthly cap, and agrees to pay the round-ups. Your app saves it on its side. Nothing is sent to Charitips yet.

- The customer picks a charity from your selection.
- Button: Turn on

No call: this screen only shows the result.

### 2. Card payment rounded up

Every card payment is rounded up on its own, with no confirmation. Your server charges the round-up with the payment, then records the donation in the customer's name: one fiscal receipt a year, and in France 66 % of the donation comes off their income tax.

- Coffee shop: 23,40 €
- Round-up for the charity: 0,60 €
- **Charged to the customer: 24,00 €**
- Button: Simulate a card payment

**Your server calls:**

- [`POST /v1/donations`](https://www.charitips.com/docs/api-reference/create-donation.md) Create a donation: for each rounded payment, once the customer is charged; amount in cents, after the multiplier and the cap; hasBeenCharged puts the receipt in the customer's name

  ```json
  {
    "campaignId": "<campaignId>",
    "amount": 60,
    "uniqueExternalId": "transaction_77812",
    "externalId": "customer_5120",
    "charityId": "<charityId>",
    "hasBeenCharged": true,
    "withFiscalReceipt": true,
    "donor": {
      "firstName": "Camille",
      "lastName": "Martin",
      "email": "camille.martin@example.com",
      "street": "12 rue des Lilas",
      "zip": "75011",
      "city": "Paris",
      "country": "FR"
    }
  }
  ```

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

### 3. Refund received

The merchant refunds the payment: your server deletes its round-up, as long as it is not billed yet.

- Button: Simulate a refund

**Your server calls:**

- [`DELETE /v1/donations/{donationId}`](https://www.charitips.com/docs/api-reference/delete-donation.md) Delete a donation: donationId kept with the transaction; only before the monthly bill

## Clone it with a coding agent

```prompt
Clone the Charitips demo "Round-up on every payment" into this project. Read https://www.charitips.com/docs/demos/round-up.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.
```

## Variants

**Variants**: the same flow in other sectors, each with its build spec.

- [Bank card payments](https://www.charitips.com/docs/use-cases/round-up/bank-card.md) (Banking and insurance): A bank rounds each card payment up to the next euro and gives the difference. The customer opts in, sets a multiplier and a monthly cap, pays the round-ups and gets the receipt. Each card payment rounded up to the next euro. Build spec: https://www.charitips.com/docs/demos/round-up.md
- [Festival cashless wallet](https://www.charitips.com/docs/use-cases/round-up/festival-wallet.md) (Culture and events): A festival's cashless wristband rounds each drink or food payment up to the next euro. The attendee agrees once at top-up, pays the cents and gets the receipt in their name. Each wristband payment rounded up to the next euro. Build spec: https://www.charitips.com/docs/demos/round-up/festival-wallet.md
- [Mobility wallet](https://www.charitips.com/docs/use-cases/round-up/transit-wallet.md) (Travel and mobility): A mobility app rounds each journey up to the next euro and gives the cents to the charity the rider saved. The rider pays the round-ups; a refunded trip deletes its round-up. Each journey rounded up to the next euro. Build spec: https://www.charitips.com/docs/demos/round-up/transit-wallet.md
- [Online store checkout](https://www.charitips.com/docs/use-cases/round-up/online-checkout.md) (Retail): An online store offers to round the order total up to the next euro at checkout. The customer ticks the round-up, picks the charity, pays the difference with the order and gets the receipt in their name. The order total rounded up to the next euro. Build spec: https://www.charitips.com/docs/demos/round-up/online-checkout.md
- [Restaurant self-order kiosk](https://www.charitips.com/docs/use-cases/round-up/self-order-kiosk.md) (Hotels and restaurants): A restaurant's self-order kiosk offers to round the bill up to the next euro before payment. The customer picks the charity and pays the difference with the meal. The bill rounded up to the next euro at the kiosk. Build spec: https://www.charitips.com/docs/demos/round-up/self-order-kiosk.md
