LIGHTNING-XPAY(7)

๐Ÿ“ฆ
version 26.06.9 ยท 2 versions
, in nixpkgs unstable

okay so you just opened lightning-xpay(7) and honestly? bestie, you picked a good one. this is the xpay command from Core Lightning, and it's about to send a payment for you. buckle up. ๐ŸŽ€


๐ŸŒธ NAME ๐ŸŒธ

xpay โ€” Command for sending a payment. that's it. that's the whole gig. it sends money. iconic behavior. ๐Ÿ’ธ


โœจ SYNOPSIS โœจ

xpay invstring [amount_msat] [maxfee] [layers] [retry_for]
[partial_msat] [maxdelay] [payer_note] [label] [localinvreqid]

๐Ÿ’… DESCRIPTION ๐Ÿ’…

Command added in v24.11. yes, she's new-ish, and yes, she's already that girl. ๐Ÿ‘‘

The xpay RPC command attempts to make the specified payment. it's flexible like that โ€” it can look up BIP353 names (such as โ‚ฟrusty@blockstream.com, which is genuinely adorable), it can resolve simple offers (lno1...), and it can pay bolt11 (lnbc...) and bolt12 invoices (lni1...). one command, all the invoice flavors. we love a multitasker. ๐ŸŒˆ

This plugin is both simpler and more sophisticated than the older pay plugin. both things can be true at once, that's called range. ๐Ÿฆ‹

  • invstring (string) โ€” bolt11 or bolt12 invoice, a bolt12 (non-recursive) offer or a BIP353 name. if it's a bip353 name, an offer is fetched with fetchbip353 if available. if it's an offer, the invoice is fetched using fetchinvoice automatically. she does the legwork so you don't have to. ๐Ÿซถ
  • amount_msat (msat, optional) โ€” Only possible for a bolt11 invoice which does not have an amount (in which case, it's compulsory). amount_msat is in millisatoshi precision; it can be a whole number, or a whole number with suffix msat or sat, or a three decimal point number with suffix sat, or an 1 to 11 decimal point number suffixed by btc. numbers, but make it fashion. ๐Ÿ”ฅ
  • maxfee (msat, optional) โ€” maxfee creates an absolute limit on what fee we will pay. The default is 5000msat, or 1% (whatever is greater). no getting fleeced on your watch. ๐Ÿšซ
  • layers (array of strings, optional) โ€” These are askrene layers to apply in addition to xpay's own: these can alter the topology or provide additional information on the lightning network. This lets you exclude particular nodes or channels, or bias against them: see askrene-create-layer.: ๐Ÿ’ซ
    • (string, optional): name of an existing layer
  • retry_for (u32, optional) โ€” Until retry_for seconds passes, the command will keep finding routes and retrying the payment. The default is 60 seconds. she's persistent, not clingy. ๐Ÿ˜ญ
  • partial_msat (msat, optional) โ€” Explicitly state that you are only paying some part of the invoice. Presumably someone else is paying the rest (otherwise the payment will time out at the recipient). squad mode activated. ๐Ÿค
  • maxdelay (u32, optional) โ€” A payment may be delayed for up to maxdelay blocks by another node; clients should be prepared for this worst case. The default is 2016. (added v25.02) โณ
  • payer_note (string, optional) โ€” A message that a payer is willing to send to a payee within an invoice request. (added v26.04) say something nice!! ๐Ÿ’Œ
  • label (string, optional) โ€” Attach a label to payments for which is returned in listpays and listsendpays. This is for your own use: it is not visible to the recipient. your little secret, no cap. ๐Ÿ™ˆ (added v26.06)
  • localinvreqid (hex, optional) โ€” localinvreqid is used by offers to link a payment attempt to a local invoice_request offer created by lightningd-invoicerequest(7). This ensures that we only make a single payment for an offer, and that the offer is marked used once paid. (added v26.06) ๐Ÿ’œ

๐ŸŽ€ RETURN VALUE ๐ŸŽ€

On success, an object is returned, containing:

  • payment_preimage (secret) โ€” The proof of payment: SHA256 of this payment_hash. iykyk. ๐Ÿ”‘
  • failed_parts (u64) โ€” How many separate payment parts failed. ๐Ÿ’€
  • successful_parts (u64) โ€” How many separate payment parts succeeded (or are anticipated to succeed). This will be at least one. periodt. ๐Ÿ’…
  • amount_msat (msat) โ€” Amount the recipient received. ๐Ÿ“
  • amount_sent_msat (msat) โ€” Total amount we sent (including fees). the fees are part of the vibe, unfortunately. ๐Ÿ˜ฎโ€๐Ÿ’จ

๐Ÿ’€ ERRORS ๐Ÿ’€

The following error codes may occur:

  • -1 โ€” Catchall nonspecific error. the "something happened" of errors. ๐ŸŒซ๏ธ
  • 203 โ€” Permanent failure from destination (e.g. it said it didn't recognize invoice). they literally don't know her. ๐Ÿ˜ค
  • 205 โ€” Couldn't find, or find a way to, the destination. she's lost in the graph. ๐Ÿ—บ๏ธ
  • 207 โ€” Invoice has expired. too late bestie, should've paid sooner. โŒ›
  • 219 โ€” Invoice has already been paid. someone ate already. ๐Ÿฝ๏ธ
  • 209 โ€” Other payment error. the miscellaneous queen. ๐Ÿ‘‘

๐ŸŒŸ AUTHOR ๐ŸŒŸ

Rusty Russell rusty@rustcorp.com.au is mainly responsible. main character energy, honestly. ๐Ÿซก


๐Ÿฆ‹ SEE ALSO ๐Ÿฆ‹


๐ŸŒˆ RESOURCES ๐ŸŒˆ

Main web site: https://github.com/ElementsProject/lightning โ€” go look, she's gorgeous. โญ


๐Ÿงš EXAMPLES ๐Ÿงš

Example 1:

Request:

$ lightning-cli xpay "lnbcrt100n1pnt2bolt11invl040100000000bolt11invl040100000000bolt11invl040100000000bolt11invl040100000000bolt11invl040100000000bolt11invl040100000000bolt11invl040100000000bolt11invl040100000000bolt11invl040100000000bolt11invl040100000000"

{
  "id": "example:xpay#1",
  "method": "xpay",
  "params": [
    "lnbcrt100n1pnt2bolt11invl040100000000bolt11invl040100000000bolt11invl040100000000bolt11invl040100000000bolt11invl040100000000bolt11invl040100000000bolt11invl040100000000bolt11invl040100000000bolt11invl040100000000bolt11invl040100000000"
  ]
}

Response:

{
  "payment_preimage": "paymentpreimgxp1010101010101010101010101010101010101010101010101",
  "amount_msat": 10000,
  "amount_sent_msat": 10002,
  "failed_parts": 0,
  "successful_parts": 1
}

Example 2:

Request:

$ lightning-cli xpay -k "invstring"="lni1qqg0qe03030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303" "payer_note"="Coffee payment"

{
  "id": "example:xpay#2",
  "method": "xpay",
  "params": {
    "invstring": "lni1qqg0qe03030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303",
    "payer_note": "Coffee payment"
  }
}

Response:

{
  "payment_preimage": "paymentpreimgxp2020202020202020202020202020202020202020202020202",
  "amount_msat": 1000,
  "amount_sent_msat": 1000,
  "failed_parts": 0,
  "successful_parts": 1
}

and that's the whole page, bestie. this gorgeous thing is from Core Lightning v26.06.9 and it lives at LIGHTNING-XPAY(7). go pay someone. slay. ๐Ÿ’…โœจ๐Ÿซถ

๐Ÿ“ฆ where this page comes from