I want to be able to accept and process bitcoins on my website only by mysefl. With no 3rd party bitcoin services. How can I do that? One way is to use Electrum. But its documentation regarding merchant is really bad. Does anyone have experience with that? It doesn't have to be Electrum, though, and any bitcoin software will. I'm a programmer, I'm ok implementing a neccesary part, it if I have to, by myself.
Processing bitcoins on my website completely by myself, with no third-party bitcoin SaaS services
First, Electrum relies on Electrum servers, which are essentially a third party SaaS for SPV proofs. It's a fine thing to use for most people and as long as you aren't concerned that the server may compromise your privacy, you should be fine. But that said, you can say that about any SaaS service, so Electrum is probably not the solution you're looking for.
If you want to do everything yourself, you will have to run a full node at a minimum. You can create a wallet using a library like pycoin (https://github.com/richardkiss/pycoin) but that's much more work than using a full-node wallet like Armory.
There's actually webshop code written for processing bitcoin payments yourself (https://github.com/goatpig/BitcoinArmory/tree/master/webshop). The main benefit here is that only the public key is on the server so even if you get hacked, your bitcoins can't move without your say-so. Full disclosure: I wrote that code.
Another option may be using bitcoind, but that will require you to keep your private key on the server (NOT A GOOD IDEA).
1bitcoind supports watch-only addresses since 0.10, removing the meed to have your keys online Feb 26, 2017 at 15:19
You could build a bespoke solution for accepting Bitcoin by using a bitcoind server - it's not that hard to be honest even though I never found a complete foolproof guide.
Few things to keep in mind - some may be obvious but when put together you need to pay particular attention to them:
- Never credit an account with at the very least 1 confirmation - taylor it the way you want but 4 confirmations is good
- Transactions could contain payments to 2 different users on your site - using different addresses
- Use walletnotify to get transactions notification - it will occur the first time the transaction is seen on the network and once more when it received 1 confirmation
- Use blocknotify to get block notification - when you get this, you can go through all the unconfirmed transactions in your system and increase the confirmation number - then if it crosses your threshold, the payment is deemed complete.
- Just as a precaution and to complement the above 2 points, I set up a cron job running every 30 min to check I have not missed anything since the last block. I have fait un the notifications but better be safe than sorry
The infastructure is fairly straight-forward and then it all depends on your environment and preferred coding language. There are various sites that can give you pointers on how to connect to a running bitcoind node and pull data from it.
Good luck - I have been down that path several times and learnt as I went along.