Page cover

OxaPay

πŸ” Introduction

OxaPay is a fast, secure, and developer-friendly crypto payment gateway that allows businesses and platforms to seamlessly accept, send, and swap cryptocurrencies. This integration empowers you to provide efficient, secure, and quick transactions, all without the need for extensive KYC procedures.

With OxaPay, you can:

  • βœ… Accept crypto payments from customers

  • πŸ’΅ Send payouts to users, freelancers, or partners

  • πŸ” Instantly swap between cryptocurrencies

  • πŸ”§ Integrate everything easily via RESTful APIs


🌐 Key Features

πŸ’Έ Payment

Accept Crypto Payments from Customers Seamlessly accept cryptocurrency payments via auto generated wallet addresses or invoice links.

  • Instant wallet address generation

  • White-label support for custom branding

  • Invoice link

  • Real-time webhook notifications

  • Multi-currency & multi-network support


πŸ’΅ Payout

Send Crypto Instantly Automate payouts in crypto to anyone, anywhere.

  • Fast and secure transfers

  • Real-time webhook notifications

  • Great for affiliate systems, rewards, freelancers


πŸ” Swap

Instant Crypto Exchange Convert one crypto to another instantly and securely.

  • Real-time rates

  • Transparent conversion

  • Supports multiple crypto


⚑️ Why OxaPay?

  • βœ… No complex KYC

  • πŸ” Secure & reliable API

  • πŸš€ Fast setup and integration

  • πŸ“ž 24/7 dedicated support


πŸ”— Learn more at oxapay docs

πŸš€ Getting Started

To get started with the Bots.business integration with OxaPay, follow these steps:

  1. Generate an OxaPay account and obtain your API key by referring to the OxaPay Integrations.

  2. Set your generated API keys with the following sample codes:

//set your merchant api key
Libs.OxaPayLibV1.setMerchantApiKey("YOUR_MERCHANT_KEY");

//set your payout api key
Libs.OxaPayLibV1.setPayoutApiKey("YOUR_PAYOUT_API_KEY");

//set your general api key
Libs.OxaPayLibV1.setGeneralApiKey("YOUR_GENERAL_API_KEY");
  1. Install the Webhook Library from the Bots.business library store to receive real-time payment and payout notifications (callback data).

βš™οΈ Calling API Method

You can interact with the OxaPay API by using the apiCall method. This method accepts four parameters:

  • url: Specify OxaPay endpoints, such as '/payment/invoice' or '/payout' (refer to the OxaPay documentation for a full list of endpoints).

  • method: Specify the HTTP method for the request, either POST or GET, depending on the API endpoint requirements.

  • fields: Provide an object containing input parameters relevant to the chosen endpoint. Refer to the API documentation for specific details.

  • on_success: Define your custom logic to handle the output of the method.

🌐 Available URLs

πŸ’Έ Payment Endpoints

Endpoint
Method
Description

/payment/invoice

POST

Create a payment invoice

/payment/white-label

POST

Generate white-label payment

/payment/static-address

POST

Create static wallet address

/payment/static-address/revoke

POST

Revoke a static address

/payment/{track_id}

GET

Retrieve payment details by track ID

/payment

GET

Get a list of all your payment records

/payment/accepted-currencies

GET

List of your allowed cryptocurrencies

πŸ’΅ Payout Endpoints

Endpoint
Method
Description

/payout

POST

Send crypto payments

/payout/{track_id}

GET

Retrieve payout details by track ID

/payout

GET

Get a list of all your payout records

πŸ” Swap Endpoints

Endpoint
Method
Description

/general/swap

POST

Create a new crypto swap request

/general/swap

GET

Get a list of your swap history

/general/swap/pairs

GET

Get a list of supported currency swap pairs

/general/swap/calculate

POST

calculate output amount for a given swap request

/general/swap/rate

POST

Get real-time exchange rate between two currencies

πŸ“š Common Endpoints

Endpoint
Method
Description

/general/account/balance

POST

Get your current account balance

/common/prices

GET

Get real-time crypto prices

/common/currencies

GET

List supported cryptocurrencies

/common/fiats

GET

List supported fiat currencies

/common/networks

GET

List supported blockchain networks

Feel free to explore these endpoints to build powerful crypto payment solutions with Bots.business and OxaPay.

πŸ“ Examples

Explore practical examples of integrating Bots.business with OxaPay.

Payment Example: Create White Label

  • Execute the paytrx command to create a white-label payment.

  • Provide necessary options such as amount, currency, pay_currency, lifetime, order_id, and on_callback.

  • The onCreatePaymentWithTRX command handles the output, generating a QR code and providing payment details.

Command /payTrx

let options = {
	url: "/payment/white-label",
	method: "POST",
	fields: {
		amount: 100,
		currency: 'USD',
		pay_currency: "TRX",
		network: "TRC20",
		lifetime: 60,
		fee_paid_by_payer: 1,
		under_paid_coverage: 20,
		to_currency: "USDT",
		auto_withdrawal: false,
		email: "[email protected]",
		order_id: "ORD-12345",
		description: "Order #12345",
		on_callback: "/onCallbackPayment"
	},
	on_success: "/onCreatePaymentWithTRX"
}
Libs.OxaPayLibV1.apiCall(options)

Command /onCreatePaymentWithTRX

if (!options) { return }

if (options.status!= 200) {
  // not success
  Bot.sendMessage(options.error?.message || options.message);
  return
}

let toDate = new Date(options.data.expired_at * 1000).toISOString();

let caption = 
  "πŸ“¨ Address: <code>" + options.data.address + "</code>" +
  "<br>πŸ’° Coin: <b>" + options.data.currency + "</b>" +
  "<br>🌐 Network: <b>" + options.data.network + "</b>" +
  "<br>πŸ’΅ Amount: <code>" + options.data.pay_amount + "</code> " + options.data.pay_currency +
  "<br><br>‼️ Sending less may result in fund loss!" +
  "<br>‼️ Please only send <b>" + options.data.currency + "</b> on <b>" + options.data.network + "</b> network." +
  "<br>⏰ Expiry: " + toDate;

Api.sendPhoto({
  photo: options.data.qr_code,
  caption: caption,
  parse_mode: "HTML",
});

Payment Callback

  • When payment status changes, the /onCallbackPayment command processes the status and notifies users accordingly.

Command /onCallbackPayment

if (!options) return;

const ADMIN_TELEGRAM_ID = "PUT YOUR TELEGRAM ID HERE";

if (options.status == "paying"){
  Bot.sendMessage(
    `πŸ“’ Your paid ${options.amount} ${options.currency} is confirming...`
  );
}else if (options.status == "paid") {
  Bot.sendMessage(`βœ… Your payment was successful.`);
}

Api.sendMessage({
  chat_id: ADMIN_TELEGRAM_ID,
  text: "πŸ“’ Your invoice with trackId " + 
      `${options.track_id} and orderId ${options.order_id} ${options.status}`
});

Payout Example: Generate Payout

  • Use the transfer command to initiate a payout.

  • Specify options like amount, currency, address, and on_callback.

  • The onTransfer command captures the result, notifying users about the payout status.

Commend /transfer

let amount = 10;
let options = {
  url: "/payout",
  method: "POST",
  fields: {
    amount: amount,
    currency: "TRX",
    network: "TRC20",
    address: "RECEIVER_ADDRESS",
    on_callback: "/onCallbackPayout",
    description: "Order #12345"
  },
  on_success: "/onTransfer " + amount +" TRX",
};
Libs.OxaPayLibV1.apiCall(options);

Command /onTransfer

if (!options) return;
if (options.status == 200){
  Bot.sendMessage(
    `βœ… Send request submitted successfully!\nTrack ID: ${options.data.track_id}`
  );
} else {
  Bot.sendMessage(`❌ Your send request failed. ${options.error?.message || options.message}`);
}

if (options.data.status == "confirmed"){
  Bot.sendMessage("βœ… Your transfer was successful.");
}

Payout Callback

  • The /onCallbackPayout command reacts to payout status changes and keeps users informed.

Command /onCallbackPayout

if (!options) return

const ADMIN_TELEGRAM_ID = 'PUT YOUR TELEGRAM ID HERE'

if (options.status == 'Confirming'){
  Bot.sendMessage(`πŸ“’ Your withdrawal is confirming...`)
} else if(options.status == 'Confirmed'){
  Bot.sendMessage(`βœ… Your withdrawal was successfully completed!`)
}

Api.sendMessage({
  chat_id: ADMIN_TELEGRAM_ID,
  text: `πŸ“€ Withdrawal Alert:\nAmount: ${options.amount} ${options.currency}\nStatus: ${options.status}`
})

Swap Example: Swap Request

  • Execute the command swapBtc.

  • Provide necessary options such as amount, from_currency and to_currency.

  • The onSwapResponse command will handle the API response.

Command /swapBtc

let options = {
  url: "/general/swap",
  method:"POST",
  fields: {
	amount: 0.5,
	from_currency: "BTC",
	to_currency: "USDT",
  },
  on_success: "/onSwapResponse",
};
Libs.OxaPayLibV1.apiCall(options);

Command /onSwapResponse

if (!options) return;
if (options.status == 200){
  Bot.sendMessage(
    `βœ… Your swap request was successful!\nTrack ID: ${options.data.track_id}`
  );
} else {
  Bot.sendMessage(`❌ Your swap request failed. ${options.error?.message || options.message}`);
}

Last updated

Was this helpful?