Receiving payments with lightning addresses

When users of other services enter a lightning address generated by your service, they follow the lnurl-pay standard to connect with your service to make payments.

To make this possible, you must have indexed/registered a Lightning address for your users. Start here. An LNURL is a static internet identifier.

After creating a Lightning address, other services will send requests to your customers for payment invoices without them having to manually create invoices.

You need the following items to easily accept payments via lightning addresses on Bitnob.

  1. Indexed (create Lightning addresses) customers via LNURL. Do that here
  2. Domain with HTTPS
  3. Configuring your custom domain for routing through Bitnob

Server Configuration

Depending on the kind of setup you have and how you will want to host lightning addresses, there are several ways you can configure your server to allow us to handle the process of receiving payments for you.

  1. You want to use an existing domain with an existing project. E.g You have an existing app called Bitcoin and your domain is bitcoin.org. If you want your lightning address to use this domain, then we recommend this kind of configuration.

Configuration for services running behind Nginx

Add the following configuration to your Nginx

location /.well-known/lnurlp {
     rewrite ^/.well-known/lnurlp(.*)$ https://api.bitnob.co/<your-public-api-key>/lnurlp$1 permanent;
     return 301;
 }

location /lnurlpay {
     rewrite ^/lnurlpay(.*)$ https://api.bitnob.co/lnurlpay/<your-public-api-key>$1 permanent;
     return 301;
 }

Configuration for services running behind Apache webservers

<IfModule mod_rewrite.c>
# LNURL CONFIG
RewriteCond %{REQUEST_URI} ^/\.well\-known/lnurlp
RewriteRule ^.well\-known/lnurlp(.*)$ https://api.bitnob.co/your-public-api-key/lnurlp$1 [R=301,L]

RewriteCond %{REQUEST_URI} ^/lnurlpay
RewriteRule ^lnurlpay(.*)$ https://api.bitnob.co/your-public-api-key/lnurlpay$1 [R=301,L]
</IfModule>

Important - this apache config should be added at the top of the config file.

What this does is redirect all requests to your service to Bitnob for handling the complex parts of the payment flow.

👍

Domain and server configuration

For a lot of services, you are probably running the website and backend on separate domains. E.g website is on bitcoin.org while the backend is on api.bitcoin.org. You only need to add these config details to the server hosting the website

You might have noticed that there isn't much difference in receiving payments via lnurl because addresses are just an extra layer on lnurl.


Did this page help you?