Let's look at a step-by-step detailed instruction on how to accept bitcoin payments in your own project. You can create and implement our API to CMS e-commerce shop, bot messenger (telegram, skype...), POS software or mobile application. Let's conditionally take the Store, the Buyer, and our API Server as participants in the process of sale.
The Buyer prepared the order and click to pay via bitcoins.
The Store sends own destination bitcoin address and site callback URL to our API Server.
The server generates new bitcoin address and returns it to the Store.
The store can get current exchange rate and convert USD, EUR, CAD, etc. currencies to BTC.
Using new address and converted the amount in BTC Store can create QR code for Buyer's payment.
Store show QR code, address and amount on invoice page to Buyer. Store save new address related to Buyers order in own database for future.
Because the Buyer can change their mind, not pay for the order or pay later, when the new address is generated, our Server adds it to the watch list. Also, the server continuously monitors the blockchain network and searches for Buyer transactions at the Store.
Buyer scan QR code and pay for the order. This transaction goes to the blockchain.
Our Server immediately got it and send a callback to supplied Store URL. Now it's first callback about the unconfirmed transaction. It's too early to pass order from Store to Buyer. We just notify that payment initiated.
The Store can update the database that payment unconfirmed and show it to the Buyer. As a response, we would like to receive the message
*ok* in plain text format.
Waiting for payment confirmation on the network. Usually, it will take about ten minutes.
Got it. After 1 confirmation our Server forward confirmed bitcoins to Store's destination address and do the second callback.
Now the Buyer gets the desired order.
Store finished order and ready for next customers.
This generated address saved as related to supplied URL In our database. We will endlessly monitor it regardless of payments because the Store can sell the same goods repeatedly. Or can use this address to top-up user's account balance in a project, for example, the game balance or advertisement balance. Or the Buyer by mistake will re-send the payment, then store return it back.Back to top