BitCoins is the most popular digital currency out there and has been established as a standard currency for transactions around the internet. Many online portals have adopted BitCoins as one of the payment methods on their websites. There are multiple ways of integrating BitCoins payment support on your website, but many websites, especially gaming websites, need option to create BitCoin addresses for their visitors and give them a unique address for all their incoming transactions on their website. This post explains how you can use a BitCoins API on your website, generate unique addresses for visitors and start accepting payments in the form of BitCoins.

What is BitCoin?

BitCoin is digital currency based on peer-to-peer technology for its operation and runs without any regulatory authority or Bank. The currency is not specific to any country and is created by a process called mining. BitCoins are created by people who offer computing powers of their systems in a collectively working online network.

Registering with an API Provider

To start accepting BitCoins on your website, you first need to sign-up or adopt a third party API provider which would allow you to generate addresses and monitor transactions. There are a number of API service providers but I have listed here 3 such providers who you can use for the API services:

Once you have registered with the API service providers, you are ready to use their methods for calling from programming language of your choice.

Generating a BitCoin Address

For each visitor on your website, you need to generate a unique BitCoin address that will be linked to that website user. The address would be a unique one and would be linked with the unique ID of the website user. This would make sure that there is a relationship between the user’s BitCoin Address and his profile on your website.

BitCoin_Payment_Inegration

To generate a BitCoin address, you need to call the corresponding method from your API service provider and get the address. For instance, if you want to generate a unique address using BlockChain API, you can do it as follows:

https://blockchain.info/api/receive?method=create&address=$receiving_address&callback=$callback_url

Calling this method will generate a new receiving address that will be linked with your own BitCoin Address, which is the $receiving_address above. The API will send in response a new address that you can assign to your website member.

Accepting BitCoin Payments

Accepting payments is now easy. An address is created for your website user. The users need to transfer their BitCoins on the address that has been generated for them on your website. Once a user transfers the BitCoins to that address, they actually go into your own BitCoin account or Site Admin’s account but as it was transferred to the address that was linked with the site member’s profile, you are now aware that who has how many BitCoins.

BitCoin_Transaction

Benefit of this process is that now all transactions would be database transactions and values moving from here and there. There is no actual BitCoin transaction from now onwards on your website. Points to keep in mind here are:

  • Actual BitCoin transaction takes place only twice: Firstly, when the user initially makes a BitCoin deposit in his address, which actually is website admin’s address. Secondly, when the site admin gives back the BitCoins when there is a withdrawal request.
  • When a payment is received, update the BitCoin count in the database corresponding to the user’s profile who made that deposit.
  • Whenever a user plays a game or does any other activity on the website, just update the database values and no actual BitCoin transaction.

Processing Withdrawals

Whenever a user requests BitCoins withdrawal, as website Admin, you need to ask him for the address where the BitCoins need to be transmitted. For the address shared, the BitCoins can be transferred by the website admin there. This transaction can either be handled by a custom Back-end Admin Panel you might have created for your website using the API or can be transferred from your BitCoin Exchange provider offline.

You can read the API documentations in detail and check what other helpful methods you might need to automate and track transactions, timings and addresses. This method is best suited for online gaming websites which are BitCoin based. This method can also be used to create website users and their addresses without making them register on the website, just by creating anonymous guest accounts for visitors

I hope the above method is helpful and you might consider integrating this in your next website.

Pin It on Pinterest