Accept Bitcoin and receive Euro
This post is also available in: German
Accept Bitcoin and receive Euro
You sell something in your shop for €100,- and want to have €100,- credited to your bank account?
You want your customers to be able to pay with Bitcoin, but you want to be independent of fluctuations in value.
Use Bitcoin as another payment method in your online shop, like credit card or PayPal.
You sell your products for Euros, your customers pay with Bitcoin and you get Euros credited to your bank account.
In the following article you will learn how you can offer your customers payment via Bitcoin. The invoice amount is automatically converted to Bitcoin at the current value and the Customer pays with Bitcoin. Afterwards, the Bitcoin you have collected at a Bitcoin exchange will automatically be converted into euros and credited to your euro account.
This way you can offer Bitcoin as a payment method and have no risk of exchange rate fluctuations and no special features to consider in your accounting.
The end customer has goods worth €100 in his shopping cart and would like to pay for them with Bitcoin. The conversion is based on the exchange rate at the Bitcoin exchange, where much later the Bitcoin collected will be exchanged for euros.
Once the payment is successful, two processes are initiated. Once the Bitcoin countervalue received is exchanged for euros on the Bitcoin exchange.
At the same time, the Bitcoin ingested by the internal Bitcoin Wallet is forwarded to the Bitcoin Wallet at the Bitcoin Exchange.
Ideally, the sale of Bitcoin on the Bitcoin Exchange must take place at the same time as the payment of the end customer in order to exclude price fluctuations.
For this reason, a few Bitcoins have already been deposited with the Bitcoin Exchange, which will be used for sales. This deposit is replenished by Bitcoin, which has just been paid by the end customer.
If we assume six confirmations for the end customer’s payment to our internal Bitcoin Wallet and from there to our Bitcoin Wallet at the Bitcoin Exchange, this process can take up to two hours. In order to exclude an exchange rate risk within this period, we use this deposit.
This ensures that we exchange Bitcoin into euros at the same rate at which the end customer paid us with Bitcoin.
What you need:
For the implementation of the described procedure you need:
- a BTCPay store on a BTCPay server,
- an internal BTCPay Bitcoin Wallet
- a BTCPay Transmuter access and
- an account with a Bitcoin exchange such as Binance, Bitfinex, Bitstamp, Coinbase or Kraken
In the first step we select on the BTCPay server the store for which we want to do the automated exchange from Bitcoin to Euro.
There we have to make two settings. Once we will use the internal BTCPay Wallet and use the exchange rate of the Bitcoin exchange, where we will later exchange our Bitcoin into Euro.
internal BTCPay Bitcoin Wallet
We need the internal BTCPay Bitcoin Wallet for the implementation. To do this, we switch from the Store Settings in the General Settings area to the Derivation Scheme area.
There we have the possibility to create an internal BTCPay Bitcoin Wallet. .
A detailed description can be found in the article: Creation of an internal BTCPay Bitcoin Wallet
Bitcoin exchange rate
Then we select the Bitcoin exchange for the conversion of the Bitcoin rate, where we later want to exchange the Bitcoin for Euro. For this we go to the Store Settings in the Rates section.
Here you can choose for example the stock exchanges Binance, Bitfinex, Kraken or Coinbase.
In the field “Add a spread on exchange rate of … %” you can set a premium on the exchange rate. This would allow you to hedge against possible exchange rate fluctuations or indirectly price in the transaction fees that arise.
However, it is recommended that no surcharge be levied.
After we have made the settings within the BTCPay Store on the BTCPay Server, we log in to BTCPay Transmuter.
In the Presets section we already find a template for Fiat conversion.
After we have selected Fiat Conversion, the following page appears.
If we have already created a shop at Transmuter and connected it to our BTCPay server, then these shops are already suggested to us. In our case we have already created the email notification via BTCPay Transmuter for the Supporter Shop. You can find a description under: Receive email notification of a Bitcoin payment
If you don’t have a shop at BTCPay Transmuter yet or if you want to add another shop, here you will find instructions how to connect a store of BTCPay Transmuter with the BTCpay server.
In our case, we specify that the Bitcoin should be sold at the Bitcoin Exchange as soon as the status of the order is considered confirmed.
You can set when an order is considered confirmed under BTCPay Store > General Settings.
If you select the “is unconfirmed” setting, the payment is already considered completed as soon as the end customer has successfully executed the payment and the transaction is listed in the mempool.
This is also the ideal time to convert Bitcoin to Euro on the Bitcoin exchange, as it is expected that the Bitcoin will soon be confirmed by the block chain and then credited to our internal BTCPay wallet.
In the Setup your trading conditions section we define at which Bitcoin exchange we want to change our Bitcoin.
After we clicked Please create one first, the following page appears with the selection of all available Bitcoin exchanges.
This includes the most important Bitcoin exchanges such as Binance, Bitfinex, Bitstamp, Coinbase and Kraken.
After we have made a selection, we must enter an API key. We can obtain this API Key from the respective exchange.
To do this, we need to log in to the Bitcoin Exchange and find the area where the API is provided to us by the Exchange.
Usually this API key can be found in the personal settings.
At Binance you can find it in the API management section.
There you can then create an API.
The API Key provides full access to the account at the Bitcoin Exchange. The API access must be secured accordingly. Therefore, the API access must be confirmed with an email PIN and a two-factor authorization.
Then you get the API which is divided into a public key and a private key or API key and secret key.
If you have an account with Coinbase, you will find the area for the API Keys under Settings.
There you can create a new API Key.
Accordingly, it can be defined for which areas the access for this API key is allowed.
The API Key of Coinbase for example looks like this
No matter which Bitcoin exchange you use, the structure is almost identical. Under the personal settings you can generate an API key. The rights of the API Key should be chosen to allow the sale of Bitcoin. In addition to the rights to read, rights to execute must also be granted.
Then you get two API Keys, which are then stored in the corresponding fields at BTC Transmuter.
After clicking Save, BTC Transmuter will check the settings. With Coinbase an error message may occur, because for security reasons the API only allows access to the account after 48 hours.
There should also be some credit on the corresponding account.
After the API Key has been deposited and saved, the following page appears.
Here you define which currency pair should be traded. We want to change Bitcoin (BTC) into Euro (EUR) and therefore enter the currency pair BTCEUR.
Then there is the possibility to activate the field Buy Market Order.
A market order is a buy or sell at the current market price. In our case we want to sell Bitcoin at the current market price, not buy it. Therefore we do not click on the field.
We have deposited the equivalent of €200 in Bitcoin with Binance. This amount is our deposit from which the sale is made against Euro.
Set in the settings for the trigger so that the action starts when a payment has the status Complete.
A Bitcoin transaction receives the status Complete after six confirmations (about one hour). As soon as the payer executes the payment and the transaction is in the mempool or has less than six confirmations, the status of the transaction Before is the transaction Confirmed.
To ensure that a sale occurs at the time when the payer executes the transaction, we change the settings in the trigger.
As Action there are two actions, which are summarized as Action Group.
The first action is to record the invoice number and determine when the second action will be performed.
You can specify that for each payment (Any) the action is executed. We change at this point that the sale should only be made if it is an on-chain Bitcoin transaction. Payments made by lightning (off-chain) should not be sold on the stock exchange.
The second action is to determine what is to be done at the exchange.
At the Binance Exchange, Bitcoin is to be sold against Euro (BTCEUR) at the respective market price. The amount to be sold is the sum of the amount from the previous action.
After we have saved everything, we make a test order for €10,- in our supporter shop and see what happens.
In our test, the Bitcoin from our deposit was successfully sold at Binance. The exchange rate was almost identical. Binance also charges a fee for changing from Bitcoin to euros. This fee amounted to 0.01% of the amount. The credit to our Euro account thus almost corresponded to the amount that the end customer paid in Euro in our shop.
So far we have successfully implemented the sale of Bitcoin from our deposit. This enabled us to virtually eliminate any price risks. now we want to ensure that the deposit is automatically replenished with the Bitcoin that the end customer has paid for.
For this we need an automated forwarding of the Bitcoin from our internal BTCPay Wallet to the Bitcoin Wallet at the Bitcoin exchange we use.
The article “Automated forwarding to another Bitcoin address” explains how Bitcoins are forwarded from the internal BTCPay Wallet to the Bitcoin Exchange.
This post is also available in: German