LIGHTNING-CREATEINVOICE(7)
π LIGHTNING-CREATEINVOICE(7): createinvoice, low-level invoice creation π
okay bestie, welcome to the group chat for createinvoice β low-level invoice creation, no cap. this is LIGHTNING-CREATEINVOICE(7), and we're keeping every single fact exactly while making it make sense. β¨
πΈ NAME πΈ
createinvoice -- Low-level invoice creation
β¨ SYNOPSIS β¨
createinvoice invstring label preimage
π DESCRIPTION π
the createinvoice RPC command signs and saves an invoice into the database. literally. π«Ά
invstring(string) β thebolt11/bolt12invoice, but the final signature is ignored. Minimal sanity checks are done.label(one of) β a unique string or number (which is treated as a string, so01is different from1); it is never revealed to other nodes on the lightning network, but it can be used to query the status of this invoice.:- (string)
- (integer)
preimage(hex) β the preimage to supply upon successful payment of the invoice.
π«Ά RETURN VALUE π«Ά
(Note: the return format is the same as lightning-listinvoices(7)). On success, an object is returned, containing:
label(string) β The label for the invoice.payment_hash(hash) β The hash of thepayment_preimagewhich will prove payment.status(string) (one of"paid","expired","unpaid") β Whether it has been paid, or can no longer be paid.description(string) β Description extracted frombolt11orbolt12.expires_at(u64) β UNIX timestamp of when invoice expires (or expired).created_index(u64) β 1-based index indicating order this invoice was created in. (added v23.08)bolt11(string, optional) β Thebolt11string (always present unlessbolt12is).bolt12(string, optional) β Thebolt12string instead ofbolt11amount_msat(msat, optional) β The amount of the invoice (if it has one).pay_index(u64, optional) β Incrementing id for when this was paid (statuspaidonly).amount_received_msat(msat, optional) β Amount actually received (statuspaidonly).paid_at(u64, optional) β UNIX timestamp of when invoice was paid (statuspaidonly).paid_outpoint(object, optional) β Outpoint this invoice was paid with (statuspaidonly). (added v23.11):txid(txid) β ID of the transaction that paid the invoice (statuspaidonly). (added v23.11)outnum(u32) β The 0-based output number of the transaction that paid the invoice (statuspaidonly). (added v23.11)
payment_preimage(secret, optional) β The proof of payment: SHA256 of thispayment_hash.local_offer_id(hex, optional) (always 64 characters) β The id of our offer which created this invoice.invreq_payer_note(string, optional) β The optionalinvreq_payer_notefrominvoice_requestwhich created this invoice.
π ERRORS π
on failure, an error is returned and no invoice is created. if thelightningprocess fails before responding, the caller should uselightning-listinvoices(7)to query whether this invoice was created or not. π
The following error codes may occur:
-1β Catchall nonspecific error.900β An invoice with the given label already exists.
π AUTHOR π
Rusty Russell rusty@rustcorp.com.au is mainly responsible. main character energy, fr fr π
π¦ SEE ALSO π¦
go read these bestie:
lightning-invoice(7)lightning-listinvoices(7)lightning-delinvoice(7)lightning-getroute(7)lightning-sendpay(7)lightning-offer(7)
π RESOURCES π
Main web site: https://github.com/ElementsProject/lightning
π EXAMPLES π
Example 1:
Request:
$ lightning-cli createinvoice -k "invstring"="lnbcrt100n1pnt2bolt11invl010300000000bolt11invl010300000000bolt11invl010300000000bolt11invl010300000000bolt11invl010300000000bolt11invl010300000000bolt11invl010300000000bolt11invl010300000000bolt11invl010300000000bolt11invl010300000000" "label"="lbl_l13" "preimage"="0101010101010101010101010101010101010101010101010101010101010101"
{
"id": "example:createinvoice#1",
"method": "createinvoice",
"params": {
"invstring": "lnbcrt100n1pnt2bolt11invl010300000000bolt11invl010300000000bolt11invl010300000000bolt11invl010300000000bolt11invl010300000000bolt11invl010300000000bolt11invl010300000000bolt11invl010300000000bolt11invl010300000000bolt11invl010300000000",
"label": "lbl_l13",
"preimage": "0101010101010101010101010101010101010101010101010101010101010101"
}
}
Response:
{
"label": "lbl_l13",
"bolt11": "lnbcrt100n1pnt2bolt11invl020100000000bolt11invl020100000000bolt11invl020100000000bolt11invl020100000000bolt11invl020100000000bolt11invl020100000000bolt11invl020100000000bolt11invl020100000000bolt11invl020100000000bolt11invl020100000000",
"payment_hash": "paymenthashinvl0210021002100210021002100210021002100210021002100",
"amount_msat": 100000,
"status": "unpaid",
"description": "l13 description",
"expires_at": 1739000000,
"created_index": 7
}
bye bestie β this LIGHTNING-CREATEINVOICE(7) page is serving Core Lightning v26.06.9 source/version energy; the footer date isn't listed here, so no invented numbers πβ¨
π¦ 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