Zero Fees
No transaction fees beyond Bitcoin network fees
BTCPay Server is a free, open-source, and self-hosted Bitcoin payment processor that allows merchants to accept Bitcoin without fees, intermediaries, or third-party involvement. As a true non-custodial solution, payments go directly to your wallet—your private keys never leave your server.
Built with .NET Core and PostgreSQL, BTCPay Server provides a complete payment infrastructure including invoicing, point-of-sale, crowdfunding, and support for Lightning Network payments. Over 7,000 merchants worldwide trust BTCPay Server for their Bitcoin payment processing needs.
Zero Fees
No transaction fees beyond Bitcoin network fees
Non-Custodial
Complete control over your private keys
Lightning Network
Instant, low-cost payments via Lightning
Self-Hosted
Your server, your rules, your data
BTCPay Server offers comprehensive Bitcoin payment processing:
| Feature | Description |
|---|---|
| Invoice Management | Create and track Bitcoin payment invoices |
| Point of Sale | Built-in POS app for retail environments |
| Payment Requests | Shareable payment links |
| Crowdfunding | Host Bitcoin crowdfunding campaigns |
| Lightning Network | Support for LND, Core Lightning, and Eclair |
| Multi-tenant | Host multiple stores on one instance |
| Hardware Wallet | Integration with Ledger, Trezor, and more |
| API Access | Full Greenfield REST API |
BTCPay Server is a complex multi-component system:
| Component | Purpose | Required |
|---|---|---|
| BTCPay Server | Main web application and API | Yes |
| NBXplorer | Lightweight blockchain explorer | Yes |
| Bitcoin Core | Full Bitcoin node | Yes |
| PostgreSQL | Database for BTCPay and NBXplorer | Yes |
| Lightning (LND/CLN) | Lightning Network payments | Optional |
| Nginx | Reverse proxy with SSL | Recommended |
Given BTCPay Server’s complexity, there are several deployment approaches:
Deploy each component as a separate Klutch.sh app:
Deploy only BTCPay Server on Klutch.sh, connecting to:
For smaller deployments, consider third-party BTCPay hosting services.
Before deploying BTCPay Server on Klutch.sh, ensure you have:
Set up your BTCPay Server deployment repository:
Create a Dockerfile for BTCPay Server:
FROM btcpayserver/btcpayserver:latest
# BTCPay Server runs on port 49392 by default in the container# The environment variables control the actual bindingENV BTCPAY_BIND="0.0.0.0"ENV BTCPAY_PORT="49392"
# Data directory for BTCPay ServerENV BTCPAY_DATADIR="/datadir"
# Expose the application portEXPOSE 49392
# Volume for persistent dataVOLUME /datadirFor more control, build BTCPay Server from source:
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS builder
WORKDIR /source
# Clone BTCPay ServerRUN git clone --depth 1 --branch latest https://github.com/btcpayserver/btcpayserver.git .
# Build the applicationRUN cd BTCPayServer && dotnet publish -c Release -o /app
# Runtime imageFROM mcr.microsoft.com/dotnet/aspnet:8.0
RUN apt-get update && apt-get install -y --no-install-recommends \ iproute2 openssh-client ca-certificates \ && rm -rf /var/lib/apt/lists/*
WORKDIR /appCOPY --from=builder /app .
ENV BTCPAY_DATADIR=/datadirENV BTCPAY_BIND=0.0.0.0ENV BTCPAY_PORT=49392
EXPOSE 49392VOLUME /datadir
ENTRYPOINT ["dotnet", "BTCPayServer.dll"]BTCPay Server is configured primarily through environment variables:
| Variable | Description | Example |
|---|---|---|
BTCPAY_POSTGRES | PostgreSQL connection string | Host=postgres;Database=btcpay;... |
BTCPAY_BTCEXPLORERURL | NBXplorer URL for Bitcoin | http://nbxplorer:32838/ |
BTCPAY_NETWORK | Bitcoin network | mainnet, testnet, regtest |
BTCPAY_BIND | Bind address | 0.0.0.0 |
BTCPAY_PORT | Server port | 49392 |
| Variable | Description |
|---|---|
BTCPAY_POSTGRES | Full PostgreSQL connection string |
BTCPAY_EXPLORERPOSTGRES | NBXplorer database connection (optional) |
Example PostgreSQL connection string:
User ID=btcpay;Password=yourpassword;Host=your-postgres-host;Port=5432;Database=btcpay;| Variable | Description |
|---|---|
BTCPAY_ROOTPATH | Root path for reverse proxy |
BTCPAY_SSHCONNECTION | SSH connection for server management |
BTCPAY_SSHTRUSTEDFINGERPRINTS | SSH fingerprints |
| Variable | Description |
|---|---|
BTCPAY_BTCLIGHTNING | Lightning connection string |
Example LND connection:
type=lnd-rest;server=https://lnd:8080/;macaroonfilepath=/path/to/admin.macaroon;allowinsecure=trueExample Core Lightning connection:
type=clightning;server=unix://root/.lightning/bitcoin/lightning-rpc| Variable | Description | Default |
|---|---|---|
BTCPAY_DEBUGLOG | Enable debug logging | false |
BTCPAY_UPDATEURL | Update check URL | BTCPay default |
BTCPAY_DOCKERDEPLOYMENT | Docker deployment mode | false |
Test your BTCPay Server setup locally:
services: btcpayserver: image: btcpayserver/btcpayserver:latest ports: - "49392:49392" depends_on: postgres: condition: service_healthy nbxplorer: condition: service_started environment: BTCPAY_POSTGRES: "User ID=btcpay;Password=btcpay;Host=postgres;Port=5432;Database=btcpay;" BTCPAY_NETWORK: "regtest" BTCPAY_BIND: "0.0.0.0" BTCPAY_PORT: "49392" BTCPAY_BTCEXPLORERURL: "http://nbxplorer:32838/" BTCPAY_DEBUGLOG: "btcpay.log" volumes: - btcpay_data:/datadir
postgres: image: postgres:16-alpine environment: POSTGRES_DB: btcpay POSTGRES_USER: btcpay POSTGRES_PASSWORD: btcpay volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U btcpay -d btcpay"] interval: 5s timeout: 5s retries: 5
bitcoind: image: btcpayserver/bitcoin:29.1 environment: BITCOIN_NETWORK: "regtest" BITCOIN_EXTRA_ARGS: | server=1 rpcuser=rpc rpcpassword=rpc rpcallowip=0.0.0.0/0 rpcbind=0.0.0.0 volumes: - bitcoin_data:/data
nbxplorer: image: nicolasdorier/nbxplorer:latest depends_on: - bitcoind environment: NBXPLORER_NETWORK: "regtest" NBXPLORER_BTCRPCURL: "http://bitcoind:43782/" NBXPLORER_BTCRPCUSER: "rpc" NBXPLORER_BTCRPCPASSWORD: "rpc" NBXPLORER_BIND: "0.0.0.0" NBXPLORER_PORT: "32838" volumes: - nbxplorer_data:/datadir
volumes: btcpay_data: postgres_data: bitcoin_data: nbxplorer_data:Create a PostgreSQL app on Klutch.sh
See our PostgreSQL deployment guide for detailed instructions.
Create the BTCPay database
CREATE DATABASE btcpay TEMPLATE 'template0' LC_CTYPE 'C' LC_COLLATE 'C' ENCODING 'UTF8';CREATE USER btcpay WITH ENCRYPTED PASSWORD 'your-secure-password';GRANT ALL PRIVILEGES ON DATABASE btcpay TO btcpay;Note your connection details
Option A: Deploy Bitcoin Core on Klutch.sh
/dataFROM btcpayserver/bitcoin:29.1
ENV BITCOIN_NETWORK=mainnetENV BITCOIN_EXTRA_ARGS="server=1\nrpcuser=btcpay\nrpcpassword=your-password\nrpcallowip=10.0.0.0/8\nprune=50000"
VOLUME /dataEXPOSE 8332 8333Option B: Use an external Bitcoin node
NBXplorer is required as the blockchain indexer:
Create a Dockerfile for NBXplorer
FROM nicolasdorier/nbxplorer:latest
ENV NBXPLORER_NETWORK=mainnetENV NBXPLORER_BIND=0.0.0.0ENV NBXPLORER_PORT=32838
VOLUME /datadirEXPOSE 32838Deploy on Klutch.sh
/datadir (10-20 GB)| Variable | Value |
|---|---|
NBXPLORER_NETWORK | mainnet |
NBXPLORER_BTCRPCURL | Your Bitcoin RPC URL |
NBXPLORER_BTCRPCUSER | Your RPC username |
NBXPLORER_BTCRPCPASSWORD | Your RPC password |
NBXPLORER_BIND | 0.0.0.0 |
NBXPLORER_PORT | 32838 |
Push your repository to GitHub
git initgit add .git commit -m "Initial BTCPay Server configuration"git remote add origin https://github.com/yourusername/btcpayserver.gitgit push -u origin mainCreate a new app on Klutch.sh
Configure environment variables
| Variable | Value |
|---|---|
BTCPAY_POSTGRES | User ID=btcpay;Password=yourpassword;Host=postgres-hostname;Port=5432;Database=btcpay; |
BTCPAY_BTCEXPLORERURL | http://nbxplorer-hostname:32838/ |
BTCPAY_NETWORK | mainnet |
BTCPAY_BIND | 0.0.0.0 |
BTCPAY_PORT | 49392 |
Configure the internal port
Set up persistent storage
| Mount Path | Size |
|---|---|
/datadir | 10 GB |
Deploy your application
https://your-app.klutch.shAfter deployment, configure your BTCPay Server:
Create your admin account
https://your-app.klutch.shCreate a store
Set up your wallet
Options include:
Generate a new wallet
Generate xpub from your hardware wallet
Import to BTCPay Server
To accept Lightning payments, connect a Lightning node:
type=lnd-rest;server=https://your-lnd-host:8080/;macaroonfilepath=/path/to/admin.macaroon;allowinsecure=truetype=clightning;server=unix://path/to/lightning-rpcUse BTCPay Server to accept payments:
Create a payment request
Share the payment page
BTCPay Server includes a built-in POS:
Create a POS app
Access the POS
BTCPay Server provides a comprehensive API:
Create an API key
curl -X POST "https://your-btcpay.klutch.sh/api/v1/stores/{storeId}/invoices" \ -H "Authorization: token YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "amount": "10.00", "currency": "USD", "metadata": { "orderId": "ORDER-123" } }'See the Greenfield API Documentation for complete reference.
Use Watch-Only Wallets
Keep private keys on hardware wallets, not on the server
Enable 2FA
Protect admin accounts with two-factor authentication
Regular Backups
Back up your database and wallet configuration
Keep Updated
Update BTCPay Server for security patches
Enable 2FA for all accounts:
Common issues and solutions:
| Issue | Cause | Solution |
|---|---|---|
| Can’t connect to database | Wrong connection string | Verify PostgreSQL credentials and hostname |
| NBXplorer not syncing | Bitcoin node not accessible | Check Bitcoin RPC connection |
| Invoice stuck pending | Blockchain not synced | Wait for NBXplorer to sync |
| Lightning not available | No Lightning node connected | Configure BTCPAY_BTCLIGHTNING |
| 502 errors | Port misconfiguration | Verify internal port is set to 49392 |
Monitor NBXplorer sync status through BTCPay Server:
Monitor logs through the Klutch.sh dashboard:
| Component | Location | Priority |
|---|---|---|
| PostgreSQL database | Your database server | Critical |
| BTCPay data directory | /datadir | Critical |
| Wallet configuration | In database | Critical |
| NBXplorer data | /datadir | Important |
pg_dump -Fc btcpay > btcpay_backup.dumppg_restore -d btcpay btcpay_backup.dump