LIGHTNING-SENDINVOICE(7)
π¦ LIGHTNING-SENDINVOICE(7) β the sendinvoice glow-up
okay so bestie, welcome to the lightning-sendinvoice page (yes, it's a whole Β§7 manual page, we're fancy like that β¨). This is the one that goes and sends an actual invoice to the person who asked for one. It's giving "you asked, I delivered, now pay me" energy π
πΈ NAME
sendinvoice β the command for sending an invoice for an offer, fr fr
β¨ SYNOPSIS
sendinvoice invreq label [amount_msat] [timeout] [quantity]
π DESCRIPTION
so the sendinvoice RPC command creates and sends an invoice to the issuer of an invoice_request, so they can pay it: lightning-invoicerequest(7). Iconic, honestly π«Ά
If fetchinvoice-noconnect is not specified in the configuation, it will connect to the destination in the (currently common!) case where it cannot find a route which supports option_onion_messages. Like, it'll just brute-force the connection because finding a route is being difficult π
Now the args, one by one:
invreq(string) β the BOLT12invoice_requeststring, and it begins withlnr1. That's your starting point, bestie, no cap.label(string) β the unique label to use for this invoice. Unique. As in don't reuse it πamount_msat(msat, optional) β Required if the offer doesn't specify an amount at all, or specifies it in a different currency. Otherwise you may set it (e.g. to provide a tip πΈ). The default is the amount contained in the offer (multiplied byquantityif any).timeout(u32, optional) β seconds to wait for the offering node to pay the invoice or return an error. This will also be the timeout on the invoice that is sent. The default is90seconds β³quantity(u64, optional) βquantityis is required if the offer specifiesquantity_max, otherwise it is not allowed. Rules are rules π
π RETURN VALUE
on success you get an object back, containing all of this:
label(string) β unique label supplied at invoice creation.description(string) β description used in the invoice.payment_hash(hash) β the hash of thepayment_preimagewhich will prove payment.status(string) (one of"unpaid","paid","expired") β whether it's paid, unpaid or unpayable.expires_at(u64) β UNIX timestamp of when it will become / became unpayable.created_index(u64) β 1-based index indicating order this invoice was created in. (added v23.08)amount_msat(msat, optional) β the amount required to pay this invoice.bolt12(string, optional) β the BOLT12 string.updated_index(u64, optional) β 1-based index indicating order this invoice was changed (only present if it has changed since creation). (added v23.08)
And if status is "paid" π β extra fields, because you ate:
pay_index(u64) β unique incrementing index for this payment.amount_received_msat(msat) β the amount actually received (could be slightly greater thanamount_msat, since clients may overpay β love a generous king π).paid_at(u64) β UNIX timestamp of when it was paid.payment_preimage(secret) β proof of payment.
π ERRORS
these error codes may occur, keep them in mind:
-1β catchall nonspecific error.1002β offer has expired.1003β cannot find a route to the node making the offer.1004β the node making the offer returned an error message.1005β we timed out waiting for the invoice to be paid
π§ AUTHOR
Rusty Russell rusty@rustcorp.com.au is mainly responsible. legend behavior tbh π
π SEE ALSO
β RESOURCES
Main web site: https://github.com/ElementsProject/lightning
π EXAMPLES
Example 1 β okay so here's the whole thing, request then response:
Request:
$ lightning-cli sendinvoice -k "invreq"="lno1qgsq000bolt210002100021000210002100021000210002100021000210002100021000210002100021000210002100021000210002100021000210002100021000210002100021000" "label"="test sendinvoice"
{
"id": "example:sendinvoice#1",
"method": "sendinvoice",
"params": {
"invreq": "lno1qgsq000bolt210002100021000210002100021000210002100021000210002100021000210002100021000210002100021000210002100021000210002100021000210002100021000",
"label": "test sendinvoice"
}
}
Response:
{
"label": "test sendinvoice",
"bolt12": "lno1qgsq000boltsi100si100si100si100si100si100si100si100si100si100si100si100si100si100si100si100si100si100si100si100si100si100si100si100",
"payment_hash": "paymenthashsdinvsi10si10si10si10si10si10si10si10si10si10si10si10",
"amount_msat": 1000000,
"status": "paid",
"pay_index": 2,
"amount_received_msat": 1000000,
"paid_at": 1738500000,
"payment_preimage": "paymentpreimagei010101010101010101010101010101010101010101010101",
"description": "Simple test",
"expires_at": 1739000000,
"created_index": 4,
"updated_index": 2
}
okay that's the whole page bestie, go get that invoice paid π This was Core Lightning v26.06.9, page LIGHTNING-SENDINVOICE(7) β slay, bye πβ¨
π¦ where this page comes from
- nixpkgs unstable: clightning 26.06.9
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms