<blockquote>
<p>Are there any good tutorials to recommend for setting up a paywall like this? I have been googling and googling and not really finding anything useful...... And the lightning documentation is a bit vague and lacking specifics.</p>
</blockquote>
<p>No because there is no a good implementation that ship the right API for this use case, I am sorry!</p>
<p>I will put here the idea and maybe you will implement for your implementation (if you are working with core lightning you can ping me to chat about).</p>
<p>Basically, you need a &quot;subscribe&quot; mechanism that it is not blocking, so you generate an invoice with a Post request but you listen to the event over a ws.</p>
<p>So a single ws channel that streams to you all the events of a particular invoice that was paid or not.</p>
<p>This with a core lightning plugin is very trivial but no one was able or interested to implement it (I do not know if cln-rest is doing somethings like this I did not review the PR that get merged but the suggestion that I gave was this one too)</p>

CC BY-SA 4.0
2023-08-13T08:41:49.950Z
2023-08-13T08:41:49.950Z
vincenzopalazzo
<p>I am interested in implementing a micro-transaction &quot;paywall&quot; that will allow anonymous users access to a web application that I am building.  Each unique visit to the home page of the application would trigger an api call that will generate an invoice for that specific session and present the user with a QR code for them to make a payment that will grant access for that particular session.</p>
<p>My question is, how many invoices can realistically be monitored with <code>SubscribeSingleInvoice</code> before this would be a problem?  Like if 100,000 people simultaneously visited the app, that would be 100,000 unique invoices generated and subscribed to...  Which seems like that could be a bad scene...  Though I would be setting these invoices to expire some-what shortly, like 5-10 minutes, assuming if they haven't paid within that time frame, they're most likely not going to be paying at all.</p>
<p>Are there any good tutorials to recommend for setting up a paywall like this?  I have been googling and googling and not really finding anything useful......  And the lightning documentation is a bit vague and lacking specifics.</p>
<p>Also, a side question is, to do this, is it really necessary to run a bitcoind backend?  I was reading about neutrino, and saw LND lets you use that as a backend..  Since I am only interested in generating invoices and microt-ransactions and detecting when they have been paid, is it possible to use neutrino for this so that my app can have less of a heavy infrastructure footprint?</p>

<lightning-network><lightning-network-daemon><invoices>
How to go about performing invoice generation / payment processing with lightning network?
patrick
# How to go about performing invoice generation / payment processing with lightning network?

(Asked by: username_0 on 2023-06-26)

I am interested in implementing a micro-transaction "paywall" that will allow anonymous users access to a web application that I am building. Each unique visit to the home page of the application would trigger an api call that will generate an invoice for that specific session and present the user with a QR code for them to make a payment that will grant access for that particular session.

My question is, how many invoices can realistically be monitored with `SubscribeSingleInvoice` before this would be a problem? Like if 100,000 people simultaneously visited the app, that would be 100,000 unique invoices generated and subscribed to... Which seems like that could be a bad scene... Though I would be setting these invoices to expire some-what shortly, like 5-10 minutes, assuming if they haven't paid within that time frame, they're most likely not going to be paying at all.

Are there any good tutorials to recommend for setting up a paywall like this? I have been googling and googling and not really finding anything useful...... And the lightning documentation is a bit vague and lacking specifics.

Also, a side question is, to do this, is it really necessary to run a bitcoind backend? I was reading about neutrino, and saw LND lets you use that as a backend.. Since I am only interested in generating invoices and microt-ransactions and detecting when they have been paid, is it possible to use neutrino for this so that my app can have less of a heavy infrastructure footprint?

**Tags:** lightning-network, lightning-network-daemon, invoices


---

## 1 answers

### Answer by username_1 on 2023-08-13. Score: 0

> Are there any good tutorials to recommend for setting up a paywall like this? I have been googling and googling and not really finding anything useful...... And the lightning documentation is a bit vague and lacking specifics.

No because there is no a good implementation that ship the right API for this use case, I am sorry!

I will put here the idea and maybe you will implement for your implementation (if you are working with core lightning you can ping me to chat about).

Basically, you need a "subscribe" mechanism that it is not blocking, so you generate an invoice with a Post request but you listen to the event over a ws.

So a single ws channel that streams to you all the events of a particular invoice that was paid or not.

This with a core lightning plugin is very trivial but no one was able or interested to implement it (I do not know if cln-rest is doing somethings like this I did not review the PR that get merged but the suggestion that I gave was this one too)


---

