NOWPayments API Explained: Customize Your Payment Gateway

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. 

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. 

What Is API?

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 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 sum. 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:

  1. GET API status – the basic request that checks if our API operates normally.
  2. GET available currencies – displays all cryptocurrencies available for the payment at the time of the query. 
  3. GET checked available currencies – displays all available cryptocurrencies of those that you’ve activated in your Personal Account (Coin Settings section). 
  4. GET estimated price – calculates the price in cryptocurrency based on the current exchange rate. 
  5. POST Create payment – makes a payment with a unique ID. 
  6. GET payment status – informs on the payment status using the payment_ID parameter. 
  7. GET the minimum payment amount – counts the minimum amount for the user’s payment. 
  8. GET list of payments – shows the list of all payments for a certain period. These can be filtered by pay_currency and other parameters. 
  9. 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

  1. 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. 
  2. 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.
  3. 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, that fiat currency ticker, and the cryptocurrency ticker. Other parameters are optional. 
  4. Once the payment is created, NOWPayments sends the deposit address and the sum to the merchant – and then you pass this information to your customer. 
  5. The customer pays.
  6. Now, you need to track the payment status to release the purchase timely. There are two ways of doing this: 
    1. 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. 
    2. 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.