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.
INTEGRATION WITH WOOCOMMERCE. SOMETHING NOT SUITABLE FOR BEGINNERS
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
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
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.
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:
ALTERNATIVE SOLUTION APPROACH
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.
STEPS TO FOLLOW
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.
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.