Build an online store with cryptocurrency payment support — register a test account

Karen Su
ForgingBlock
Published in
6 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 second 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

Register a test account at Forgingblock

  • What is an API?

As humans, we use mail, telegram, phone, email to communicate with each other. For computer programs, APIs (application programming interface) are the software interfaces they use to communicate with each other. By following the same standards or protocols agreed by both parties, transferring data and information is available between them.

Using certain tools, developers can talk to APIs too, then they can write programs talking to another program by using API endpoints it provides to build another application on top of it, or link several programs together like building Lego bricks.

Here, we will play the Lego game by using bricks provided by forgingblock and other open source communities to build our own online store.

  • What tools should I use to talk to APIs?

Developers text to programs using command line tools, it is the most effective ways to talk to operating systems or certain computer programs. Curl is one of these weapons in their took kit, it is the most widely used command line tool and library for transferring data with URLs (https://curl.haxx.se/).

For beginners, a program with a graphic interface that can be clicked with mouse is easier to start with. Postman is such a tool for the same purpose,transferring data with URLs, and by far the most popular one used by millions of developers. The official website provides excellent tutorials. (https://learning.getpostman.com/)

Steps to download and setup Postman:

  1. Go to Postman download page, choose the right package for your operating system.

2. Follow the steps and register as a postman user, choose the free plan. For postman usage details, please check the official website tutorial listed above.

  • How to read API docs?

Reading API docs is like reading a user menu for your TV remote or other appliances. An API endpoint is the same as the button on a remote; it represents an action you can do on the program without knowing how it works behind the scenes. Usually, API supports two kinds of actions, one is to get information, another is to perform an action.

The API document shows you for each endpoint what action you can perform (GET, POST, PUT, DELETE, etc). These are predefined actions or what are called HTTP methods (https://restfulapi.net/http-methods/). Then in the request, the URL and parameters are also required.

Consider forgingblock APIs (https://api.forgingblock.io/docs/#fbuni) as an example, the testnet (https://api-demo.forgingblock.io) and mainnet (https://api.forgingblock.io) of forgingblock have the same set of endpoints, but their URLs are different, and in order to retrieve the right information or perform actions from the testnet, right testnet credentials need to be passed as parameters either in the URL or in the POST body as specified in the API doc.

It also tells you what kind of response you should expect for endpoints. Status codes are numbers used by programs to determine the status of communication result. 200 represents ‘OK’, 404 represents ‘I can’t find the resource you request’. For example, if the request is received and processed successfully, the program will send a response with 200 status code along with data requested back to you in the format specified in the document.

Steps to use Postman to talk to forgingblock API and register a test account:

  1. Go to forgingblock API doc page ( https://api.forgingblock.io/docs/?shell#fbuni ).

At the top of the document, the baseURLs are listed. For testnet, please use the test net one https://api-demo.forgingblock.io, which supports the testcoins. The mainnet is used for real crypto-currencies.

Go to the Registration section of forgingblock API document, get endpoint and parameter information.

This is a POST request and two body parameters are required: the email used for registration and the password you chose for forgingblock account. The requirement for password is listed in the document.

The response section shows if 200 is returned, then the registration action is successful. Otherwise, please check your request again in case typos or other wrong information was provided. If you can’t figure out the issue, please contact the support team using this form or send the development team an email (https://www.forgingblock.io/contact.html).

Another straightforward way to check is the right panel, which shows you the POST call code snippet in languages. For linux shell tool curl, the -H means header, other parts are self-explanatory.

2. Enter the information into postman, send the registration request.

Change the method to POST, enter the url https://api-demo.forgingblock.io/register in the address bar ;

In the Headers section, enter Key as ‘Content-Type’, ‘application/x-www-form-urlencoded’ as Value, Postman will fill the cell out for you automatically once you start typing.

In the body section, enter the email and password you chose, and click the Send button. Please use a strong password as mentioned in the API doc. Check the ‘x-www-form-urlencoded’ radio button.

Once it works, the Response section will show 200 and the response body “success”: “You only need to confirm email now”

3. Check the email box and click the received verification link to confirm registration.

Once you see this {“success”:”Email confirmed and account activated”}

Message in the opened URL, you have registered successfully as a forgingblock cryptocurrency payment user!

Go back to the content.

Next section, please click here.

--

--