Previewing your application

It's time to try out what we have built. First, we need to start the merchant server by running npm start from the project root (bitcoin_payment/). Then, open your browser to visit the URL, http://<Machine_IP>:3000/checkout.

If all went well, the server will serve you a store page with a single item and a Pay with BTC button, as shown in the following screenshot:

While I am testing on the same Linux machine, I have changed the domain name for localhost to bip70.com by editing the /etc/hosts file and adding 127.0.0.1 bip70.com.

Once the client chooses to pay with bitcoin, they will be redirected to a new view with a custom payment URL:

The customer can check the transaction details before proceeding the payment by pressing the Transaction Details button. After the customer clicks on the payment link, the browser will open the bitcoin client after asking for authorization: 

Once loaded, the bitcoin client connects to the payment server and gets the payment details (amount, merchant address, and so on) and prepares a payment transaction. We can see the memo sent from the merchant server displayed in the client interface. After examining the amount (which they can't edit), the client will approve the transaction and send it directly to the bitcoin network.

When the transaction is sent by the client, the bitcoin client will display the payment acknowledgment message sent from the server confirming the payment, as shown in the following screenshot:

On the other hand, the QR code helps users to pay using their smartphone. To test this ability, you can install a bitcoin wallet from the Google Play store, such as Testnet Wallet or copay, and make sure you're connected to the same network. When you scan the QR code, you'll encounter an unavoidable error indicating that the certificate isn't signed by a trusted authority. Thus, we will need to add the merchant's certificate to the mobile OS. Once done, you can enjoy trying the payment process using the bitcoin mobile wallet as follows:

At this point, we have successfully built an online web store that accepts bitcoin payments. To complete the experience, let's build a light Java bitcoin wallet to pay with instead of relying on the installed bitcoin clients.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset