If want to tip me you can use my LightningTip as below. (https not used as this is hosted on a free web server without SSL certificates. You will not be entering any sensitive data.)
The invoice.macroon file limits the functionality available to LightningPay.php to only invoice related functions. Importantly, if someone steals your invoice.macaroon, they can NOT spend any of your funds.
The intended audience for this project is users that have an existing online eCommerce site. Typically the customer ends up at a checkout confirmation webpage with some Pay Now button(s).
In this project we include a very simple dummy eCommerce checkout page that serves as an example of how to deploy lightningPay.
- Enable REST on your lnd instance(s). See the restlisten parameter in the lnd documentation.
- Open any necessary firewall ports on your lnd host, and router port-forwards as needed.
- Generate a hex version of the invoice.macaroon file on your lnd instance.
xxd -ps -u -c 1000 /path/to/invoice.macaroon
- Generic: http://tomeko.net/online_tools/file_to_hex.php?lang=en
Prepare Web Server
Your webserver will need to have the php-curl package installed.
On a typical Linux webserver you can check as follows. The example below shows that it is installed.
$ dpkg -l php-curl Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Description +++-======================-================-================-================================================= ii php-curl 1:7.0+49 all CURL module for PHP [default]
If you see
no packages found matching php-curl then install as follows.
$ sudo apt-get update $ sudo apt-get install php-curl
How to install
- Download the latest release, and unzip.
- From the resources folder: Upload these files to your webserver:
- lightningPay_light.css (Optional)
lightningPay_conf.php. This is where you enter the HEX version of your invoice.macaroon.
- the CHANGE ME section of
How to test
Use your browser to visit these URLs:
or you can check my test sites here:
(https not used as this is hosted on a free web server without SSL certificates. You will not be entering any sensitive data.)
How to Use
Copy the contents of the head tag from
lightningPay.php into the head section of the HTML file you want to show LightningPay in. The div below the head tag is LightningPay itself. Paste it into any place in the already edited HTML file on your server.
There is a light theme available for LightningPay. If you want to use it, uncomment this line in your lightningPay.php file:
<link rel="stylesheet" href="lightningPay_light.css">
Do not use LightningPay on XHTML sites. That causes some weird scaling issues.
That's it! The only things you need to take care of is keeping the LND node and web server online. LightningPay will take care of everything else.