# Payment API

> Send each payment from your server to the atrby Payment API with a read and write key, attributed to the visit using the atrby.ids() values.

Canonical: https://atrby.site/docs/payment-api
Last updated: 2026-10-21

Not on a supported processor? Send each payment from your server and it's attributed the same way.

## Send a payment

Create a **Read and write** key under Settings → API keys and MCP, then post each payment when it succeeds. Pass the visit ids you collected at checkout with `atrby.ids()`.

*curl*

```bash
curl https://app.atrby.site/api/v1/payments \
  -H "Authorization: Bearer $ATRBY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "site": "acme.io",
    "id": "order_1042",
    "amount": 49.00,
    "currency": "USD",
    "atrby_sid": "<from atrby.ids()>",
    "atrby_uid": "user_123",
    "email": "buyer@example.com"
  }'
```

## Fields

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `site` | string | Required | Site domain (acme.io) or id (st_…). |
| `id` | string | Required | Your order or payment id, up to 128 characters. Sending the same id again is ignored. |
| `amount` | number | Required | In major units: 49.00 means $49. |
| `currency` | string | Optional | Three-letter code. Default USD. |
| `atrby_sid` | string | Optional | The visit id from atrby.ids() at checkout. |
| `atrby_uid` | string | Optional | Your user id, as passed to [identify](https://atrby.site/docs/identify). |
| `email` | string | Optional | Customer email, shown in the payments list. |
| `name` | string | Optional | Customer name, up to 120 characters. |
| `occurred_at` | string | Optional | ISO 8601 time of the payment. Default: now. |

## Response

| Status and body | Meaning |
| --- | --- |
| 201 `{"result": "attributed"}` | Stored and matched to a visit. |
| 201 `{"result": "unattributed"}` | Stored, but no visit matched the ids. |
| 200 `{"result": "duplicate"}` | A payment with this id was already recorded. Safe to retry. |
| 400 / 401 / 403 / 429 | Invalid body, bad key, read-only key, or over the rate limit. See [REST API](https://atrby.site/docs/api). |

Refunds can't be sent through the Payment API yet.

## Related
- [Stripe](https://atrby.site/docs/integrations/stripe)
- [Dodo Payments](https://atrby.site/docs/integrations/dodo)
- [REST API](https://atrby.site/docs/api)
