aboutsummaryrefslogtreecommitdiffstats
path: root/routes/lightning/invoice.js
blob: f19b348498cf388ecef03e5185e4b47ed69eeda7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
module.exports = async (req, res) => {
  const { amount, tip } = req.body;

  l.info("adding lightning invoice", req.user.username, amount, tip);

  try {
    const invoice = await lnb.addInvoice({ value: amount + tip });
    res.send(invoice.payment_request);
  } catch (e) {
    l.error("problem creating invoice", e.message);
    res.status(500).send(e.message);
  }
};