DEV Community

Christopher Akanmu
Christopher Akanmu

Posted on

How to Integrate Crypto Payments in Your Apps & Build Your Own Crypto Payment Gateway with ZinariPays OpenAPI

ZinariPay OpenAPI

In this article, we'll walk you through how to quickly set up a cryptocurrency payment gateway using ZinariPay's robust infrastructure. Whether you're a developer or a business looking to accept crypto payments, ZinariPay makes the process simple by providing a set of easy-to-use APIs for handling transactions, managing wallets, and monitoring payments.


1. What is ZinariPay?

ZinariPay is a cryptocurrency payment gateway built to simplify crypto transactions for businesses, with a specific focus on the African market. Using ZinariPay’s OpenAPI, businesses can process crypto payments in USDT and USDC with full integration support for fiat-to-crypto and crypto-to-fiat conversions.


2. Why Use ZinariPay for Your Payment Gateway?

  • Seamless Integration: ZinariPay provides comprehensive OpenAPIs that allow you to create, track, and manage transactions easily.
  • Fast Setup: With just a few API calls, you can have a functional crypto payment system.
  • Security and Reliability: ZinariPay handles all blockchain interactions securely, ensuring that your transactions are processed smoothly and without exposing sensitive information.

3. Step-by-Step Guide: How to Create a Crypto Payment Gateway

Step 1: Set Up Your ZinariPay Account

  • To get started, sign up for a ZinariPay account, where you can manage your apps and generate an API key from the ZinariPay console.

Step 2: Authenticate with Your API Key

Before making any API requests, you’ll need to pass your apiKey as a Bearer token in the Authorization header. Without this, your requests will fail. You can obtain your API key from the ZinariPay console.

Example:

   Authorization: Bearer <your_api_key>
Enter fullscreen mode Exit fullscreen mode

Step 3: Create a Transaction

Use the create-transaction API to generate a unique payment address for your users. This allows your users to send payments in USDT or USDC.

Example Request:

   POST https://openapi.zinari.io/v1/create-transaction
   Content-Type: application/json

   {
     "cryptocurrency": "USDT",
     "fiatAmount": 50,
     "notificationEmailAddress": "customer@example.com"
   }
Enter fullscreen mode Exit fullscreen mode
  • In development mode, the transaction will automatically be confirmed after a few seconds.
  • You can also pass additional data like userId, orderId, or productId to track your transactions.

Step 4: Monitor Transaction Status

Once the transaction is created, you can track its status using the get-transaction-by-id endpoint. This helps you keep tabs on whether the payment is Pending, Confirming, Confirmed, or in any other status.

Example:

   GET https://openapi.zinari.io/v1/transaction/:id
Enter fullscreen mode Exit fullscreen mode

ZinariPay also provides webhook notifications for real-time updates on transaction status. Set up your webhook URLS in your ZinariPay console

Step 5: Get Wallet Balances

You can use the get-wallets endpoint to retrieve all your app’s wallet balances, which is essential for managing your crypto reserves and withdrawals.

Step 6: Withdraw Funds

To move funds out of your wallets, use the withdraw-from-wallet endpoint. This ensures you can securely transfer crypto to external wallets when needed. Withdrawal fees apply.

Example:

   POST https://openapi.zinari.io/v1/withdraw/:id

   {
     "amount": 50,
     "address": "<withdrawal address here>"
   }
Enter fullscreen mode Exit fullscreen mode

Step 7: Handle Exchange Rates

ZinariPay also supports fiat-to-crypto, crypto-to-fiat, fiat-to-fiat and crypto-to-crypto conversions. You can use the get-exchange-rate endpoint to retrieve the latest conversion rates.

Example:

   GET https://openapi.zinari.io/v1/exchange-rate?from=USD&to=NGN
   GET https://openapi.zinari.io/v1/exchange-rate?from=USDT&to=ETH
   GET https://openapi.zinari.io/v1/exchange-rate?from=USDT&to=ZAR
Enter fullscreen mode Exit fullscreen mode

4. Additional Features

  • Transaction Statuses: Learn about the various transaction statuses like Pending, Confirming, Confirmed, Incomplete, etc., and how to respond to each.
  • Paginated Transaction Lists: Use the list-paginated-transactions endpoints to fetch transactions in production and development modes.

5. Conclusion

By following the steps above, you can quickly integrate ZinariPay's APIs to either set up your own cryptocurrency payment gateway or directly receive payments in your website or apps. ZinariPay’s flexible API infrastructure makes it easy to process, track, and manage crypto payments without the burden of heavy maintenance. Whether you're looking to build a complete payment system or just accept payments, ZinariPay provides the tools to ensure a smooth and secure integration.

For a more comprehensive guide on all available endpoints, detailed usage examples, and best practices, please visit our official API documentation.

Top comments (0)