Hi, I'm a python developer (trainee) and I was looking for a way to generate lightning invoices in my script, I found out that @getalby has an api to interact with your wallet, but I was wondering if there would be more ways. Can you think of any ideas of banckends or methods to generate lightning invoices inside a python script? Use case: The app I'm designing is an event logger, where the user enters a series of parameters that at the end of the script are saved in a csv file, the idea is that each of these events has a price field and could be interpreted as an invoice that I would like to be able to generate with lightning.

I appreciate any guidance, thank you


If you'd like to generate a bolt11 invoice you'll either need to

  1. run a lightning node and request the invoice directly from the node
  2. run a lightning node and use some kind of service layer (like alby or a lnurl-pay service) that requests the invoice from the node for you indirectly
  3. if you don't mind custodial services, you can use a custodial service that has lnurl-pay support and get a bolt11 invoice that way

Yes, I thought about using my node, but that's a solution for me only, I don't have a node for 'public' use at the moment. My idea is that once I have this script in production I can share the repository and others can use it without depending on having a node. Can you think of a custodial service that fits? So far the solution I can think of is to integrate it with lightning tip bot or lntxbot in telegram. The ideal would be an api that I could call inside my script and it would generate the invoice.

Pd thanks for replying, I really appreciate your guidance :)

Ah, in that case I'd just use a lightning address! Whoever uses your script can just put in a new lightning address and begin making money with it; lightning addresses can be thought of as a human readable lnurl-pay code. Lots of custodial wallets support lightning addresses and lots of 3rd parties allow you to use them as a lightning address for non-custodial nodes.

why don't you just use https://lnbits.com/

some small lightning services are using it

like https://lnvpn.net/ https://storage4sats.surge.sh/

you mean for generate the invoices? yea, but I'm looking for a solution that everyone can use without needing to have an lnbits