# Tip jar

> Add a "Tip me in crypto" card to your site with one script tag or a plain iframe. Fans tip from any chain and token; you receive your pay link's token, and the card counts your tippers.

Source: https://docs.layerhop.com/guides/tip-jar

The tip jar is a small card for creators' sites: a title, preset amounts, an optional message, "Supported by N tippers" and a pay box. Fans connect any EVM or Solana wallet and tip with whatever they hold; you receive one token on one chain, straight to your wallet. It is driven by your [pay link](/guides/pay-links): your ENS name, `.sol` name or address, and your preferred token.

Build yours at [app.layerhop.com/tipjar](https://app.layerhop.com/tipjar): it checks the name, previews the live card and copies the code.

## How do I add it with a script tag?

```html
<script async src="https://layerhop.com/tip.js"
  data-name="alice.eth"
  data-amounts="2,5,10"
  data-label="Buy me a coffee"
></script>
```

The script adds the card (an iframe from `layerhop.com`) right after the tag, or inside the element `data-target` selects, and resizes it to fit. Attributes:

| Attribute | Meaning |
| --- | --- |
| `data-name` | Required. ENS name, `.sol` name or address. |
| `data-amounts` | Up to 4 preset amounts in the token you receive, comma-separated. Default `2,5,10`. |
| `data-chain`, `data-token` | Receive this token instead of your pay link's preference (for example `solana` and `USDC`). |
| `data-label` | Card title, up to 40 characters. Default "Tip me in crypto". |
| `data-theme` | `dark` (default) or `light`. |
| `data-color` | Accent color, hex (`c3f06b`). |
| `data-messages` | `1` shows the latest tippers' messages on the card. |
| `data-target` | CSS selector of the element to put the card in. |

## My site blocks third-party scripts. Can I still use it?

Yes: use the iframe directly. No JavaScript runs on your page.

```html
<iframe src="https://layerhop.com/tip/alice.eth?amounts=2%2C5%2C10&label=Buy+me+a+coffee"
  title="Buy me a coffee" width="400" height="560"
  style="border:0;max-width:100%;border-radius:20px" allow="clipboard-write" loading="lazy"></iframe>
```

The query takes the same options as the script (`amounts`, `chain`, `token`, `label`, `theme`, `color`, `messages=1`). Your Content-Security-Policy must allow framing LayerHop: `frame-src https://layerhop.com`. The iframe can't resize itself without the script, so set the height you need (add about 160 px with messages).

## What do tippers pay?

A tip is a normal LayerHop swap into your token, with you as the recipient, on the widget fee channel: the tipper sees every fee before signing and LayerHop never holds the funds. Preset amounts are what you receive; the card sizes the payment from the first quotes so the tip arrives in full. If a fan already holds your token on your chain, the swap card still works, or they can send it to your address directly.

## How does the counter work?

Tips are quotes with `purpose=tip` (and the fan's message as `note`, up to 140 characters). `GET /v1/tip-jars/{address}` counts distinct wallets with a filled tip to that address, the number of tips, and returns the latest messages:

```bash
curl https://api.layerhop.com/v1/tip-jars/0x1111111111111111111111111111111111111111
```

```json
{ "address": "0x1111111111111111111111111111111111111111", "tippers": 42, "tips": 57, "messages": [{ "text": "Love the stream!", "at": "2026-10-28T12:00:00.000Z" }] }
```

It is public and cached for a minute. Messages are shown as plain text, only when you turn them on.
