Skip to content

OxaPay is a cryptocurrency payment gateway that simplifies the acceptance of crypto for webmasters, merchants, and Telegram channels and makes crypto useful for all.

Notifications You must be signed in to change notification settings

thenamevishnu/oxapayapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation

Install oxapayapi with npm

npm install oxapayapi

package.json

In your package.json file add these fields too

{
    "scripts": {
        "dev": "node --env-file=.env app.mjs" //replace app.mjs with your main js file
    },
    "type": "module", // to use import and export [ES6]
}

Run Locally

  npm run dev

Environment Variables

To run this project, you will need to add the following environment variables to your .env file

MERCHANT_APIKEY

PAYOUT_APIKEY

Create Oxapay instance

import Oxapay from "oxapayapi"

const oxapay = new Oxapay(process.env.MERCHANT_APIKEY, process.env.PAYOUT_APIKEY)

Create Invoice

import Oxapay from "oxapayapi"

const oxapay = new Oxapay("Your Merchant API Key", "Your Payout API Key")

oxapay.createInvoice(10, "USDT", 30, 0, "https://example.com/callback", "UNIQUEID123", "ORDER-123ABCD").then(res => {
    console.log(res)
})
Parameter Type Description
amount NUMBER Required. The amount for the payment. If the currency field is not filled, the amount should be specified in dollars. If the currency field is filled, the amount should correspond to the specified currency.
currency STRING Required. Specify the currency symbol if you want the invoice amount calculated with a specific currency. You can also create invoices in fiat currencies.
lifeTime NUMBER Required. Set the expiration time for the payment link in minutes (15-2880).
feePaidByPayer NUMBER Required. Specify whether the payer will cover the invoice commission. 1 indicates that the payer will pay the fee, while 0 indicates that the merchant will pay the fee.
callback_url STRING Required. The URL where payment information will be sent. Use this to receive notifications about the payment status.
uniqueId STRING Required. Specify a unique ID to find who is the sender [user's unique id].
orderId STRING Required. Specify a unique order ID for reference in your system.

Create Static Wallet

import Oxapay from "oxapayapi"

const oxapay = new Oxapay("Your Merchant API Key", "Your Payout API Key")

oxapay.createStaticWallet(10, "TRC20", "https://example.com/callback").then(res => {
    console.log(res)
})
Parameter Type Description
currency STRING Required. The specific currency for which you want to create a static address.
network STRING Required. The blockchain network on which the static address should be created. If not specified, the default network will be used.
callback_url STRING Required. The URL where payment information will be sent. Use this to receive notifications about payments made to the static address.

Create Payout

import Oxapay from "oxapayapi"

const oxapay = new Oxapay("Your Merchant API Key", "Your Payout API Key")

oxapay.createPayout("Your wallet address", 10, "USDT", "UNIQUEID-123", "https://example.com/callback", "TRC20").then(res => {
    console.log(res)
})
Parameter Type Description
address STRING Required. The cryptocurrency address of the recipient where the payout will be sent.
amount NUMBER Required. The amount of cryptocurrency to be sent as the payout.
currency STRING Required. The symbol of the cryptocurrency to be sent (e.g., BTC, ETH, LTC, etc.).
uniqueId STRING Required. Specify a unique ID to find who withdraw the money [user's unique id].
callback_url STRING Required. The URL where payment information and status updates will be sent. You can include additional parameters in the URL if needed.
network STRING Required. The blockchain network to be used for the payout. The field is required for external payment.

Authors

About

OxaPay is a cryptocurrency payment gateway that simplifies the acceptance of crypto for webmasters, merchants, and Telegram channels and makes crypto useful for all.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published