Skip to content
Privacy Dedicated Library

Accept Bitcoin payments on your website without third-parties

May 17, 2022

In this article we will cover how to run your own Bitcoin payment gateway and accept payments on your website directly. There are numerous Bitcoin processing companies, but if you are a true fan of Bitcoin (or some other cryptocurrency) you would love an idea of running your own gateway. If you want to have an idea how it looks like, you can check our latest article about “How to host website anonymously and pay with Bitcoin” as it gives some info how this gateway looks and works. Today we will learn:

Advantages

Running your own Bitcoin gateway gives you freedom of payments, including cross-border transactions. You are not dependent on the policies of the third-party company and you know that the money you receive from your clients will be yours. Moreover, the fees are at the lowest level right now. Comparing to credit card processing fees ranging from 5% to 10% (and $1-$2 minimum per tx), Bitcoin gives you clear advantage by having the median transaction fee of 5 cents.

The next important thing is that Bitcoin is an appreciating asset due to its deflationary model. So, besides having fun of being your own bank and processing company you will be “stacking sats” – a rare and valuable asset. Look at the chart below.

Bitcoin price chart

BTCPay Server

Back in 2017 Bitpay was the biggest processing for Bitcoin payments. But after they tried to mislead people into promoting SegWit2X, the legendary tweet of Nicolas Dorier put start of BTCPayServer development.

For the last 5 years, BTCPay Server has become a truly top-notch solution for accepting Bitcoin payments along with major Altcoins. In case you do not feel tech-savvy enough to setup your own gateway, you can always turn to our commercial crypto payment gateway solution. But if you are here for the adventure and knowledge, go ahead reading.

Implementation

As you already know, we will use BTCPay Server for our Bitcoin Gateway setup. What you can expect from this gateway:

  • accept Bitcoin and Litecoin;
  • accept ETH and 50+ altcoins;
  • integration with your hardware wallet;
  • plugins for major shopping software – Magento, Shopify, Woo, Presta etc.;
  • invoicing, pull payments, payment buttons, accounting;
  • POS support

Requirements

  • Ubuntu 18.04 / 20.04;
  • 1Ghz CPU;
  • 2 GB RAM;
  • at least 100Gb disk space

Installation

  1. Make sure that your domain or sub-domain you will use for your crypto gateway is pointed to the server. An appropriate “A” record is created within DNS settings of your domain. For our testing purpose, we will use testbtcpay.yohost.org.
  2. Log in under root user. If you run Ubuntu not under root, then sudo -su
  3. Install with commands below:
mkdir BTCPayServer
cd BTCPayServer
git clone https://github.com/btcpayserver/btcpayserver-docker
cd btcpayserver-docker

export BTCPAY_HOST="testbtcpay.yohost.org"
export NBITCOIN_NETWORK="mainnet"
export BTCPAYGEN_CRYPTO1="btc"
export BTCPAYGEN_ADDITIONAL_FRAGMENTS="opt-save-storage-s"
export BTCPAYGEN_REVERSEPROXY="nginx"
export BTCPAYGEN_LIGHTNING="clightning"
export BTCPAY_ENABLE_SSH=true

. ./btcpay-setup.sh -i

Commands above will install all required utilities and start BTCPayServer. opt-save-storage-s defines how many blocks of Bitcoin blockchain will be stored on the server. Read here for more info: https://docs.btcpayserver.org/Docker/#generated-docker-compose

BtcPayServer Crypto Gateway Installation Complete

SSL

You might need to manually re-run Letsencrypt to ensure your BTCPayServer crypto gateway is secured with SSL. Run the commands below.

cd btcpayserver-docker
docker restart letsencrypt-nginx-proxy-companion

Creating an admin user

At your first login at “testbtcpay.yohost.org“, you will be prompted to create a user.

Create a user

Once you create a user, you will be redirected to the admin area.

Installation complete

Congratulations! You have installed your own Bitcoin payment gateway. After installation is complete, your node will have to sync with the entire Bitcoin blockchain. This can take a while.

Now you can proceed creating and configuring your first store. We will cover this in our next article and describe how to enable ShapeShift and accept 50+ other cryptocurrencies besides Bitcoin.

Update: Part 2 is already here.