home | help
LIGHTNING-INJECTPAYMENTONION(7) 		 LIGHTNING-INJECTPAYMENTONION(7)

NAME
     injectpaymentonion -- Send a payment with a custom onion packet

SYNOPSIS
     injectpaymentonion   onion   payment_hash	amount_msat  cltv_expiry  partid
     groupid [label] [invstring]  [localinvreqid]  [destination_msat]  [destina-
     tion]

DESCRIPTION
     Command added in v24.11.

     The injectpaymentonion RPC command causes the node to receive a payment at-
     tempt similar to the way it would receive one from a peer. The onion packet
     is  unwrapped,  then  handled  normally: either as a local payment, or for-
     warded to the next peer.  Compared to lightning-sendonion(7): the	handling
     of blinded paths and self-payments is trivial, and the interface blocks un-
     til  the  payment	succeeds  or  fails.   The  call also fails if this pay-
     ment_hash has already been successfully paid.

     *	onion (hex): Hex-encoded 1366 bytes long blob that was returned  by  ei-
	ther  of  the  tools  that can generate onions. It contains the payloads
	destined for each hop and some metadata. Please refer  to  BOLT  04  for
	further  details. If is specific to the route that is being used and the
	payment_hash used to construct, and therefore cannot be reused for other
	payments or to attempt a separate route. The custom onion can  generally
	be  created  using  the  devtools/onion CLI tool, or the createonion RPC
	command.
     *	payment_hash (hash): Specifies the 32 byte hex-encoded hash to use as  a
	challenge  to  the HTLC that we are sending. It is specific to the onion
	and has to match the one the onion was created with.
     *	amount_msat (msat): The amount in millisatoshis this node would  receive
	from a peer before forwarding the payment to the next.
     *	cltv_expiry  (u16):  The cltv_expiry for the first HTLC in blocks.  This
	must be greater than the current blockheight.
     *	partid (u64): The non-zero identifier for multiple parallel partial pay-
	ments with the same payment_hash.
     *	groupid (u64): Grouping key to disambiguate multiple attempts to pay the
	same payment_hash.  All payments in other groups must be  completed  be-
	fore starting a new group.
     *	label (string, optional): Can be used to provide a human readable refer-
	ence to retrieve the payment at a later time.
     *	invstring  (string, optional): Usually a bolt11 or bolt12 string, which,
	it will be returned in waitsendpay and listsendpays results.
     *	localinvreqid (hash, optional): localinvreqid is used by offers to  link
	a  payment  attempt  to  a local invoice_request offer created by light-
	ningd-invoicerequest(7).
     *	destination_msat (msat, optional): Amount that is actually delivered  to
	the  destination (i.e. amount_msat minus fees), for showing in listsend-
	pays (confusingly, as amount_msat). (added v24.11.1)
     *	destination (pubkey, optional):  Destination  id  (for	waitsendpay  and
	listsendpays).	 If  not  set,	will  be  extracted if possible from in-
	vstring. (added v26.06)

RETURN VALUE
     On success, an object is returned, containing:

     *	created_at (u64): The UNIX timestamp showing when this payment was  ini-
	tiated.
     *	completed_at  (u64):  The  UNIX  timestamp showing when this payment was
	completed.
     *	created_index (u64): 1-based index indicating  order  this  payment  was
	created in.
     *	payment_preimage  (secret):  The proof of payment: SHA256 of this is the
	invoice's payment_hash. (added v24.11)

ERRORS
     The following error codes may occur:

     *	218: injectpaymentonion failed

     The onionreply is returned in the error data, which  can  be  unwrapped  to
     discover the error

     *	219: injectpaymentonion already succeeded

     The data object contains the previous success, as per lightning-sendpay.

AUTHOR
     Rusty Russell rusty@rustcorp.com.au is mainly responsible.

SEE ALSO
     lightning-createonion(7), lightning-sendonion(7), lightning-listsendpays(7)

RESOURCES
     Main web site: https://github.com/ElementsProject/lightning

EXAMPLES
     Example 1:

     Request:

     $ lightning-cli injectpaymentonion -k "onion"="onion30303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030" "payment_hash"="paymenthashinvl0270027002700270027002700270027002700270027002700" "amount_msat"=1000 "cltv_expiry"=144 "partid"=1 "groupid"=0

     {
       "id": "example:injectpaymentonion#1",
       "method": "injectpaymentonion",
       "params": {
	 "onion": "onion30303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030",
	 "payment_hash": "paymenthashinvl0270027002700270027002700270027002700270027002700",
	 "amount_msat": 1000,
	 "cltv_expiry": 144,
	 "partid": 1,
	 "groupid": 0
       }
     }

     Response:

     {
       "created_index": 12,
       "created_at": 1738000000,
       "completed_at": 1739000000,
       "payment_preimage": "paymentpreimgio1030303030303030303030303030303030303030303030303"
     }

Core Lightning v26.06.1 			 LIGHTNING-INJECTPAYMENTONION(7)

home | help