OpenReceive for FOSSBilling
Take Bitcoin Lightning payments on FOSSBilling invoices, straight into your own wallet. The client picks the payment method on FOSSBilling's own invoice page, and the invoice turns paid as with any other gateway, so FOSSBilling activates or renews the service and sends its emails.
OpenReceive supports optional swaps from USDT, USDC, SOL and ETH through a configured swap provider. The provider converts the payment to BTC over Lightning, which settles into your connected wallet. Available assets and networks depend on the provider; swaps are optional.
FOSSBilling keeps owning clients, invoices, prices and services. The extension keeps its payment attempts in two tables of FOSSBilling's own database, and records a settled payment the way FOSSBilling's own gateways do.
Requirements
- FOSSBilling 0.8.0 or later
- 64-bit PHP 8.3 or later with the GMP and sodium extensions. FOSSBilling's official Docker image lacks GMP; the quickstart has the two-line Dockerfile that adds it.
- FOSSBilling's MySQL or MariaDB database, with its cron job running
- A receive-only NWC (Nostr Wallet Connect) code from your Lightning wallet: one that can create invoices and read payments but cannot spend. The extension refuses a code that can spend.
Install
- In the admin area, open Extensions, find OpenReceive and click Install.
- Activate OpenReceive. Activation creates the extension's two tables, hooks its reconcile pass into FOSSBilling's cron, and writes the payment gateway into
library/Payment/Adapter/OpenReceive, so the web server's user must be able to write tolibrary/Payment/Adapter. The new payment gateway, "Bitcoin Lightning", stays off until a wallet code is saved. - Open the settings (gear) button on OpenReceive. Paste the code into Receive-only NWC code and save. To accept stablecoins too, paste a swap provider code into Swap provider code. Both are stored encrypted and never shown again.
Saving the wallet code turns the payment method on. To check the install, run these in FOSSBilling's folder as the web server's user:
php console.php openreceive:doctor
php console.php openreceive:test-invoice --new
doctor checks the install, the wallet, the price feed and the cron hook. test-invoice --new makes a $5 Lightning invoice for a test client, so no real client sees it.
Update
FOSSBilling 0.8 has no update button for directory extensions. To update, download openreceive-fossbilling-.zip from the latest release, unzip it in FOSSBilling's folder (the one that holds console.php), then run php modules/Openreceive/activate.php as the web server's user. Activating again brings the payment gateway up to date.
Links
- FOSSBilling quickstart: Docker, wallet setup, checks, refunds and removal
- Source code
MIT licensed. Part of OpenReceive.