LIGHTNING-WAITINVOICE(7)

πŸ“¦
version 26.06.9 Β· 2 versions
, in nixpkgs unstable

πŸ’… LIGHTNING-WAITINVOICE(7) β€” the lightning-waitinvoice girlies' guide ✨

okay bestie so you found the lightning-waitinvoice manual page, and honestly? it's lowkey iconic. it's a page from the Core Lightning docs (that's the LIGHTNING part, iykyk) and it's section 7, which is the ~misc/commands~ section. anyway, let's get into it 🫢


🌸 NAME 🌸

waitinvoice β€” the command for waiting for one specific payment to show up. like, you pick the invoice, and you just... sit there. patiently. main character energy fr πŸ’…


✨ SYNOPSIS ✨

waitinvoice label

that's it. that's the whole vibe. one label, one command, one wait πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

the waitinvoice RPC command waits until a specific invoice gets paid, and then it hands you back that single entry, formatted exactly like it would come out of listinvoices. one entry, no scrolling, no drama. we love a focused queen πŸ’–

  • label β€” one of the following. this is the unique label of the invoice you're waiting to see paid πŸ’Έ
    • (string)
    • (integer)

so yeah, it takes a string or an integer, and that's the whole parameter list. not me expecting more, but honestly? simplicity ate. periodt 🌈


πŸŽ€ RETURN VALUE πŸŽ€

on success you get an object back, and it's giving full inventory. here's everything that can show up in it:

  • label (string) β€” the unique label you supplied at invoice creation. the name tag of your invoice 🏷️
  • payment_hash (hash) β€” the hash of the payment_preimage that will prove payment. it's the receipt-to-be, basically πŸ”
  • status (string, one of "paid" or "expired") β€” whether the invoice is paid or expired. the ultimate vibe check πŸ’€
  • expires_at (u64) β€” UNIX timestamp of when it will become / became unpayable. the deadline, bestie ⏰
  • created_index (u64) β€” 1-based index indicating the order this invoice was created in. (added v23.08)
  • description (string, optional) β€” the description used in the invoice πŸ“
  • amount_msat (msat, optional) β€” the amount required to pay this invoice. the price tag πŸ’°
  • bolt11 (string, optional) β€” the BOLT11 string. always present unless bolt12 is 🧾
  • bolt12 (string, optional) β€” the BOLT12 string. always present unless bolt11 is 🧾
  • updated_index (u64, optional) β€” 1-based index indicating the order this invoice was changed. only present if it actually has changed since creation, so if it's missing, nothing's happened, no cap. (added v23.08)

and if status is "paid", you ALSO get this whole extra glow-up of fields:

  • pay_index (u64) β€” unique incrementing index for this payment πŸ”’
  • amount_received_msat (msat) β€” the amount actually received. note that this could be slightly greater than amount_msat, because clients may overpay (generous of them honestly, we stan an overpayer 🫢)
  • paid_at (u64) β€” UNIX timestamp of when it was paid πŸ“…
  • payment_preimage (secret) β€” proof of payment. the crown jewel of this whole response πŸ‘‘
  • paid_outpoint (object, optional) β€” the outpoint this invoice was paid with (added v23.11):
    • txid (txid) β€” ID of the transaction that paid the invoice (added v23.11)
    • outnum (u32) β€” the 0-based output number of the transaction that paid the invoice (added v23.11)

😭 ERRORS 😭

when things go wrong, the returned object contains code and message properties, and code is gonna be one of these bad boys:

  • -32602 β€” if the given parameters are wrong. typo era, we've all been there πŸ™ˆ
  • -1 β€” if the invoice is deleted while unpaid, or if the invoice simply does not exist. it's gone, bestie, it's not coming back πŸ’€
  • 903 β€” if the invoice expires before being paid, or if it's already expired. the deadline passed while you were waiting, tragic ⏳

🧚 AUTHOR 🧚

Christian Decker decker.christian@gmail.com is mainly responsible. thank you for your service king 🫑


⭐ SEE ALSO ⭐

(the whole invoice cinematic universe, honestly πŸ’œ)


🌈 RESOURCES 🌈

Main web site: https://github.com/ElementsProject/lightning

go poke around, it's a good time ✨


πŸ’… EXAMPLES πŸ’…

Example 1: the -k era πŸ”₯

Request:

$ lightning-cli waitinvoice -k "label"="inv2"

{
  "id": "example:waitinvoice#1",
  "method": "waitinvoice",
  "params": {
    "label": "inv2"
  }
}

Response:

{
  "label": "inv2",
  "bolt11": "lnbcrt222n1pnt3005720bolt11wtinv01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101",
  "payment_hash": "paymenthashwaitinv0101010101010101010101010101010101010101010101",
  "amount_msat": 2000,
  "status": "paid",
  "pay_index": 5,
  "amount_received_msat": 2000,
  "paid_at": 1738500000,
  "payment_preimage": "paymentpreimagewaitinv0010101010101010101010101010101010101010101",
  "description": "inv2",
  "expires_at": 1739000000,
  "created_index": 13,
  "updated_index": 5
}

like look at that updated_index: 5. it changed, and it told us. we love transparency ✨

Example 2: the positional-argument serve πŸ“

Request:

$ lightning-cli waitinvoice "inv3"

{
  "id": "example:waitinvoice#2",
  "method": "waitinvoice",
  "params": [
    "inv3"
  ]
}

Response:

{
  "label": "inv3",
  "bolt11": "lnbcrt222n1pnt3005720bolt11wtinv02020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202",
  "payment_hash": "paymenthashwaitinv0202020202020202020202020202020202020202020202",
  "amount_msat": 3000,
  "status": "paid",
  "pay_index": 6,
  "amount_received_msat": 3000,
  "paid_at": 1738500000,
  "payment_preimage": "paymentpreimagewaitinv0020202020202020202020202020202020202020202",
  "description": "inv3",
  "expires_at": 1739000000,
  "created_index": 14,
  "updated_index": 6
}

both forms work, -k or positional, pick your fighter πŸ’–


ngl the whole thing is basically "tell me when this one invoice gets paid, and then give me the receipts" and honestly? relatable. waiting is hard, but waitinvoice makes it cute πŸŽ€

okay that's the whole page bestie, and before you go β€” this absolute baddie of a manual page is from Core Lightning v26.06.9, so go forth and wait on invoices responsibly πŸ’œπŸ¦‹βœ¨

πŸ“¦ where this page comes from