How to use your NOWPayments payment API to the full extent

NOWPayments is a cryptocurrency payment gateway that aims to enable businesses to accept numerous cryptocurrencies across their websites. This is a non-custodial payment processing platform. Through it, any business will be provided with the opportunity to send or receive over 150 cryptocurrencies, with withdrawals made directly to their bank account and a personal account manager, as well as 24/7 support.

Author: Milko TV

How to use your NOWPayments payment API to the full extent

Furthermore, NOWPayments has the lowest fees on the market. Suppose you run a business or are looking for a payment solution surrounding cryptocurrencies today. In that case, we will dive into how you can use the NOWPayments Payment API to get the best possible outcome. 

Key Points:

  • The NOWPayments API will allow any business to implement a crypto payment gateway to any of their online stores or services or do mass payouts in the form of cryptocurrencies.
  • Through the implementation of this solution, any business gains access to a non-custodial crypto payment gateway that will enable them to accept over 150 different cryptocurrencies.
  • Automatic coin conversion is also supported, which enables merchants to accept cryptocurrencies that they prefer, no matter what kind of coin they are getting paid with.
  • Through the API documentation, and proper implementation, anyone can utilize the NOWPayments Payment API to its full extent.

What is the crypto payment API by NOWPayments?

The NOWPayments API is essentially an Application Programming Interface, which features a set of codes that will allow any developer to implement a Bitcoin payment gateway or add support for any other cryptocurrency that is supported to an online store. Furthermore, they can do mass payouts in different cryptocurrencies.

What is the crypto payment API by NOWPayments?

Whenever someone creates an account on NOWPayments, they can set up the payout wallet and get an API key. Once the API key is generated, developers can insert it into their code responsible for a variety of different commands.

There is an official API documentation that goes over all of the available options. However, we will also be covering how you can use the NOWPayments payment API to its full extent here. With this crypto payment gateway API, a variety of different functions can be enabled.

Once a person, such as a developer within a company, manages to implement the API to their website’s code, they will get a fully working API crypto payment gateway.

When a customer then attempts to pay with cryptocurrencies, they get to pick one of the over 150 different cryptocurrencies available and pay the company directly into their wallet when this crypto payments API is implemented.

How to use your NOWPayments Payment API to the full extent

There are numerous ways to utilize the NOWPayments Payment API to its full extent. You can review the full documentation here and find a list of the available commands. Here, we will be looking at some of the most important ones.

Get an approximate price for your goods in fiat

This is a method through which you can calculate the approximate price in cryptocurrency for a specific value in FIAT currency. Each user can provide the initial cost in the FIAT currency alongside the necessary cryptocurrency.  The available FIAT currencies include USD, EUR, NZD, BRL, and GBP.

Example Request:

curl –location –request GET ‘https://api.nowpayments.io/v1/estimate?amount=3999.5000&currency_from=usd&currency_to=btc’ \
–header ‘x-api-key: <your_api_key>’

Example Response:

Get an approximate price for your goods in fiat

Creating a payment 

You can also leverage the API in order to enable your customers the ability to complete payment without ever leaving the state. However, the data has to be sent as a JSON-object payload. Note that there are numerous required fields, such as price_amount, price_currency, and pay_currency as well as others. 

Example Request:

curl –location –request POST ‘https://api.nowpayments.io/v1/payment’ \
–header ‘x-api-key: <your_api_key>’ \
–header ‘Content-Type: application/json’ \
–data-raw ‘{
  “price_amount”: 3999.5,
  “price_currency”: “usd”,
  “pay_currency”: “btc”,
  “ipn_callback_url”: “https://nowpayments.io”,
  “order_id”: “RGDBP-21314”,
  “order_description”: “Apple Macbook Pro 2019 x 1”
}’

Example Response:

Creating a payment

Creating payments by invoice

Through the NOWPayments API, anyone can also create a payment by invoice. What this method enables is for every customer to be able to complete a payment without ever leaving the website.

Example Request:

curl –location –request POST ‘https://api.nowpayments.io/v1/invoice-payment’ \
–header ‘x-api-key: <your_api_key>’ \
–header ‘Content-Type: application/json’ \
–data-raw ‘{
  “iid”: {{invoice_id}},
  “pay_currency”: “btc”,
  “purchase_id”: {{purchase_id}},
  “order_description”: “Apple Macbook Pro 2019 x 1”,
  “customer_email”: “[email protected]”,
  “payout_address”: “0x…”,
  “payout_extra_id”: null,
  “payout_currency”: “usdttrc20”
}’

Example Response:

Creating payments by invoice

Get or update the payment estimate

Through leveraging the power of the API, anyone can generate an estimation. Note that this endpoint is required, as a means of getting the current estimate on the payment, as well as updating the current estimate. Keep in mind that calling this estimate before expiration_estimate_date will return the current estimate, it won’t be updated.

Example Request:

curl –location –request POST ‘https://api.nowpayments.io/v1/payment/4409701815/update-merchant-estimate’ \
–header ‘x-api-key: <your_api_key>’ \
–header ‘Content-Type: application/json’

Example Response:

Get or update the payment estimate

Checking the status of the payment

Users can actually see the information about the payout, however, they will be required to provide the ID of the payment in the request. Each developer needs to ensure that the get payment status request is created with the same API key that is used to create the request. The list of available statuses includes waiting, confirming, confirmed, spending, partially_paid, finished, failed, refunded or expired.

Example Request:

curl –location –request GET ‘https://api.nowpayments.io/v1/payment/5524759814’ \
–header ‘x-api-key: <your_api_key>’

Example Response:

Checking the status of the payment

Getting the list of payments

Through the commands here, anyone using the API can get the entire list, of all of the transactions, which were created within a specific API key, including stats such as limit, page, sortBy, orderBy, dateFrom, and dateTo.

Example Request:

curl –location –request GET ‘https://api.nowpayments.io/v1/payment/?limit=10&page=0&sortBy=created_at&orderBy=asc&dateFrom=2020-01-01&dateTo=2021-01-01’ \
–header ‘x-api-key: <your_api_key>’ \
–header ‘Authorization: <your_jwt_token>’

Example Response:

Getting the list of payments

Creating an invoice

Through this command, the API can create an invoice. This is a method where the customer will be required to follow a generated URL, in order to complete the payment.

Example Request:

curl –location –request POST ‘https://api.nowpayments.io/v1/invoice’ \
–header ‘x-api-key: <your_api_key>’ \
–header ‘Content-Type: application/json’ \
–data-raw ‘{
  “price_amount”: 1000,
  “price_currency”: “usd”,
  “order_id”: “RGDBP-21314”,
  “order_description”: “Apple Macbook Pro 2019 x 1”,
  “ipn_callback_url”: “https://nowpayments.io”,
  “success_url”: “https://nowpayments.io”,
  “cancel_url”: “https://nowpayments.io”
}

Example Response:

Creating an invoice

Getting the list of available currencies

This is a method through which each user will be able to obtain information surrounding all of the cryptocurrencies that are available for payments.

Example Request:

curl –location –request GET ‘https://api.nowpayments.io/v1/currencies’ \
–header ‘x-api-key: <your_api_key>’

Example Response:

Getting the list of available currencies

Creating a payout with the API

This is a method that will enable you to create a payout. Remember that each user will still need to provide their data as a JSON-object payload.

Example Request:

curl –location –request POST ‘https://api.nowpayments.io/v1/payout’ \
–header ‘x-api-key: <your_api_key>’ \
–header ‘Content-Type: application/json’ \
–header ‘Authorization: Bearer *your_jwt_token*’ \
–data-raw ‘{
    “ipn_callback_url”: “https://nowpayments.io”,
    “withdrawals”: [
        {
            “address”: “TEmGwPeRTPiLFLVfBxXkSP91yc5GMNQhfS”,
            “currency”: “trx”,
            “amount”: 200,
            “ipn_callback_url”: “https://nowpayments.io”
        },
        {
          “address”: “0x1EBAeF7Bee7B3a7B2EEfC72e86593Bf15ED37522”,
            “currency”: “eth”,
            “amount”: 0.1 ,
            “ipn_callback_url”: “https://nowpayments.io”
        },
        {
          “address”: “0x1EBAeF7Bee7B3a7B2EEfC72e86593Bf15ED37522”,
            “currency”: “usdc”,
            “amount”: 1,
            “fiat_amount”: 100,
            “fiat_currency”: “usd”,
            “ipn_callback_url”: “https://nowpayments.io”
        }
    ]
}’

Example Response:

Creating a payout with the API

Creating a payout with the API
These are two parts of an Example Response

How to accept crypto payments with API?

If you are curious as to how you can accept cryptocurrency payments with an API, here is everything that you need to do, step-by-step.

  1. Create an account at the official NOWPayments website here.
How to Accept Crypto Payments With API?
  1. Provide your cryptocurrency address to the payment gateway provider.
  2. Generate your API key.
  3. You will now be able to pick a tool through which you can begin accepting cryptocurrencies, such as one of the available options here, or you can use an API directly.

Conclusion

We have gone over just about everything any developer or business owner needs to understand when it comes to using their NOWPayments Payment API to the full extent.

By using all of the aforementioned commands found in the cryptocurrency payment gateway API, each user can implement a high level of functionality to their website or offer as a whole, where they can essentially create a business model in which they can accept cryptocurrency payments.

All of this is possible due to the implementation of the API provided by NOWPayments.