lightning-sendinvoice -- Command for send an invoice for an offer
SYNOPSIS
sendinvoice invreq label [amount_msat] [timeout] [quantity]
DESCRIPTION
The sendinvoice RPC command creates and sends an invoice to the issuer of an invoice_request for it to pay: lightning-invoicerequest(7).
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
.
- invreq (string): The bolt12 invoice_request string beginning with
lnr1
. - label (string): The unique label to use for this invoice.
- amount_msat (msat, optional): Required if the offer does not 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 by quantity if 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 is 90 seconds.
- quantity (u64, optional): Quantity is is required if the offer specifies quantity_max, otherwise it is not allowed.
RETURN VALUE
On success, an object is returned, containing:
- label (string): Unique label supplied at invoice creation.
- description (string): Description used in the invoice.
- payment_hash (hash): The hash of the payment_preimage which 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)
If status is "paid":
- pay_index (u64): Unique incrementing index for this payment.
- amount_received_msat (msat): The amount actually received (could be slightly greater than amount_msat, since clients may overpay).
- paid_at (u64): UNIX timestamp of when it was paid.
- payment_preimage (secret): Proof of payment.
ERRORS
The following error codes may occur:
- -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 <[email protected]> is mainly responsible.
SEE ALSO
lightning-fetchinvoice(7)
RESOURCES
Main web site: https://github.com/ElementsProject/lightning
EXAMPLES
Example 1:
Request:
lightning-cli sendinvoice -k "invreq"="lno1qgsq000bolt210002100021000210002100021000210002100021000210002100021000210002100021000210002100021000210002100021000210002100021000" "label"="test sendinvoice"
{
"id": "example:sendinvoice#1",
"method": "sendinvoice",
"params": {
"invreq": "lno1qgsq000bolt210002100021000210002100021000210002100021000210002100021000210002100021000210002100021000210002100021000210002100021000",
"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
}