mirror of
https://github.com/aljazceru/breez-sdk-docs.git
synced 2025-12-17 05:44:20 +01:00
address feedback
This commit is contained in:
@@ -6,17 +6,37 @@ In order to interact with the user node the service uses a simple protocol over
|
||||
The service sends a push notification to the user node with the lnurlpay request and a reply url, the user node then uses the reply url to responds with the required data which is then forwarded from the service to the payer.
|
||||
|
||||
## General workflow
|
||||
Although the protocol is application specific, the general workflow is as follows:
|
||||
The protocol is application specific and the steps detiled below refer to the c-breez wallet implementation which requires running <b>[breez-lnurl](https://github.com/breez/breez-lnurl) </b>service.
|
||||
|
||||
### Step 1: User node register for an lnurlpay service
|
||||
Use the service endpoint https://app.domain/lnurlpay/[pubkey] to register the user node for an lnurlpay service.
|
||||
In order to verify the request the payload should be signed with the user node private key.
|
||||
The service responds with a valid lnurlpay url, for example: https://app.domain/lnurlp/[pubkey]
|
||||
Use a POST request to the service endpoint <b>https://app.domain/lnurlpay/[pubkey]</b> to register the user node for an lnurlpay service.
|
||||
This request should contain the following payload:
|
||||
<section>
|
||||
<pre>
|
||||
{
|
||||
"time": "seconds since epoch",
|
||||
"webhook_url": "notification service webhook url",
|
||||
"signature": "signed payload"
|
||||
}
|
||||
</pre>
|
||||
</section>
|
||||
|
||||
|
||||
In order to verify the request the following payload fields should be signed with the user node private key: <b>[time]-[webhook_url]</b>.
|
||||
The service responds with following payload:
|
||||
<section>
|
||||
<pre>
|
||||
{
|
||||
"lnurl": "[valid lnurlpay url]",
|
||||
}
|
||||
</pre>
|
||||
</section>
|
||||
|
||||
|
||||
### Step 2: External wallet scans the lnurlpay url
|
||||
The external wallet scans the lnurlpay url and parse the lnurlpay request.
|
||||
It then behaves according to the lnurlpay protocol and performs a GET request to https://app.domain.com/lnurlp/[pubkey].
|
||||
The service then sends a push notification to the user node with the lnurlpay request and a callback url. Such payload may look like this:
|
||||
It then behaves according to the lnurlpay protocol and performs a GET request to the scanned lnurl pay url.
|
||||
This hits the service which in respond sends a push notification to the user node with the lnurlpay request and a callback url. Such payload may look like this:
|
||||
|
||||
<section>
|
||||
<pre>
|
||||
@@ -30,8 +50,8 @@ The service then sends a push notification to the user node with the lnurlpay re
|
||||
</pre>
|
||||
</section>
|
||||
|
||||
The reply_url is used by the user node to respond to the lnurlpay request.
|
||||
The callback_url is the lnurlpay callback url for the payer to fetch the invoice.
|
||||
The <b>reply_url</b> is used by the user node to respond to the lnurlpay request.
|
||||
The <b>callback_url</b> is the lnurlpay callback url for the payer to fetch the invoice.
|
||||
|
||||
### Step 3: User node responds to the callback url
|
||||
The user node receives the push notification, parses the payload and then uses the reply_url to responds with the required data as per the lnurlpay protocol, for example:
|
||||
@@ -52,7 +72,7 @@ The service receives the response from the mobile and forward the response to th
|
||||
|
||||
### step 4: External wallet fetches the invoice
|
||||
|
||||
The external wallet uses the callback_url to fetch the invoice and perform a GET request with the amount as a parameter. In our example it is: https://app.domain.com/lnurlpay/invoice?amount=1000
|
||||
The external wallet uses the callback_url to fetch the invoice and perform a GET request with the amount as a parameter. In our example it is: <b>https://app.domain.com/lnurlpay/invoice?amount=1000</b>
|
||||
The push notification is used again to send the request to the user node and the user node replies with the invoice.
|
||||
|
||||
### step 5: External wallet pays the invoice
|
||||
|
||||
Reference in New Issue
Block a user