In this tutorial, we are going to understand how to test our Blockonomics Payment APIs locally without deploying them to the production/testing environment.
What is Blockonomics?
Blockonomics is a decentralized Bitcoin payment solution that provides you with specialized transactional tools to enhance your BTC use. With Blockonomics, you can generate Bitcoins by accepting it on your online stores, as well as utilitarian features such as creating P2P invoices, sending emails via Bitcoin, and tracking your wallet addresses. Create your Blockonomics Account- here
What we’re building
We are going to understand the use of reverse proxy, allowing us to create a public URL for the code which is local to our system. Using the public URL, we can place it as an endpoint to the HTTP Callback URL required by Blockonomics.
In order to expose our code to the public URL's, we shall use the Ngrok. Later, we will generate the public URL which actively listens to a specific port on our local system. This allows us to communicate from that port with the rest of the world!
To install Ngrok on your machine, refer to the official page. After you download, navigate to the directory and type
ngrok.exe http 8000. This will start listening to the
8000 port and you can see a terminal page like this:
In my case, the public URL is
http://7db20c5efe6d.ngrok.io and I can make requests on this URL and it will redirect those requests to my localhost at the specified port, in our case port
Configuring HTTP CallBack URL
Once you have a public URL listening to your localhost, you can use it as a webhook to test the Blockonomic Payment APIs. For example, you have configured a
/receive/ route that is responsible for processing the requests coming from Blockonomics about the status update of the transactions, then you should set up the HTTP Callback URL as
<your_ngrok_domain>/receive on this page and this will redirect the Blockonomics requests to your localhost at the specified route.
Thus, you can test your logic and the Blockonomics Payment APIs without deploying them to any cloud platform.
Here is the youtube video, explaining the entire tutorial on testing the Blockonomics Payment API's locally. If you have any queries, feel free to use the comments section!
Top comments (0)