Website administrators/developers looking accept bitcoin payments are overwhelmed by terms like blocks, txid, address, HD wallet, private keys etc. In this post we try to give a 101 on this process by showing the basic workflow:

Accepting bitcoin payments — Workflow

Payments API — full size infographic (Click here)

Price: Calculate total amount of the order in BTC. This can be done by dividing the order/cart value by current bitcoin price. Since bitcoin price is fluctuating, there is time window within which we want to customer to pay these bitcoins. Most merchants provide a window of 10–15 minutes New Address: Generate a new bitcoin address. This is used to receive payments. Must be unique per order Prompt the User: Show the customer bitcoin address with qrcode/btc amount to which he can make the payment. Show a timer to indicate time left to make payment Socket: Webbrowser opens a websocket connection to server to listen to realtime notification of bitcoin payment and redirects customer to order confirmation page on notification. Payment: Customer makes payments through his/her bitcoin wallet Callbacks: Server gets notifications of payment confirmation and status of order is updated

Setting Up

Click on Get Started For Free on Merchants Page . After this you will be asked to enter xpub key of wallet. This is the wallet that will be used receive your funds. To know how to create a bitcoin wallet and get xpub, feel free to see this video You will be shown a Settings Page like the below one

Merchants Settings Page

Use the APIKey shown above to authenticate API calls to blockonomics.co

You should set callback URL to a callback endpoint on your website. For example something like https://btcshirtshop.com/callback.php?secret=verylongsecret. You can choose any secret phrase that you like. The purpose of the secret is to safeguard against any attacker directly calling your callback endpoint. When blockonomics.co sends callback parameters it will sent along the secret, so you are sure that the caller is authentic.

Few tips

Keep private keys of your wallet safely. You don’t own bitcoin if don’t have access to the private keys ! Its worth purchasing a hardware wallet, if you are storing anything great than 1 BTC.

Bitcoin confirmations take time, particularly with transaction having low fee. Advise customers to wait for confirmation. Most tx will get cleared over the weekend

Accepting zero confirmations is risky. Only do this for orders having small fiat value. Ship the order only on confirmed payment.

Bitcoin payments are irreversible. So, you don’t need to worry about chargebacks/credit card frauds. If you need to give customer a refund, initiate a new bitcoin transaction.

Resources