# Pay buttons for sites without a server

A pay button is one fixed link, send21.io/b/<token>, for a blog, a Ghost or Hugo site, a README or anywhere else you can put a link. You lock the amount, the coins and your receiving addresses. Every payer who presses it gets a fresh payment request with exactly those, and pays from their own wallet straight to yours.

## Why a button instead of a pay link

- A pay link (payment request) is for one payment and expires after at most 30 days. A pay button keeps working until you switch it off.
- Nothing in the button is secret. There is no API key in the page, and the browser cannot choose an amount, a coin you did not offer or an address: it can only start a payment with what you locked.
- No server of your own: the payer is sent to send21's hosted pay page, in English or German.

## Create a button

In the app, open **Buttons**, set a title (for example "Buy me a coffee"), the amount, the coins you accept and your receiving addresses. You get the link and a ready HTML snippet. Through the API, with a key that has `drafts:write`:

```bash
curl -X POST https://send21.io/api/v1/payment-buttons \
  -H "Authorization: Bearer s21_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Buy me a coffee",
    "fiatCurrency": "EUR",
    "fiatAmount": 5.00,
    "memo": "Thanks for reading!",
    "options": [
      { "currency": "Btc", "network": "Mainnet", "address": "you@your-wallet.com", "method": "Lightning" },
      { "currency": "Eurc", "network": "Base", "address": "0xYourAddress" }
    ]
  }'
```

## Put it on your site

The response has `url` and `embedHtml`. The HTML is a plain link with the send21 button image:

```html
<a href="https://send21.io/b/YOUR_TOKEN"><img src="https://send21.io/branding/pay-with-send21.svg" alt="Pay with crypto" width="200" height="44"></a>
```

## Ghost, Hugo and READMEs

- **Ghost:** add an HTML card in the editor and paste the snippet, or link a button or text to the URL.
- **Hugo:** paste the snippet into a shortcode or a layout. Raw HTML in Markdown content needs `markup.goldmark.renderer.unsafe = true`; a shortcode avoids that.
- **GitHub README:** use the Markdown form: `[![Pay with crypto](https://send21.io/branding/pay-with-send21.svg)](https://send21.io/b/YOUR_TOKEN)`.
- Any site builder that accepts a link works the same way: the button is only a link. More options: [Ghost and Hugo](https://send21.io/docs/ghost-hugo).

## What happens when someone pays

- The button page shows the title, the amount and the coins you accept. Pressing **Pay** makes a fresh payment request, valid for two hours, and opens its pay page.
- You see each payment under **Requests** with the reference `button:<id>`, get the usual emails and, if you have a webhook, `draft.created`, `draft.seen` and `draft.confirmed` as for any pay link.
- Switch a button off or delete it at any time; payments already started stay payable.
- If the key that created a button is revoked, or a receiving address is no longer approved on an account that only allows approved addresses, the button stops taking payments at once.

## Limits

- Up to 10 buttons per account and 12 coin options per button.
- At most 30 open payments per button at a time, so a button can never crowd out your other pay links.
- Starting a payment is rate-limited per client network, like choosing a coin on a pay page.

## API

| Call | What it does |
| --- | --- |
| `GET /api/v1/payment-buttons` | Your buttons (`drafts:read`). |
| `POST /api/v1/payment-buttons` | Create a button (`drafts:write`). |
| `POST /api/v1/payment-buttons/{id}/disable`, `/enable` | Switch it off or on. |
| `DELETE /api/v1/payment-buttons/{id}` | Delete it. |
| `GET /api/v1/buttons/{token}` | Public: what the payer sees, without addresses. |
| `POST /api/v1/buttons/{token}/start` | Public: start a payment; returns `payPath`. |

---
Source: https://send21.io/docs/pay-buttons
