At 8Pay, one of our priorities is to put the needs of the merchant first. We realized that there is no point in having a disruptive processor if we don’t make merchant interaction as seamless as possible. We wanted to empower our partner merchants to stay on top of their business without dabbling into the complications of the blockchain. This is why we created the 8Pay API to help merchants better interact with our system.
What is an API?
Let’s define what an API means first.
Application programming interface or API is a set of functions and procedures allowing the creation of applications that access the features or data of an operating system, application, or other services.
Instead of getting confused by technical terms, let’s look at a working example of an API. Imagine that you are in a restaurant looking to order some food. Do you go straight to the kitchen and tell them what you want and wait there to see how your food is being prepared? No, right?
Instead, you interact with a waiter who attends to your needs by taking your order and serving you your food. Plus, you can use the waiter to relay all your questions to the kitchen and the chef. In this example, you are the user, the kitchen is the software, and the waiter is the API.
APIs are an incredibly essential component of the modern-day digital interaction because they offer abstraction.
What is Abstraction?
Abstraction is one of the biggest signs of high-quality software design. The idea is that you should be able to interact with an incredibly sophisticated piece of machinery without having to learn how all the components work. When you sit in your car and turn on the keys, do you need to know how the fuel is combusting and how that is going to make your engine run? Not at all. All that you need to know is that after turning the keys on, you can make the car run or stop by pressing individual pedals.
This is why APIs are critical to the widespread usage of an app — simplifying how the app works will attract more users into the ecosystem. This is doubly important for applications like ours, which is based on the blockchain technology. Users and especially merchants are wary of dealing with decentralized applications because of how new the technology is. However, if we incorporate an easy-to-use API in our ecosystem with which the merchants can directly interact with the blockchain, we will be able to increase usability exponentially.
What does the 8PAY API do?
Before we go any deeper into what our API does, let’s gain a quick understanding of what 8Pay is. 8Pay is a decentralized payment processor built on top of the Ethereum blockchain, which leverages smart contracts to give merchants the flexibility needed to accept a wide variety of cryptocurrencies via one-time, on-demand, and recurring payments like subscriptions. Merchants will be able to accept the 8PAY token (our native token), other ERC20 tokens (including selected stablecoins), ETH (for one-time payment only), and WETH (Wrapped Ether) in return for their services.
As a merchant, there will be several important data about your customers that you will need to keep track of, such as:
- The list of subscribers for a specific plan.
- The details and history (including billings) for a particular subscriber.
- Which and how many active plans does a specific user have?
- Which subscribers do you need to bill?
A merchant can use the API to obtain information that can then be exported to the 8Pay JavaScript library and then acted upon. For instance, a merchant can view a list of expired subscribers and then use the JavaScript library to interact directly with the blockchain and bill them. This ensures that a high-level of abstraction is maintained without compromising on accuracy and efficiency.
There is an important thing to note here about the difference between our API and JavaScript Library:
The 8PAY API is a REST API which uses HTTP requests from the client to provide data in JSON format. The API is mostly used to read from our internal database which contains a copy of the data present on the blockchain. This ensures you get much faster results for what you need.
The JavaScript library, on the other hand, is primarily used to directly send transactions (aka perform write operations) to the blockchain.
Source: https://medium.com/8pay/payment-gateway-apis-dc12578ddc89