Skip to content

Payments API

Create invoices, pay Lightning invoices, and list payment history via the API.

Create Invoice (Receive)

POST /api/v1/payments

Auth: Invoice key or Admin key

Create a Lightning invoice to receive a payment.

Parameters

FieldTypeRequiredDescription
outbooleanYesMust be false for receiving
amountintegerYesAmount in satoshis
memostringNoInvoice description (visible to payer)
webhookstringNoURL called when payment is received
expiryintegerNoSeconds until invoice expires (default 3600)
extraobjectNoCustom metadata attached to the payment

Response 201

FieldTypeDescription
payment_hashstringUnique payment identifier
payment_requeststringBOLT11 invoice string
checking_idstringID for status polling
json
{
  "payment_hash": "abc123def456...",
  "payment_request": "lnbc10u1p...",
  "checking_id": "abc123def456..."
}

Pay Invoice (Send)

POST /api/v1/payments

Auth: Admin key only

Pay a Lightning invoice. Requires the Admin key - Invoice keys cannot send payments.

Parameters

FieldTypeRequiredDescription
outbooleanYesMust be true for sending
bolt11stringYesBOLT11 invoice to pay

Response 201

FieldTypeDescription
payment_hashstringUnique payment identifier
checking_idstringID for status polling
json
{
  "payment_hash": "abc123def456...",
  "checking_id": "abc123def456..."
}

Check Payment Status

GET /api/v1/payments/{checking_id}

Auth: Invoice key or Admin key

Check whether a payment has been received or completed.

Parameters

FieldTypeRequiredDescription
checking_idstring (path)YesPayment checking ID

Response 200

FieldTypeDescription
paidbooleanWhether the payment is complete
details.checking_idstringPayment identifier
details.amountintegerAmount in satoshis
details.feeintegerRouting fee in millisatoshis
details.memostringPayment memo
details.statusstring"pending", "success", or "failed"
details.timeintegerUnix timestamp
json
{
  "paid": true,
  "details": {
    "checking_id": "abc123def456...",
    "amount": 1000,
    "fee": 1,
    "memo": "Coffee payment",
    "status": "success",
    "time": 1700000000
  }
}

List Payments

GET /api/v1/payments

Auth: Invoice key or Admin key

List payments for the wallet.

Parameters

FieldTypeRequiredDescription
limitinteger (query)NoMax items to return (default 20)
offsetinteger (query)NoNumber of items to skip
statusstring (query)NoFilter: "pending", "success", "failed"

Response 200

Array of payment objects:

FieldTypeDescription
checking_idstringPayment identifier
amountintegerAmount in satoshis (negative = outgoing)
feeintegerRouting fee in millisatoshis
memostringPayment memo
statusstringPayment status
timeintegerUnix timestamp
bolt11stringBOLT11 invoice string
extraobjectCustom metadata
json
[
  {
    "checking_id": "abc123...",
    "amount": 1000,
    "fee": 0,
    "memo": "Coffee payment",
    "status": "success",
    "time": 1700000000,
    "bolt11": "lnbc10u1p...",
    "extra": {"order_id": "123"}
  }
]

List Payments (Paginated)

GET /api/v1/payments/paginated

Auth: Invoice key or Admin key

List payments with pagination and total count.

Parameters

FieldTypeRequiredDescription
limitinteger (query)NoItems per page (default 20, max 100)
offsetinteger (query)NoNumber of items to skip
statusstring (query)NoFilter: "pending", "success", "failed"

Response 200

FieldTypeDescription
dataarrayArray of payment objects
totalintegerTotal number of matching payments
json
{
  "data": [
    {
      "checking_id": "abc123...",
      "amount": 1000,
      "memo": "Coffee",
      "status": "success"
    }
  ],
  "total": 150
}

Payment History

GET /api/v1/payments/history

Auth: Invoice key or Admin key

Get payment totals grouped by time period.

Parameters

FieldTypeRequiredDescription
groupstring (query)NoGrouping: "hour", "day" (default), or "month"

Response 200

FieldTypeDescription
datestringPeriod label
incomeintegerTotal received (satoshis)
spendingintegerTotal sent (satoshis)
json
[
  {
    "date": "2024-01-15",
    "income": 50000,
    "spending": 12000
  },
  {
    "date": "2024-01-14",
    "income": 30000,
    "spending": 5000
  }
]

Payment Statistics

Count by Tag

GET /api/v1/payments/stats/count

Auth: Invoice key or Admin key

Get payment counts grouped by tag.

Parameters

None.

Response 200

json
[
  {
    "tag": "lnurlp",
    "count": 42
  },
  {
    "tag": "boltz",
    "count": 7
  }
]

Per-Wallet Stats

GET /api/v1/payments/stats/wallets

Auth: Bearer token

Get payment statistics across all wallets.

Parameters

None.

Response 200

json
[
  {
    "wallet_id": "wallet-1",
    "wallet_name": "Shop",
    "total_income": 500000,
    "total_spending": 120000,
    "payment_count": 85
  }
]

Daily Stats

GET /api/v1/payments/stats/daily

Auth: Invoice key or Admin key

Get daily payment aggregates.

Parameters

None.

Response 200

json
[
  {
    "date": "2024-01-15",
    "count": 12,
    "total": 45000
  }
]

Hold Invoices

Hold invoices let you accept a payment but delay settlement - useful for escrow, conditional payments, or order confirmation flows.

Settle Hold Invoice

PUT /api/v1/payments/{checking_id}

Auth: Admin key

Settle (complete) a held payment, releasing the funds to the wallet.

Parameters

FieldTypeRequiredDescription
checking_idstring (path)YesPayment checking ID

Response 200

json
{
  "detail": "Payment settled"
}

Cancel Hold Invoice

DELETE /api/v1/payments/{checking_id}

Auth: Admin key

Cancel a held payment, returning the funds to the sender.

Parameters

FieldTypeRequiredDescription
checking_idstring (path)YesPayment checking ID

Response 200

json
{
  "detail": "Payment cancelled"
}

News · Shop · SaaS · Telegram · Released under the MIT License.