From 773103f8938adf041c1816b3011903794b629fa8 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Sun, 7 Mar 2021 16:38:23 -0300 Subject: [PATCH] instructions and API docs. --- .../templates/offlineshop/_api_docs.html | 87 ++++++++++++++++++- 1 file changed, 85 insertions(+), 2 deletions(-) diff --git a/lnbits/extensions/offlineshop/templates/offlineshop/_api_docs.html b/lnbits/extensions/offlineshop/templates/offlineshop/_api_docs.html index 944c746a..f0d4a151 100644 --- a/lnbits/extensions/offlineshop/templates/offlineshop/_api_docs.html +++ b/lnbits/extensions/offlineshop/templates/offlineshop/_api_docs.html @@ -6,8 +6,21 @@ > +
    +
  1. Register items.
  2. +
  3. Print QR codes and paste them on your store, your menu, somewhere, somehow.
  4. +
  5. Clients scan the QR codes and get information about the items plus the price on their phones directly (they must have internet)
  6. +
  7. Once they decide to pay, they'll get an invoice on their phones automatically
  8. +
  9. When the payment is confirmed, a confirmation code will be issued for them.
  10. +

- Sell stuff offline, accept Lightning payments. Powered by LNURL-pay. + The confirmation codes are words from a predefined sequential word list. Each new payment bumps the words sequence by 1. So you can check the confirmation codes manually by just looking at them. +

+

+ For example, if your wordlist is [apple, banana, coconut] the first purchase will be apple, the second banana and so on. When it gets to the end it starts from the beginning again. +

+

+ Powered by LNURL-pay.

@@ -19,6 +32,31 @@ label="API info" :content-inset-level="0.5" > + + + + POST +
Headers
+ {"X-Api-Key": <invoice_key>}
+
Body (application/json)
+
Returns 201 OK
+
Curl example
+ curl -X GET {{ request.url_root + }}/offlineshop/api/v1/offlineshop/items -H "Content-Type: + application/json" -H "X-Api-Key: {{ g.user.wallets[0].inkey }}" -d + '{"name": <string>, "description": <string>, "image": + <data-uri string>, "price": <integer>, "unit": <"sat" or + "USD">}' + +
+
+
Returns 200 OK (application/json) - [<offlineshop object>, ...] + {"id": <integer>, "wallet": <string>, "wordlist": + <string>, "items": [{"id": <integer>, "name": <string>, "description": <string>, "image": <string>, "enabled": <boolean>, "price": <integer>, "unit": <string>, "lnurl": <string>}, ...]}</code + >
Curl example
curl -X GET {{ request.url_root }}/offlineshop/api/v1/offlineshop -H @@ -43,4 +84,46 @@
+ + + + PUT +
Headers
+ {"X-Api-Key": <invoice_key>}
+
Body (application/json)
+
Returns 200 OK
+
Curl example
+ curl -X GET {{ request.url_root + }}/offlineshop/api/v1/offlineshop/items/<item_id> -H + "Content-Type: application/json" -H "X-Api-Key: {{ + g.user.wallets[0].inkey }}" -d '{"name": <string>, + "description": <string>, "image": <data-uri string>, + "price": <integer>, "unit": <"sat" or "USD">}' + +
+
+
+ + + + DELETE +
Headers
+ {"X-Api-Key": <invoice_key>}
+
Body (application/json)
+
Returns 200 OK
+
Curl example
+ curl -X GET {{ request.url_root + }}/offlineshop/api/v1/offlineshop/items/<item_id> -H "X-Api-Key: + {{ g.user.wallets[0].inkey }}" + +
+
+