-
Notifications
You must be signed in to change notification settings - Fork 28
API documentation
michael1011 edited this page Aug 10, 2018
·
2 revisions
This are all available API endpoints of the backend of LightningTip.
Gets a new invoice from LND and in how many seconds it will expire
-
URL:
/getinvoice
-
Method:
POST
-
Data parameters:
Required:
Amount=[int]
Optional:
Message=[string]
-
Sample request content:
{
"Amount": 1,
"Message": "Just a test"
}
- Success response:
- Code:
200
- Content:
- Code:
{
"Invoice": "lntb10n1pdv9snypp5nah8f2fdje3wmym7wtv6l67qgj54r4a4twvq4yj330x87cgap6tqdqqcqzysxqrrssh5z8l66yg9gs7fywpapjl2e3jv5mphfmggyjq8vlfnwj6d0kmmhzealhhpwjj9lf84tfugy5tnsx6glfe4gt5htqh22hhpx7npv3jgspy2ve5d",
"Expiry": 3600
}
Allows the browser to listen to settled invoices. /eventsource
does not broadcast the invoices itself but the SHA256 hash of the invoice. Please note that not all browsers support EventSource.
- URL:
/eventsource
- Method:
GET
- Sample request in JavaScript:
var eventSrc = new EventSource("/eventsource");
eventSrc.onmessage = function (event) {
if (event.data === hashofInvoice) {
console.log("Invoice settled");
}
};
- Success response:
- Content:
data: b49c05977c5ef29de4ff67d1eca347d31c3e4725559662cf55df8976e5602175
- Content:
To check if an invoice is settled in browsers which don't support EventSource. /invoicesettled
will return false
if the invoice was generated with LightningTip and is not settled yet.
-
URL:
/invoicesettled
-
Method:
POST
-
Data parameters:
Required:
-
InvoiceHash=[string]
SHA256 hash of the invoice
-
-
Sample request content:
{
"InvoiceHash": "b49c05977c5ef29de4ff67d1eca347d31c3e4725559662cf55df8976e5602175"
}
- Success response:
- Code:
200
- Content:
- Code:
{
"Settled": true
}