Bitcoin Forum
May 04, 2024, 02:31:56 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How can I add 'Bitcoin Payment Gateway' on my website?  (Read 285 times)
so98nn (OP)
Hero Member
*****
Offline Offline

Activity: 2086
Merit: 603


View Profile
January 29, 2020, 11:37:02 AM
Merited by OmegaStarScream (2)
 #1

I am logging on the forum after very long time. Happy to see that Bitcoin is still going strong and have strong community behind it. Anyways, I am currently building a project which requires an option through which users can deposit bitcoins to their account. It is somewhat similar to option provided by most of the gambling site.

Unique Address for every user ---> User deposits btc to that address ---> BTC goes to site's wallet ---> Similar amount reflects in user's front-end as balance

How can I implement this? If there's any thread where this topic has been already discussed then please refer me to that.

Also, I am not looking for options like BitPay or CoinGate. I want to learn how to develop it from scratch.
1714789916
Hero Member
*
Offline Offline

Posts: 1714789916

View Profile Personal Message (Offline)

Ignore
1714789916
Reply with quote  #2

1714789916
Report to moderator
If you want to be a moderator, report many posts with accuracy. You will be noticed.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714789916
Hero Member
*
Offline Offline

Posts: 1714789916

View Profile Personal Message (Offline)

Ignore
1714789916
Reply with quote  #2

1714789916
Report to moderator
1714789916
Hero Member
*
Offline Offline

Posts: 1714789916

View Profile Personal Message (Offline)

Ignore
1714789916
Reply with quote  #2

1714789916
Report to moderator
1714789916
Hero Member
*
Offline Offline

Posts: 1714789916

View Profile Personal Message (Offline)

Ignore
1714789916
Reply with quote  #2

1714789916
Report to moderator
AB de Royse777
Legendary
*
Offline Offline

Activity: 2478
Merit: 3893


Hire Bitcointalk Camp. Manager @ r7promotions.com


View Profile WWW
January 29, 2020, 11:50:32 AM
Last edit: January 29, 2020, 12:04:13 PM by Royse777
 #2

Also, I am not looking for options like BitPay or CoinGate. I want to learn how to develop it from scratch.
BitPay is good for marcents point of view but it sucks in customers point of view. As a customer to purchase anything from a site which ask pay to bitpay is annoying to me.

Give me few minutes to find you something from Google as I know there is something which allows you to integrate bitcoin payments in your site like without giving any fees and stuffs. One can do it using the bitcoin core they have.

Edit: Check step 3 in this article: https://blog.blockonomics.co/accepting-bitcoin-do-you-need-a-payment-gateway-832487d3b84c

If I am not massively wrong then this is the solution you are looking at.

..Stake.com..   ▄████████████████████████████████████▄
   ██ ▄▄▄▄▄▄▄▄▄▄            ▄▄▄▄▄▄▄▄▄▄ ██  ▄████▄
   ██ ▀▀▀▀▀▀▀▀▀▀ ██████████ ▀▀▀▀▀▀▀▀▀▀ ██  ██████
   ██ ██████████ ██      ██ ██████████ ██   ▀██▀
   ██ ██      ██ ██████  ██ ██      ██ ██    ██
   ██ ██████  ██ █████  ███ ██████  ██ ████▄ ██
   ██ █████  ███ ████  ████ █████  ███ ████████
   ██ ████  ████ ██████████ ████  ████ ████▀
   ██ ██████████ ▄▄▄▄▄▄▄▄▄▄ ██████████ ██
   ██            ▀▀▀▀▀▀▀▀▀▀            ██ 
   ▀█████████▀ ▄████████████▄ ▀█████████▀
  ▄▄▄▄▄▄▄▄▄▄▄▄███  ██  ██  ███▄▄▄▄▄▄▄▄▄▄▄▄
 ██████████████████████████████████████████
▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄
█  ▄▀▄             █▀▀█▀▄▄
█  █▀█             █  ▐  ▐▌
█       ▄██▄       █  ▌  █
█     ▄██████▄     █  ▌ ▐▌
█    ██████████    █ ▐  █
█   ▐██████████▌   █ ▐ ▐▌
█    ▀▀██████▀▀    █ ▌ █
█     ▄▄▄██▄▄▄     █ ▌▐▌
█                  █▐ █
█                  █▐▐▌
█                  █▐█
▀▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▀█
▄▄█████████▄▄
▄██▀▀▀▀█████▀▀▀▀██▄
▄█▀       ▐█▌       ▀█▄
██         ▐█▌         ██
████▄     ▄█████▄     ▄████
████████▄███████████▄████████
███▀    █████████████    ▀███
██       ███████████       ██
▀█▄       █████████       ▄█▀
▀█▄    ▄██▀▀▀▀▀▀▀██▄  ▄▄▄█▀
▀███████         ███████▀
▀█████▄       ▄█████▀
▀▀▀███▄▄▄███▀▀▀
..PLAY NOW..
mavens
Newbie
*
Offline Offline

Activity: 116
Merit: 0


View Profile
January 29, 2020, 12:06:58 PM
 #3

I am logging on the forum after very long time. Happy to see that Bitcoin is still going strong and have strong community behind it. Anyways, I am currently building a project which requires an option through which users can deposit bitcoins to their account. It is somewhat similar to option provided by most of the gambling site.

Unique Address for every user ---> User deposits btc to that address ---> BTC goes to site's wallet ---> Similar amount reflects in user's front-end as balance

How can I implement this? If there's any thread where this topic has been already discussed then please refer me to that.

Also, I am not looking for options like BitPay or CoinGate. I want to learn how to develop it from scratch.

I will do it from scratch.let's connect on (Telegram: @Mavensr) for more details 
Dabs
Legendary
*
Offline Offline

Activity: 3416
Merit: 1912


The Concierge of Crypto


View Profile
January 29, 2020, 12:17:19 PM
 #4

Some time ago, I ran a gaming site. I generated 10,000 (ten thousand) addresses and had my site dev keep it in the site's database to assign to each user uniquely.

Then we had a bitcoin daemon watch those addresses.

The private keys were all on my side, so it was almost as good as cold storage for each user.

These days, it might be better to use HD type wallets and use the master public extended key, so you have an infinite number of addresses, you just need a database to assign each address to each user.

so98nn (OP)
Hero Member
*****
Offline Offline

Activity: 2086
Merit: 603


View Profile
February 01, 2020, 02:18:52 PM
 #5

Also, I am not looking for options like BitPay or CoinGate. I want to learn how to develop it from scratch.
Edit: Check step 3 in this article: https://blog.blockonomics.co/accepting-bitcoin-do-you-need-a-payment-gateway-832487d3b84c

If I am not massively wrong then this is the solution you are looking at.

Thanks Royse. This article cleared many doubts of mine. Bitcoinjs-lib is great solution to get started.

I will do it from scratch.let's connect on (Telegram: @Mavensr) for more details 

Sorry brother, I am not looking for someone to do it for me. This wasn't job opening.

Some time ago, I ran a gaming site. I generated 10,000 (ten thousand) addresses and had my site dev keep it in the site's database to assign to each user uniquely.

Then we had a bitcoin daemon watch those addresses.

The private keys were all on my side, so it was almost as good as cold storage for each user.

These days, it might be better to use HD type wallets and use the master public extended key, so you have an infinite number of addresses, you just need a database to assign each address to each user.

Thanks Dabs. I will try this approach in the project.
OmegaStarScream
Staff
Legendary
*
Offline Offline

Activity: 3472
Merit: 6115



View Profile
February 02, 2020, 04:35:16 PM
Last edit: February 02, 2020, 05:17:33 PM by OmegaStarScream
 #6

In addition to what has been said, you might want to consider generating a new address for each transaction, instead of assigning one unique address for each user. Also, to save some fees: if a user wins/loses, nothing should happen on-chain (just 1's and 0's changing in the database). When sending (user withdrawal): make sure to batch transactions instead of sending funds on each individual's request.

If you're familiar with Node.js, take a look at this open-source dice game. It should help you understand how things work. Keep in mind that the code hasn't been reviewed by so many people, so I wouldn't suggest forking it and using it on a live product unless you can check it yourself and confirm that it has no backdoors.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Dabs
Legendary
*
Offline Offline

Activity: 3416
Merit: 1912


The Concierge of Crypto


View Profile
February 03, 2020, 04:45:17 PM
Merited by OmegaStarScream (2)
 #7

To save on fees, use native segwit addresses. To accommodate users who send from older wallets, maybe use legacy compatible segwit addresses.

Electrum will let you do this, or you can use that bip39 website to generate the appropriate extended public and private keys. Keep the private key on a machine that is separate from the website, preferably one where you have direct or better control of it.

Batching can be done by collating several transactions together, either when the queue is large enough, or after a set time, maybe offer options to the individual if they want to save on fees if they can wait like 30 minutes or 1 hour or even 1 day (maybe a few hours is good.) Batching also indirectly offers slightly better privacy, since it is essentially a coin join (all under control of the website owner) of plenty of people's withdrawals.

Imagine if your website only does withdrawals once every few hours, or once a day, how much in fees everyone would save.

Lightning isn't even in the picture yet. That's another option.

AdolfinWolf
Legendary
*
Offline Offline

Activity: 1946
Merit: 1427


View Profile
February 03, 2020, 07:09:51 PM
Last edit: February 03, 2020, 08:55:04 PM by AdolfinWolf
 #8

If you only need invoices, i definitely recommend Btcpayserver, but i see that that isn't the case here.


https://bitcoin.stackexchange.com/questions/25763/how-to-receive-payments-online-to-single-address-per-user-in-scalable-way?rq=1
Recommends you to simply use Bitcoin Core and build an api around it yourself. (eg assign adresses to userID's yourself in a database for example.)

https://bitcoin.stackexchange.com/questions/20821/build-an-online-wallet-service-with-bitcoind-can-it-scale-if-not-what-can-be?rq=1
Some more interesting reading material, and maybe check out - https://github.com/bitcoinj/bitcoinj

For a more JS-related library, check out https://github.com/bcoin-org/bcoin || https://bcoin.io/ , looks pretty nice, and promising (Might check them out myself later).

Imagine if your website only does withdrawals once every few hours, or once a day, how much in fees everyone would save.
Or, if you're running a really big site, you can also do the exact opposite of batching. Instead of sending out 100's at the time, you simply collect as much inputs as possible, and when you have a really big UTXO set, you can, when someone requests a withdrawal, try to match it as closely as possible and only have 1 output adress (no change) and thus save heavily on fees.

Again, that only works when heavily scaled.

Theb
Hero Member
*****
Offline Offline

Activity: 1680
Merit: 655


View Profile
February 03, 2020, 08:34:35 PM
 #9

On top of what Dabs has said you would really like to go and use Electrum instead of merchant services like Bitpay and Coinbase commerce if you want to avoid some additional cost and of course unwanted KYC. What they'll just offer you is the convenience of having the html code ready to be plugged into your website and also the availability of liquidating your BTC payments quickly in your bank but you'll be paying Bitpay and Coinbase a cut of your earnings on every transaction you make with them. Here is Electrum's official guide on applying your Electrum wallet as a payment gateway for your website. 

..bustadice..         ▄▄████████████▄▄
     ▄▄████████▀▀▀▀████████▄▄
   ▄███████████    ███████████▄
  █████    ████▄▄▄▄████    █████
 ██████    ████████▀▀██    ██████
██████████████████   █████████████
█████████████████▌  ▐█████████████
███    ██████████   ███████    ███
███    ████████▀   ▐███████    ███
██████████████      ██████████████
██████████████      ██████████████
 ██████████████▄▄▄▄██████████████
  ▀████████████████████████████▀
                     ▄▄███████▄▄
                  ▄███████████████▄
   ███████████  ▄████▀▀       ▀▀████▄
               ████▀      ██     ▀████
 ███████████  ████        ██       ████
             ████         ██        ████
███████████  ████     ▄▄▄▄██        ████
             ████     ▀▀▀▀▀▀        ████
 ███████████  ████                 ████
               ████▄             ▄████
   ███████████  ▀████▄▄       ▄▄████▀
                  ▀███████████████▀
                     ▀▀███████▀▀
           ▄██▄
           ████
            ██
            ▀▀
 ▄██████████████████████▄
██████▀▀██████████▀▀██████
█████    ████████    █████
█████▄  ▄████████▄  ▄█████
██████████████████████████
██████████████████████████
    ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
    ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
       ████████████
......Play......
iluvbitcoins
Legendary
*
Offline Offline

Activity: 2198
Merit: 1150


Freedom&Honor


View Profile
February 05, 2020, 09:34:11 PM
 #10

On top of what Dabs has said you would really like to go and use Electrum instead of merchant services like Bitpay and Coinbase commerce if you want to avoid some additional cost and of course unwanted KYC. What they'll just offer you is the convenience of having the html code ready to be plugged into your website and also the availability of liquidating your BTC payments quickly in your bank but you'll be paying Bitpay and Coinbase a cut of your earnings on every transaction you make with them. Here is Electrum's official guide on applying your Electrum wallet as a payment gateway for your website.  

Wow. This is nice!
I didn't know it's so straightforward with Electrum!
There's a good YT tutorial here -> https://www.youtube.com/watch?v=9PNHvr0e7sI
I always wanted to add bitcoin for my webshop though, unfortunately I think I have to use  use BitPay because I need to get FIAT on my company account so it can be legal :/ Can't bookkeep sales in crypto. I think.

Looking for a signature campaign.
Coinbees
Jr. Member
*
Offline Offline

Activity: 30
Merit: 1


View Profile WWW
February 05, 2020, 11:08:09 PM
 #11

On top of what Dabs has said you would really like to go and use Electrum instead of merchant services like Bitpay and Coinbase commerce if you want to avoid some additional cost and of course unwanted KYC. What they'll just offer you is the convenience of having the html code ready to be plugged into your website and also the availability of liquidating your BTC payments quickly in your bank but you'll be paying Bitpay and Coinbase a cut of your earnings on every transaction you make with them. Here is Electrum's official guide on applying your Electrum wallet as a payment gateway for your website.  

Wow. This is nice!
I didn't know it's so straightforward with Electrum!
There's a good YT tutorial here -> https://www.youtube.com/watch?v=9PNHvr0e7sI
I always wanted to add bitcoin for my webshop though, unfortunately I think I have to use  use BitPay because I need to get FIAT on my company account so it can be legal :/ Can't bookkeep sales in crypto. I think.

That does not mean that it is impossible. If you work with WordPress and Woocommerce, a good module for FIAT is "Stripe" it works really well for our website. And it was to be validated by Stripe (Yes they carry out a verification before validation) After which, you can determine on what bank account the collected money will be sent.
But otherwise I saw that there is also a similar module for sites not using Wordpress try looking on the internet for more information.
iluvbitcoins
Legendary
*
Offline Offline

Activity: 2198
Merit: 1150


Freedom&Honor


View Profile
February 06, 2020, 12:27:29 AM
 #12

On top of what Dabs has said you would really like to go and use Electrum instead of merchant services like Bitpay and Coinbase commerce if you want to avoid some additional cost and of course unwanted KYC. What they'll just offer you is the convenience of having the html code ready to be plugged into your website and also the availability of liquidating your BTC payments quickly in your bank but you'll be paying Bitpay and Coinbase a cut of your earnings on every transaction you make with them. Here is Electrum's official guide on applying your Electrum wallet as a payment gateway for your website.  

Wow. This is nice!
I didn't know it's so straightforward with Electrum!
There's a good YT tutorial here -> https://www.youtube.com/watch?v=9PNHvr0e7sI
I always wanted to add bitcoin for my webshop though, unfortunately I think I have to use  use BitPay because I need to get FIAT on my company account so it can be legal :/ Can't bookkeep sales in crypto. I think.

That does not mean that it is impossible. If you work with WordPress and Woocommerce, a good module for FIAT is "Stripe" it works really well for our website. And it was to be validated by Stripe (Yes they carry out a verification before validation) After which, you can determine on what bank account the collected money will be sent.
But otherwise I saw that there is also a similar module for sites not using Wordpress try looking on the internet for more information.

My shop is operating solely through social media currently but I've been planning to start a Wordpress shop for years, just never caught the time (Wordpress is the only one I have some experience with ). Thanks for the info, I'll check back on this post once I get the time to build it  Smiley

Looking for a signature campaign.
so98nn (OP)
Hero Member
*****
Offline Offline

Activity: 2086
Merit: 603


View Profile
February 25, 2020, 11:14:58 AM
 #13

Thank you so much guys. It was really great help from all of you.

While searching for possible solutions, I came across this: https://www.blockchain.com/api/api_receive

Has anyone tried this before? How good is blockchain receive payments API? Can I use it in production?
OmegaStarScream
Staff
Legendary
*
Offline Offline

Activity: 3472
Merit: 6115



View Profile
February 25, 2020, 01:23:18 PM
 #14

Thank you so much guys. It was really great help from all of you.

While searching for possible solutions, I came across this: https://www.blockchain.com/api/api_receive

Has anyone tried this before? How good is blockchain receive payments API? Can I use it in production?

Yes, it should work fine. You also have Blockonomics API as an alternative.

If you're still planning to build the same thing you mentioned in your original post, then what Dabs suggested is the best solution, you should be running your own node, instead of relying on third-party APIs.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Dabs
Legendary
*
Offline Offline

Activity: 3416
Merit: 1912


The Concierge of Crypto


View Profile
February 25, 2020, 03:01:33 PM
 #15

The bigger payment processors or exchanges have more than one full node too, not just as a backup, but to monitor the network from more than one physical location, probably from at least two different countries. For example, you could run a node in a VPS in Singapore, another one in Europe, and another one in North America. Might as well keep a full node on a local computer at your office or home or something.

If transactions that you are looking for show up in all of them within a few seconds, that's a good sign.

One is probably enough if you require at least 1 confirmation.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!