Nostream can charge an admission fee before it accepts a pubkey's events.
Set payments.enabled, choose one processor, and restart the relay.
- Before you begin
- Complete the Production Setup Guide or the quick start
- Create a
.envfile - On
.nostr/settings.yamlfile make the following changes:- Set
payments.enabledtotrue - Set
payments.feeSchedules.admission[0].enabledtotrue. The schedules are a list and[0]is the entry you edit; the relay charges the sum of every enabled schedule whose pubkey whitelist does not cover the payer, so more than one entry costs more than one fee. The invoice page quotes[0]alone (get-invoice-controller.ts:56), so with two enabled schedules it shows less than the invoice charges - Set
limits.event.pubkey.minBalanceto the minimum balance in msats required to accept events (i.e.1000000to require a balance of1000sats)
- Set
- Choose one of the following payment processors:
zebedee,nodeless,opennode,lnbits,lnurl,nwc
Each processor step ends with nostream stop and nostream start, which is the quick start's CLI. A host deployed with Docker Compose has no such command: recreate the relay instead, with ./deploy/recreate-relay.sh /opt/nostream from a checkout or the host copy described in DEPLOY-RUNBOOK.md, which also lists the manual equivalent. Run it as the user who ran deploy/bootstrap.sh, since that user owns /opt/nostream/.env and mode 600 keeps everyone else out. Bootstrap does not install the script, so read that section before relying on it.
- ZEBEDEE
- Complete the step "Before you begin"
- Sign up for a ZEBEDEE Developer Dashboard account, create a new LIVE Project, and get that Project's API Key
- Set
ZEBEDEE_API_KEYenvironment variable with the API Key above on your.envfile
ZEBEDEE_API_KEY={YOUR_ZEBEDEE_API_KEY_HERE}
- Follow the required steps for all payments processors
- On
.nostr/settings.yamlfile make the following changes:payments.processortozebedeepaymentsProcessors.zebedee.callbackBaseURLto match your nostream URL (e.g.https://{YOUR_DOMAIN_HERE}/callbacks/zebedee)
- Restart nostream (
nostream stopfollowed bynostream start) - Read the in-depth guide for more information: Set Up a Paid Nostr Relay with ZEBEDEE API
- Nodeless
- Complete the step "Before you begin"
- The processor is not usable as shipped:
resources/default-settings.yamlpointspaymentsProcessors.nodeless.baseURLathttps://nodeless.io, and that domain no longer resolves, so invoice creation and checks fail at the network. The steps below apply if you have a working host to point that setting at - Go to Profile > API Tokens and generate a new key and take note of it
- Create a store webhook with your Nodeless callback URL (e.g.
https://{YOUR_DOMAIN_HERE}/callbacks/nodeless) and make sure to enable all of the events. Grab the generated store webhook secret - Set
NODELESS_API_KEYandNODELESS_WEBHOOK_SECRETenvironment variables with generated API key and webhook secret, respectively
NODELESS_API_KEY={YOUR_NODELESS_API_KEY}
NODELESS_WEBHOOK_SECRET={YOUR_NODELESS_WEBHOOK_SECRET}
- On your
.nostr/settings.yamlfile make the following changes:- Set
payments.processortonodeless - Set
paymentsProcessors.nodeless.storeIdto your store ID
- Set
- Restart nostream (
nostream stopfollowed bynostream start)
-
-
Complete the step "Before you begin"
-
Sign up for a new account and get verified
-
Go to Developers > Integrations and setup two-factor authentication
-
Create a new API Key with Invoices permission
-
Set
OPENNODE_API_KEYenvironment variable on your.envfileOPENNODE_API_KEY={YOUR_OPENNODE_API_KEY} -
On your
.nostr/settings.yamlfile make the following changes:- Set
payments.processortoopennode - Set
paymentsProcessors.opennode.callbackBaseURLto match your nostream URL (e.g.https://{YOUR_DOMAIN_HERE}/callbacks/opennode)
- Set
-
Restart nostream (
nostream stopfollowed bynostream start)
-
-
-
Complete the step "Before you begin"
-
Create a new wallet on you public LNbits instance
- Demo server must not be used for production
- Your instance must be accessible from the internet and have a valid SSL/TLS certificate
-
Get wallet Invoice/read key (in Api docs section of your wallet)
-
set
LNBITS_API_KEYenvironment variable with the Invoice/read key Key above on your.envfileLNBITS_API_KEY={YOUR_LNBITS_API_KEY_HERE} -
On your
.nostr/settings.yamlfile make the following changes:- Set
payments.processortolnbits - set
paymentsProcessors.lnbits.baseURLto your LNbits instance URL (e.g.https://{YOUR_LNBITS_DOMAIN_HERE}/) - Set
paymentsProcessors.lnbits.callbackBaseURLto match your nostream URL (e.g.https://{YOUR_DOMAIN_HERE}/callbacks/lnbits)
- Set
-
Restart nostream (
nostream stopfollowed bynostream start)
-
-
Alby, or another LNURL-pay provider that serves its callback at
<invoiceURL>/callback. That path is a nostream requirement, not something LUD-06 guarantees, since a provider may advertise any callback it likes. LNURL-verify support is also needed- Complete the step "Before you begin"
- Create a new account if you don't have an LNURL
- On your
.nostr/settings.yamlfile make the following changes:- Set
payments.processortolnurl - Set
paymentsProcessors.lnurl.invoiceURLto your LNURL-pay address up to but excluding/callback(e.g.https://getalby.com/lnurlp/your-username, with your own username)
- Set
- Restart nostream (
nostream stopfollowed bynostream start)
-
Nostr Wallet Connect (NIP-47 / NWC)
-
Complete the step "Before you begin"
-
Create an app connection in your NWC-compatible wallet and copy the generated NWC URL
-
Set
NWC_URLenvironment variable on your.envfileNWC_URL={NOSTR_WALLET_CONNECT_URL} -
On your
.nostr/settings.yamlfile make the following changes:- Set
payments.processortonwc
- Set
-
Restart nostream (
nostream stopfollowed bynostream start)
-
-
Ensure payments are required for your public key
- Visit https://{YOUR-DOMAIN}/
- You should be presented with a form requesting an admission fee to be paid
- Fill out the form and take the necessary steps to pay the invoice
- Wait until the screen indicates that payment was received
- Add your relay URL to your favorite Nostr client (wss://{YOUR-DOMAIN}) and wait for it to connect
- Send a couple notes to test
- Go to https://websocketking.com/ and connect to your relay (wss://{YOUR_DOMAIN})
- Convert your npub to hexadecimal using a Key Converter
- Send the following JSON message:
["REQ", "payment-test", {"authors":["your-pubkey-in-hexadecimal"]}] - You should get back the few notes you sent earlier