You can't do this in the CLI, the addinvoice
requires a random 32-byte hex-encoded preimage.
But you can do this with the REST API LND interface:
curl --insecure --request POST --data '{"r_hash": "<PAYMENT_HASH>", "value": <INT>}' --header "Grpc-Metadata-macaroon: <INVOICE MACAROON OR HIGHER>" --header "Content-Type: application/json" -v https://localhost:<LND_PORT>/v1/invoices
You need the --insecure
flag since it is an https://
endpoint that we cannot validate the TLS certificate.