Chainlink oracle, data feeds coming to StarkNet ecosystem

Blockchain scaling technology firm StarkWare is set to partner with Chainlink Labs to bring oracle services, data and price feeds to the StarkNet...

Latest Posts

NOWPayments API Explained: Customize Your Payment Gateway

- Advertisement -


If you want to launch a new feature in your service and want to save time and money on development, API is the solution. The Application Programming Interface allows you to use third-party solutions – and enables communication between your platform’s code and the service provider software.

- Advertisement -

API is one of the most popular ways to integrate NOWPayments and start accepting cryptocurrency for your business. It provides your website or mobile app with a native built-in payment tool that you can control and customize.

- Advertisement -

What is API?

- Advertisement -

API is a piece of software that allows web services and apps to interact with each other. It serves as a language for their communication: when one platform needs data from another, it sends a request via API and gets a response. And of course, it’s not just messaging – one service helps another to perform certain tasks.

In the crypto realm, APIs of various services are closely integrated into one another. For example, built-in crypto swaps in your wallet are most likely run by a third-party exchange service via API, and the price charts are shared by market data providers also via API.

Imagine if every wallet would have to develop its own crypto exchange or market data source. Sounds like too much hassle – that’s why platforms create APIs and allow others to leverage their solutions.

What Is NOWPayments API?

NOWPayments API lets you profit from our payment gateway – and accept 160+ cryptocurrencies from your customers. When your client clicks “Pay with crypto” on your platform, the API starts exchanging the payment information between your website and NOWPayments. This data helps the customer to send you the coins and allows you to track the payment and release the purchase.

The API is different from ready-made e-commerce plugins – it looks totally native in your interface and gives you more customizing opportunities. The integration via API requires developer skills. We provide extensive documentation for the API setup.

The integration is free – you only pay service fees from actual payments processed by our system. In this article, we explain our fees and how you can save on them.

API for Online Stores, Casinos, and Mass Payouts

NOWPayments has one single API, but we offer three types of docs to help you adapt it for your needs: Standard API, Mass Payout API, and Casino API.

Standard API suits most e-commerce platforms. The docs suggest a basic recommended integration flow. Mass Payouts is a feature that allows making payrolls, sending rebates, freelance commissions, and affiliate rewards to multiple addresses without plenty of fees. Design your payment gateway with Mass Payouts API and send crypto to many recipients for just one network fee per batch of transactions. Casino API is a combination of Standard API and Mass Payouts API – it allows users to both make payments and receive rewards from the merchant. Casino API has a constant deposit address so that users can top up their accounts at any time. NOWPayments API: The Introduction

When you’re integrating NOWPayments, your developers write a code that triggers requests to our API depending on what your users do.

Let’s say your customer chooses an item on your platform, clicks “Buy”, and picks a cryptocurrency. At this moment, your code will request our API to create a payment. In response, the API will display the address where the user should pay, the currency, and the amount. (This is the NOWPayments deposit address that will further direct the funds to your Custody or your own wallet. This is a single-use unique address that helps identify the payment).

As long as all requests have been put into code, they will execute automatically. Your platform will create payments, track their status and release purchases without your direct participation.

API requests

Our API runs on requests that the merchant’s code sends to us in response to user actions. There are two main types of requests:

GET requests query data from our API. For example, Get available currencies request allows you to see the list of all cryptos available for payment right now. POST request sends data to your API so that we can perform a certain task. For example, Create payment request sends information about the purchase to NOWPayments, and the API sends the sum and the pay-in address in response. These details are then displayed to the user on your platform.

Every request is composed of required and optional parameters. For instance, POST Create payment request includes the following required parameters:

price_amount – the price of an item in fiat currency,price_currency – the fiat currency to display the price, for instance, USD or EUR, pay_currency – the cryptocurrency in which the customer pays.

POST Create payment request also includes 8 optional parameters. Here are two of them:

pay_amount – the price of an item in cryptocurrency. If you include this parameter in the request, the payment will display this amount. If you don’t include it, the price in cryptocurrency will be calculated based on the fiat price at the current exchange rate. This is done via Get estimated price request. ipn_callback_url – the internet address of the server where you’d like to receive instant notifications about the transaction status (Instant Payment Notifications, or IPN). Examples of API requests

Here are some of the most popular requests available in the Standard API:

GET API status – the basic request that checks if our API operates normally. GET available currencies – displays all cryptocurrencies available for payment at the time of the query. GET checked available currencies – displays all available cryptocurrencies of those that you’ve activated in your Personal Account (Coin Settings section). GET estimated price – calculates the price in cryptocurrency based on the current exchange rate. POST Create payment – ​​makes a payment with a unique ID. GET payment status – informs on the payment status using the payment_ID parameter. GET the minimum payment amount – counts the minimum amount for the user’s payment. GET list of payments – shows the list of all payments for a certain period. These can be filtered by pay_currency and other parameters. POST Create invoice – makes an invoice, a payment method with a unique URL and a QR code. API integration: How It Works

Now that we’ve run through the requests and their parameters, let’s see how they all work together – step-by-step.

To start integrating the NOWPayments API, sign up on our website, add a payout wallet in your Personal Account (Payment Settings section), and create the API key. The latter will let your code make requests to our API.

NOWPayments API Workflow Typically, merchants start by checking the status of our API with the Get API Status request. If it works fine, we can proceed to the next step. The merchant sends the Get checked available currencies request to our API. As a result, the user sees the list of cryptos that the merchant is ready to accept – and picks one coin to pay. The merchants’ code finds out what cryptocurrency the user has chosen and sends the POST Create payment request. As mentioned above, it should include the price amount in fiat, the fiat currency ticker, and the cryptocurrency ticker. Other parameters are optional. Once the payment is created, NOWPayments sends the deposit address and the amount to the merchant – and then you pass this information on to your customer. The customer pays. Now, you need to track the payment status to release the purchase timely. There are two ways of doing this: Use the Get Payment Status request. You can ask your code to make this request every minute or so – to learn promptly about the payment status changes. When your platform sees that the payment has been finished, it can release the purchase. Enable Instant Payment Notifications (IPN). This feature automatically notifies you when the transaction status changes. To activate IPN, generate the IPN Secret Key in your Personal Account (Payment Settings section) and add the ipn_callback_url parameter to the POST Create payment request (this is the URL where you want to receive notifications). See our Docs for more details. Contact Us

We hope this article helped you grasp the basics of our API. If something doesn’t make sense or you have other questions about accepting crypto, reach out to [email protected] – we will be glad to help you through.



Source

- Advertisement -

Latest Posts

Don't Miss