Hey, this time it was our fault, the btcpay server had a hiccup. Can you try again?
Now I get a completely different error. Maybe since I attempted to edit the files up to the last lectures of their programming, See the attached file
The new error is given when I launch the “npm start” command and seems referred to the file invoice.js. I copy below its content. The interface for typing the amount does not open at all (the browser gives an error message). Also please consider that as you can see in the screenshot there is a reference to a path c:\users\HP\AppData… but this path does not exist in my computer.
Gosh, this is a never ending history…
INVOICE.JS
var express = require(‘express’);
var router = express.Router();
const BTCPAY_PRIV_KEY = “4c6a32116362b1c9dbece16785d0c93ac5bab6e1b75717582269aca3671a1c2d”;
const BTCPAY_MERCHANT_KEY = “BuxgfRGbe2XHN1LnBi1SJv7RJoiWxYf7uYPJ7je7nebb”;
// Initialize the client
const btcpay = require(‘btcpay’)
const keypair = btcpay.crypto.load_keypair(new Buffer.from(BTCPAY_PRIV_KEY, ‘hex’));
const client = new btcpay.BTCPayClient(‘https://lightning.filipmartinsson.com’, keypair, {merchant: BTCPAY_MERCHANT_KEY})
/* get & verify invoice. */
//Get Invoice/{invoiceId}
router.get(’/:id’, async function(req, res, next) {
//Payment verification
var invoiceId = req.params.id;
client.get_invoice(invoiceId)
//Check if the invoice is paid
.then(invoice => {
if(invoice.status == “complete” || invoice.status == “paid”)
//If paid serve customer Deliver product to customer
res.end(“Thank you”);
}
else{
res.end(“Not paid”);
}
}).catch(err => {
console.log(err);
}
})
});
/* Create invoice. */
router.post(’/’, function(req, res, next) {
var dollarAmount = req.body.amount;
console.log(dollarAmount);
//Create invoice
client.create_invoice({price: dollarAmount, currency: “USD”})
.then(function(invoice){
console.log(invoice);
res.render(“invoice”, {invoiceId: invoice.id})
})
.catch(err => console.log(err));
//Display
//What happens after
});
module.exports = router;
You have a typo in the code, check line 23.
Hello,
When I make git clone and go to the folder lightning app boilerplate the command npm install doesnt work. it says
-bash: npm: command not found
what should I do?
means you do not have installed the NodeJS properly, try to install it.
If you have any more questions, please let us know so we can help you!
Carlos Z.
Hi! I would like to connect my own Lightning node to BTCPay Server. What do I need to write under “Connection string”?
I know that Filips’ connection string is:
type=charge;server=https://api-token:6ba722c01e01846c671fed7a6909bbda8ebedf0b842fd75c9a82220132b34e60@lightning.filipmartinsson.com:443/lightning-charge/btc/
How can I find mine?
I am running an LND node and my node public key is 02bec1ddac2f98449da0e178db57e8d1a1d812c96e58aba15b491371d44d6e301a
In BTCPay Server Docs, under Extended Manual Checkup, under Lightning Network Daemon (lnd) > Check, it reads:
The Lightning Node Connection String to use with BTCPay Server
is:
type=lnd-rest;server=https://127.0.0.1:8080/;macaroonfilepath=/home/admin/.lnd/data/chain/bitcoin/mainnet/admin.macaroon;allowinsecure=true
Do I need to type that in my connection string?
And more generally, do I need to go through all the instructions under Lightning Network Daemon (lnd) to be able to connect my Lightning node on BTCPay Server?
Your insights and comments are welcomed!
Do you have a bitcoin full node with lnd running locally?
Yes, lnd (v. 0.11.0) is running locally on top of my Bitcoin Core full node.
I’m about to connect my LND (using mynode) to btcpayserver myself. I let you know when I’m done.
Already experimented with the donation button for BTC
Cool! Let’s keep connected!
I sended a DM to connect on Discord
Do you think this connection string is OK to connect my Lightning node to BTCPay Server?
type=lnd-rest;server=https://127.0.0.1:8080/;macaroonfilepath=/home/admin/.lnd/data/chain/bitcoin/mainnet/admin.macaroon;allowinsecure=true
My admin.macaroon file is located on C:\Users\xxx\AppData\Local\Lnd\data\chain\bitcoin\mainnet\admin.macaroon
(using my Windows PC to run my LN node)
Thank you for your assistance! @filip @thecil @ivga80 @Fabrice
Hi folks, I’ve registered against Filip’s BTCPay server and put in the type=charge;....
Connection string, but Test connection just results in
Error while connecting to the API (Response status code does not indicate success: 502 (Bad Gateway).)
and
[ Open Public Node Info Page](https://lightning.filipmartinsson.com/embed/6XeZXTxgswCT5ioyPzEThVt6QmcjdEhNmdwvXMb5DKrG/BTC/ln)
shows
# BTC Lightning Node - Unavailable
Please help!?
thanks
What is your node connection string?
Hi @Alko89 , I am trying to use the connection string from the video notes:
type=charge;server=https://api-token:6ba722c01e01846c671fed7a6909bbda8ebedf0b842fd75c9a82220132b34e60@lightning.filipmartinsson.com:443/lightning-charge/btc/
I don’t have my own node. The video suggests we use @filip’s one, and I’d rather concentrate on the course content than get distracted by some side issue of setting up my own node.
Thanks!
It works now, thanks whoever fixed it!
Cheers
Billy
I Diop, im interesting in this. Will follow you on Twitter ( me: 729cubes)
Greetings Anton
Hi sorry for the noob question, where exactly am I suppose to get the BTCPAY_KEY and the BTCPAY_PAIRCODE values?
Have you checked the Readme in the boilerplate repo?
You generate the BTCPAY_KEY in the terminal:
node -p "require('btcpay').crypto.generate_keypair().getPrivate('hex')"
And you get the BTCPAY_PAIRCODE in the BtcPay UI:
BTCPay Server > Stores > Settings > Access Tokens > Create a new token,
https://github.com/filipmartinsson/lightning-app-boilerplate