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 (opens in a new tab).
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.
- Indexed (create Lightning addresses) customers via LNURL. Do that here
- Domain with HTTPS
- 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.
- 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.
You might have noticed that there isn't much difference in receiving payments via lnurl because addresses are just an extra layer on lnurl.