Build an online store with cryptocurrency payment support — create a store and connect to my wallet

Karen Su
ForgingBlock
Published in
4 min readJul 16, 2019

--

If you are a beginner with no coding experience at all but still interested in getting involved with cryptocurrency trends and setting up your own website, blog, or online store, then you have landed at the right place. This is the third section of a series.

What you’ll need

  • No programming experience needed
  • Some time, each session is about 20–30 mins
  • No fee for building a test toy store locally

What you’ll learn

  • API usage and other programming jargon
  • Bitcoin and other cryptocurrency terminologies
  • Website hosting and cloud deployment concepts

What you’ll build

  • An online store with cryptocurrency, credit card, and PayPal payment support enabled

Create a store and connect to my wallet

  • How to connect to different cryptocurrency wallets?

For each type of coins, a pair of keys are needed to sign the transactions on its blockchain. A key feature of a wallet is that it generates a public key and a private key for you for each type of coins.

If it only supports one type of coin, it only has a pair of keys. If it supports multiple coins and multiple wallet instances, it generates a pair for each combination. The private key is kept by you, used to sign the transactions. The public key is the one you give others. They will use this to decode the transaction data to make sure it is from you as a valid transaction.

The public key is the one you handle to forgingblock to connect your wallet with the store forgingblock created for you. So you don’t have to code your online store payment system by yourself for all different types of coins.

You only need to have a crypto wallet, register as a user on forgingblock using your email, and then you can create as many of the stores for your expanding chain-store business as you want, and link they with your wallets by simply providing the public keys to pair them up.

A store can be paired with different coins by connecting with different public keys. A wallet for a type of coin can be connected to multiple stores you own as long as you pair its unique public key to your stores.

Steps to create a store and link with your wallet:

  1. Create a store using “creating-store” endpoint

Follow the instructions of forgingblock API doc and enter information in Postman. The xpub body parameter is optional as the doc points out, so you just need to enter the same information as you entered for registration, and click ‘Send’, then linking the public key in the next step. Or you can do it in one shot then skip the next step.

The response contains store id and its token. This information will also be sent to you by email.

2. Link with the wallet using “connecting-wallet” endpoint

Similarly, following API doc instruction to connect your wallet with the created store using the master public key information found in the electrum wallet and the store id received in the previous step.

Notice here are multiple endpoints for connecting different cryptocurrencies.

Connecting bitcoin, the endpoint POST /connect-wallet or POST /connect-wallet-btc can be used, they are equivalent ;

For LTC (litecoin). the endpoint is POST /connect-wallet-ltc.

For other coins and tokens, please check their sections. A store supports connections to multiple different wallets, or you can create multiple stores and link them in a 1 to 1 relationship.

The response will be 200 OK and shows the body as

{

“success”: “Store 4GJVAEKmtozVWQqUMUE5naEJCbszCuJfF7FVjNeKBEui wallet was succesfully updated”

}

Now you have a forgingblock store linked with your testnet bitcoin wallet, the cryptocurrency payment part is ready. Next step is to plugin other Lego pieces to build an actual online store!

Go back to the content.

Next section, please click here.

--

--