> For the complete documentation index, see [llms.txt](https://developer.branta.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.branta.pro/setup/receive/custom-integration.md). Agents can also search and read this documentation through its [MCP server](https://developer.branta.pro/~gitbook/mcp).

# Custom Integration

POST your payment destinations to Branta from your own code — SDK or raw HTTP.

If none of [BTCPay, Take My Sats, or Zaprite](https://developer.branta.pro/setup/receive/integrations.md) fit, post destinations yourself. Use an SDK, or `POST` the HTTP API.

### Prerequisites

* You've completed [Receive](https://developer.branta.pro/setup/receive.md) setup — account, approved platform, and an API key.
* You know which [environment](https://developer.branta.pro/tech/environments.md) you're hitting (`staging` while testing, `production` for live traffic).
* Hold the API key server-side. Never put it in a browser bundle or mobile binary.

### Use the SDK

Install from the [SDK](https://developer.branta.pro/tech/sdk.md) page.

If your platform has **Require HMAC** turned on, also pass your HMAC secret so the SDK signs each publish. See [HMAC signing](https://developer.branta.pro/setup/receive/hmac-signing.md).

Every destination is encrypted before it is posted ([Encryption](https://developer.branta.pro/setup/receive/encryption.md)). Store `secret` with the invoice. Put `branta_id` and `branta_secret` on the invoice QR. Link the sender to `verifyUrl`.

`ttl` is seconds until Branta forgets the destination (30 second minimum, 1 year maximum; server default 7 days). `metadata` is stored as a string — Branta does not parse it.

### Raw HTTP

If you are not using an SDK, `POST` `/v2/payments`. Encrypt each destination before you send it. The algorithm is on [Receive](https://developer.branta.pro/tech/api/receive.md#zero-knowledge). Full schema is on that page too. If your platform requires HMAC, also send `X-HMAC-Signature` and `X-HMAC-Timestamp` ([HMAC signing](https://developer.branta.pro/setup/receive/hmac-signing.md)).

```bash
curl -X POST https://guardrail.branta.pro/v2/payments \
  -H "Authorization: Bearer $BRANTA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "destinations": [
      {
        "value": "<ciphertext>",
        "type": "bitcoin_address",
        "primary": true,
        "zk": true
      }
    ],
    "ttl": 3600,
    "metadata": "order-12345"
  }'
```

### Invoice QR

Secret-key rails (on-chain Bitcoin and ERC-681 stablecoin URIs) need `branta_id` and `branta_secret` on the URI the sender scans:

| Param           | Source                                             | Description                     |
| --------------- | -------------------------------------------------- | ------------------------------- |
| `branta_id`     | encrypted destination `value` returned by the POST | URL-encoded ciphertext          |
| `branta_secret` | `secret` returned by `addPayment`                  | decryption key — only in the QR |

**On-chain Bitcoin** (`type`: `bitcoin_address`):

```
bitcoin:<address>?branta_id=<url_encoded_branta_id>&branta_secret=<secret>
```

The address stays in the URI so the sender knows where to pay. Wallets that do not recognise these params ignore them (BIP-21).

**Stablecoin rails** use the ERC-681 `ethereum:` transfer URI on [Destination types](https://developer.branta.pro/destination-types.md#stablecoin-uris). Put `branta_id` and `branta_secret` on it.

Unknown types on POST return `422`.

bolt11, Ark, and silent payments use their normal URI. No extra params.

### verifyUrl

`verifyUrl` is the public Branta verify page for this payment. Link it from the invoice.
