---
description: Make payments through bolt11 or keysend.
---

# Payments

## BOLT11 payment

Scope needed: `payments:send`

Pay a lightning invoice (bolt11)&#x20;

<mark style="color:green;">`POST`</mark> `https://api.getalby.com/payments/bolt11`

Pay a bolt11 invoice.

#### Request Body

| Name                                      | Type   | Description        |
| ----------------------------------------- | ------ | ------------------ |
| invoice<mark style="color:red;">\*</mark> | string | invoice to be paid |

{% tabs %}
{% tab title="200: OK Succesfully paid invoice" %}
```javascript
{
    "amount": 100,
    "description": "Alby invoice",
    "destination": "025c1d5d1b4c983cc6350fc2d756fbb59b4dc365e45e87f8e3afe07e24013e8220",
    "fee": 0,
    "payment_hash": "38caadbe0f6112d9b638e9ae24338f7e9bd930a3387100da776644e56965c9c1",
    "payment_preimage": "2f84e22556af9919f695d7761f404e98ff98058b7d32074de8c0c83bf63eecd7",
    "payment_request": "lnbcrt1u1p3d23dkpp58r92m0s0vyfdnd3caxhzgvu006dajv9r8pcspknhvezw26t9e8qsdq5g9kxy7fqd9h8vmmfvdjscqzpgxqyz5vqsp59efe44rg6cjl3xwh9glgx4ztcgwtg5l8uhry2v9v7s0zn2wpaz2s9qyyssq2z799an4pt4wtfy8yrk5ee0qqj7w5a74prz5tm8rulwez08ttlaz9xx7eqw7fe94y7t0600d03k55fyguyj24nd9tjmx6sf7dsxkk4gpkyenl8"
}
```
{% endtab %}

{% tab title="500: Internal Server Error " %}
```javascript
{
    "code": 10,
    "error": true,
    "message": "error"
}
```
{% endtab %}

{% tab title="400: Bad Request " %}
```javascript
{
  "code": 8,
  "error": true,
  "message": "string"
}
```
{% endtab %}
{% endtabs %}

## Keysend payment

Scope needed: `payments:send`

Send a "spontaneous" payment (keysend). Used for push realtime/streaming push payments

## Keysend payment

<mark style="color:green;">`POST`</mark> `https://api.getalby.com/payments/keysend`

Make a spontaneous keysend payment, with optional custom records. See for example: [https://github.com/lightning/blips/blob/master/blip-0010.md](https://github.com/lightning/blips/blob/master/blip-0010.md)

#### Request Body

| Name                                          | Type               | Description                                                                                                                                                                                 |
| --------------------------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| amount<mark style="color:red;">\*</mark>      | int64              | Amount in satoshi. Must be a whole number greater than 0. (millisats are not supported)                                                                                                     |
| destination<mark style="color:red;">\*</mark> | string             | Destination hex-string pubkey (a string starting with 02 or 03)                                                                                                                             |
| memo                                          | string             | Internal memo                                                                                                                                                                               |
| custom\_records                               | map\[string]string | map with custom records. See [https://www.webln.guide/building-lightning-apps/webln-reference/webln.keysend](https://www.webln.guide/building-lightning-apps/webln-reference/webln.keysend) |

{% tabs %}
{% tab title="200: OK " %}
```javascript
{
  "amount": 1000,
  "description": "string",
  "description_hash": "string",
  "destination": "string",
  "fee": 0,
  "custom_records": {},
  "payment_hash": "string",
  "payment_preimage": "string"
}
```
{% endtab %}

{% tab title="400: Bad Request " %}
```javascript
{
  "code": 8,
  "error": true,
  "message": "string"
}
```
{% endtab %}

{% tab title="500: Internal Server Error " %}
```javascript
{
  "code": 10,
  "error": true,
  "message": "string"
}
```
{% endtab %}
{% endtabs %}

## Multi keysend payment

Scope needed: \`payments:send\`\
Send multiple spontaneous keysend payments. Useful for doing value4value splits. Request and response are an array of the single keysend payment request and response.

## Make multiple keysend payments in 1 request

<mark style="color:green;">`POST`</mark> `https://api.getalby.com/payments/keysend/multi`

Each of the payments can fail or succeed seperately.

#### Request Body

| Name                                       | Type  | Description                                                                        |
| ------------------------------------------ | ----- | ---------------------------------------------------------------------------------- |
| keysends<mark style="color:red;">\*</mark> | Array | Array of keysend objects as described in the body parameters of the section above. |

{% tabs %}
{% tab title="200: OK " %}
```javascript
{
  "keysends": [
    {
      "error": {
        "code": 0,
        "error": false,
        "message": "string"
      },
      "keysend": {
        "amount": 100,
        "description": "test",
        "description_hash": "string",
        "destination": "0234",
        "fee": 1,
        "custom_records": {},
        "payment_hash": "paymenthash",
        "payment_preimage": "preimage"
      }
    }
  ]
}
```
{% endtab %}

{% tab title="400: Bad Request " %}
```javascript
{
  "code": 8,
  "error": true,
  "message": "string"
}
```
{% endtab %}

{% tab title="500: Internal Server Error " %}
```javascript
{
  "code": 10,
  "error": true,
  "message": "string"
}
```
{% endtab %}
{% endtabs %}
