5 March 2021

Pay Button with BTCPAY Server and Mynode without Woocommerce

In this article, I comment on my experiments with BTCPAY Server integrated in Mynode, in order to be able to easily create a payment button to integrate on our website, autonomously, without having to have third-party services, against our own bitcoin node.


BTCPAY advertise itself as something easy and accessible for anyone who wants to open a business accepting bitcoins without the need to resort to third parties. As of today, this objective is certainly complex, even for those who have expert-level knowledge ( https://www.sosthene.net/btcpay-bilan/ ). As far as I can see, the average user is necessarily doomed to either spend the money on a Lunanode-like hosting solution, or at best, have to resort to a DDNS service like no-ip.com ( free) and turn to friends or professionals with high knowledge in the field. Another highly recommended option would be to use the services of bitcoinheiros . For those interested in this initiative, I recommend the recent talk led by Lunaticoin , accessible on youtube .

After many attempts and hours of study, I got stuck in step 3 of this tutorial ( https://docs.btcpayserver.org/DynamicDNS/ , Configure your BTCPay docker install to provide HTTPS certificates) for which you have to go to the command line and the instructions are simply that you connect to your “instance” and run some commands, without further explanation on, for example, how to access the “instance”. If the two previous steps can be done from the graphical interface, I do not understand why they have not done the same with this third step. Maybe that’s nonsense and you really have to do it like this, but I think this should be improved.

To access mynode by ssh, I think the most operative thing to do is to do it on the “settings” page

Image 1

But there it is accessed as admin, not as root and as indicated in the BTCPAY control panel it seems that it should be accessed as root

Picture 2

If you leave it so, when trying the pairing from Woocommerce (by the way we must put the virtual domain that we have followed by “: 49392”, the BTCPAY port) we get a message saying that we must access it through https or of TOR, without instructions on how to access with TOR.

Picture 3

Anyway … After giving up on my attempt to integrate BTCPAY with Woocomerce, I started to think of some other option to, at least, use the “Pay button” that can be configured once we generate a store in BTCPAY:

Picture 4


As we say, the idea was to create a payment button with bitcoins without the need to develop and match a store with Woocommerce or similar with our BTCPAY server, and all this, as BTCPAY is supposed to achieve, using its own means without having to resort to nodes or third-party payment button solutions that, among other things, carry commission in many cases.

We start from the base that we use as a tool Mynode and BTCPAY SERVER included in the Mynode package.

An artisanal solution is simply to give each new customer a new address and send it through traditional means, such as email, but the idea is an automatic solution so that each payment goes to a new address and thus not having to reuse addresses.

The objective, therefore, is to be able to create payment buttons easily, with the generation of an html code to include on the web so that BTCPAY SERVER can interact with our local node, regardless of the server where the web page is hosted where let’s insert the code.

After thinking a lot about the matter, the key to the solution that I present was given to me by the video https://www.youtube.com/watch?v=hQxCOSgYqTo from Satoshi Radio, which showed me the way forward.

Next, I explain the steps with which the commented solution is reached. I am not a computer scientist and surely there may be other methods to achieve the goal set; With this work, I simply explain the path followed in case it could be of interest and utility for other people in a similar or analogous situation.

The idea is to be able to create a payment button or, as indicated below, a link to generate receipts, based on Mynode’s BTCPAY Server, so that we can easily embed it on our website (hosted on a site other than the node de Mynode), which operates against our own Bitcoin node, and without the need to install and integrate BTCPAY with Woocommerce or similar platforms.


Store creation in BTCPAY Server

First, from Mynode we access BTCPAY Server and create a store. We will have to configure the wallet to which we associate the store, for which there are different options. One of them is to enter the public master key of a wallet whose private keys are not in the node or equipment connected to it. This will then allow each user, collaborator or client who clicks on the payment button or link to generate a new address not previously used, which benefits the privacy of both the site that hosts the payment button and the payer.

In the “Payment” section of “General Settings” of the store created, we have to enable the “Allow anyone to create invoice” box.

Picture 5

Enable VPN in Mynode

At first, I thought it was necessary to enable VPN access to our Mynode node ( https://mynodebtc.com/guide/vpn ) with the port forwarding mentioned in the guide. I did so in the beginning, but, curiously, I have realized that for this solution it is not necessary to enable the VPN in Mynode, nor the port forwarding in the router. We avoid all this port forwarding if we use TOR, as I comment at the end of the article.

BTCPAY Server port forwarding

This is one of the keys to the process, as it is necessary to do so if we do not want to use TOR. We have to go to our router and do a port forwarding (Port Forwarding) 49392 which is the one used by BTCPAY Server. Depending on your router, this will be done in one way or another. In this redirection, you will have to put the local IP of your Mynode node in a similar way to that mentioned in the previous section. I have tried to remove this forwarding and then, as expected, the thing does not work, unless we use the TOR option that I comment later.

Create the payment button

Once this is done, within the BTCPAY store menu we go to the “Pay Button” section and configure the parameters we want, such as the button payment amount, the size of the image, etc.

By clicking the Preview button on the right side, we can check if the whole process is on the right track.

Using the generated HTML code

Once everything is correct, at the end of the page we can see the “Generate Code” that will be something like the following:

If we look at it, there are 2 calls to… mynode.local: 49392… What we have to do is copy all the code, paste it into a plain text editor and replace the two instances of “mynode.local” with the public IP that it has. the Mynode node. If we paste that code in the WordPress input like this, I don’t know exactly for what reasons, the thing does not work well.

But if instead of copying the code, we paste it into a txt file, change the extension to html and upload it to the web as a standalone file, curiously then it works ( here example which will only work if we use TOR browser). Another problem that I have observed is that the image of the payment button does not resolve well depending on what circumstances. With the computer with which I am doing everything and locally, it goes well, but when I connected from my mobile or another device, the image did not load, although the link to generate the receipt did. I understand that a solution could be to download the image upload the file to the web and in the aforementioned txt replace the call to the image that is made to the node by the uploaded image. By the way, wordpress wouldn’t let me upload the svg file and what I had to convert to png.

In some browsers, and depending on the security settings, warnings may appear that the connection is not secure, but hey, this is an experiment and no data will be collected from the visitor. We must also bear in mind that in this way we are exposing the public IP of our node installation, which is why I decided not to make the html files that I referred to earlier accessible.

Creation of payment link for a fixed amount in FIAT currency

The truth is that I don’t really understand why I can’t put the payment button in an entry like this and yet I can put it in a separate html file. If you don’t want to go around with button flourishes and simply generate the receipt directly and for a fixed amount, instead of copying the code at the bottom of the page, you can copy the link that appears to the right of the “preview” image from the “Pay button” section. Keep in mind that every time we make a change in the configuration of the pay button, a new link is generated. And that link, changing “mynode.local” for the node’s public IP does seem to work. In this way, we can embed the link in a normal entry like this, either in text or in an image that we want.

But of course, the problem we have is that when generating the “invoice” the public IP of the node is being revealed, which affects our privacy .

An option to avoid this problem of revealing our IP would be to do the whole process from TOR . That is, we access MYNODE from TOR, from there we access btcpayserver and then the links that are generated, as well as the corresponding ” invoice”, are made to TOR addresses.

The links are generated with the pay button appear like this:
http://u76hm3kfcuro4qyf6mc7ng2x7optl75x6moq6r25ahkc2bx7wwhmsbqd.onion:49392/api/v1/invoices?storeId=FAy9ZoVKrixZwLECeS7FbJ7TkKpxpEm6NUunWGooeNo5&price= 5¤cy = EUR
and thus does not work the thing. The part in bold “5¤cy” should be replaced by “5&currency”. This error in the generation of the link text must be corrected. The error is in the text, the link that is generated after the text is correct. In addition, with this link, we can create all the payment instances that we want with different prices “price = X ” without having to enter the BTCPAY Server again.

Here are a couple of links generated with different values. That will only work if you are viewing the page using TOR Browser.

Example donate 5 euros.

Example donate 10 euros .

Example of a donation page_for variable amountIt will only work if you are viewing the page using TOR Browser.