Get invoice amount from payment request - LND REST API I'm using the REST API of my LN node to generate and pay invoices. I would like to know how to get the invoice amount/value in sats from the payment request I receive.

I found this : https://api.lightning.community/rest/index.html?javascript#v1-invoice, but I don't know how to get the payment hash.

Thanks in advance
I just found the answer : https://api.lightning.community/rest/index.html?javascript#v1-payreq

Use the endpoint v1/payreq to decode the payment request.

Exemple :



var fs = require('fs');
var request = require('request');
var macaroon = fs.readFileSync('LND_DIR/data/chain/bitcoin/simnet/admin.macaroon').toString('hex');
var options = {
  url: 'https://localhost:8080/v1/payreq/{pay_req}',
  // Work-around for self-signed certificates.
  rejectUnauthorized: false,
  json: true, 
  headers: {
    'Grpc-Metadata-macaroon': macaroon,
  },
};
request.get(options, function(error, response, body) {
  console.log(body);
});


And the response :

{ 
    "route_hints": &lt;array RouteHint&gt;, 
    "num_satoshis": &lt;string&gt;, 
    "expiry": &lt;string&gt;, 
    "description_hash": &lt;string&gt;, 
    "timestamp": &lt;string&gt;, 
    "features": &lt;object&gt;, 
    "destination": &lt;string&gt;, 
    "num_msat": &lt;string&gt;, 
    "payment_hash": &lt;string&gt;, 
    "payment_addr": &lt;byte&gt;, 
    "description": &lt;string&gt;, 
    "cltv_expiry": &lt;string&gt;, 
    "fallback_addr": &lt;string&gt;, 
}