lightning-sendinvoice -- Command for send an invoice for an offer
SYNOPSIS
(WARNING: experimental-offers only)
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"="lnr1qqgypua5g7rp293k00s66ayvnv26czst2d5k6urvv5s8getnw3gzqp3zderpzxstt8927ynqg044h0egcd8n5h3n9g0u0v4h8ncc3yg02gps7sjqtqssytfzxcs2xkdy0lml0tzy0jzugmyj8kjn8zfzrgq9fsgurc72x82e7pq947t0ks7a4yejz8w79x4zj25s3pu6zrnw2e0v2ugdescpcqsq307z4p2dlxe92fv7xd43qut0pjkg4y094hupqyhsj8dlhvmmfng6sv" "label"="test sendinvoice"
{
"id": "example:sendinvoice#1",
"method": "sendinvoice",
"params": {
"invreq": "lnr1qqgypua5g7rp293k00s66ayvnv26czst2d5k6urvv5s8getnw3gzqp3zderpzxstt8927ynqg044h0egcd8n5h3n9g0u0v4h8ncc3yg02gps7sjqtqssytfzxcs2xkdy0lml0tzy0jzugmyj8kjn8zfzrgq9fsgurc72x82e7pq947t0ks7a4yejz8w79x4zj25s3pu6zrnw2e0v2ugdescpcqsq307z4p2dlxe92fv7xd43qut0pjkg4y094hupqyhsj8dlhvmmfng6sv",
"label": "test sendinvoice"
}
}
Response:
{
"label": "test sendinvoice",
"bolt12": "lni1qqgypua5g7rp293k00s66ayvnv26czst2d5k6urvv5s8getnw3gzqp3zderpzxstt8927ynqg044h0egcd8n5h3n9g0u0v4h8ncc3yg02gps7sjqtqssytfzxcs2xkdy0lml0tzy0jzugmyj8kjn8zfzrgq9fsgurc72x82e5zvqyehytxx360zptatj4pygsv9kpal8gnkeyd0tpvd6jv5rkv2uqdgcq2s27mvxt0arlnulnmce53cuz00vzaqvgvhpphxgavl89r8zrdhaxqgzpvxkkmwsmxnuwflttmnpc8vtzwlgd3cfty3xwlnlc9r2gcjesguqqv4xey4m7l4wxem27vxyxfhwznlc62kffsd5xncx9w49m4g72u2y7lcl6a3x5cpu52j6gm8q5x0q8k7myxdzrsqqqqqqqqqqqqqqq5qqqqqqqqqqqqqayjedltzjqqqqqq9yq3n2s38p5cq442pq5qpm4ht26v8statwxcrl65uy26c9hx4dvy66f9x665eqqy90tpz25qc0gfqtqggzvmj9nrga83q474e2sjygxzmq7ln5fmvjxh4skxafx2pmx9wqx5v0qsqfkcrpht0d3nnt8txkcgf5wr6gzrlacls2gyrvj5hhwuu98shurrn6ayruunju7k9yu9clvaj354tr064ruuht88q5dj73kzru20uzj",
"payment_hash": "a003badd6ad30f05f56e3607fd538456b05b9aad6135a494dad5320010af5844",
"amount_msat": 1000000,
"status": "paid",
"pay_index": 1,
"amount_received_msat": 1000000,
"paid_at": 1722303714,
"payment_preimage": "6f154ed7d108349cb6385eba5f160294ef83862c2c560ba6446b2a3da5c2b3b3",
"description": "Simple test",
"expires_at": 1722303803,
"created_index": 3,
"updated_index": 1
}