Bots.Business - Help
  • Welcome
  • Getting started
  • Create bot from Google Table
  • App
    • Reset or Update Your Password
  • Commands
    • Answer
    • Aliases
    • Keyboard
    • Groups
    • Wait for answer
    • Auto Retry (AR)
  • Coding: BJS
    • Variables
    • Bot functions
    • Message broadcasting and editing
    • User functions
    • Properties
    • Always running commands
    • Error command: "!"
    • Lists
      • Migration from properties to list
    • Api functions
    • BB Admin functions
    • Admin Panel
    • Send HTTP request
    • Web App
    • Caching
    • Inline Bot
    • BJS Security
    • Good coding practices
    • Top errors
  • Git
    • Import bot from Git repository
    • Export bot to Git repository
    • Repository structure
    • File: bot.json
    • Automatic importing on Git push
  • Iterations. How to reduce theys?
  • Limitations
  • Cloud
  • Reports
  • Deep Linking - pass any params on Bot starting
  • How to link chat account with BB account?
  • BB Inspection
  • Protected bot
  • VS Code
  • How to...
  • Smart Bot
    • Overview
    • Lang File
    • SmartBot
    • SmartTasker
    • Amount Dialog
  • Libs
    • What it is - Libs?
    • Libs development
    • RefferalLib
    • ResourcesLib
    • Random
    • MembershipChecker (MCL)
    • Cooldown Lib
    • CurrencyConverter
    • Lang
    • TopBoardLib
    • QiwiPayments
    • Coinbase (CB)
    • CoinPayments (CP)
    • OxaPay
    • CryptoJS
    • CurrencyQuote
    • GoogleApp
    • GoogleTableSync
    • Guard
    • Webhooks lib
    • DateTimeFormat Lib
  • Store
    • BB Point Bot
    • Welcome bot
    • Help bot
    • SRB Demo Keyboard Tools
Powered by GitBook
On this page
  • Getting Started
  • Try Out the Sample Bot
  • Calling API Methods
  • Available URLs
  • Examples
  • Creating White-Label Payment
  • Creating Payout

Was this helpful?

  1. Libs

OxaPay

PreviousCoinPayments (CP)NextCryptoJS

Last updated 1 year ago

Was this helpful?

With the merchant web service, Bots.Business enables you to seamlessly accept crypto payments from your customers and facilitate hassle-free crypto payouts.

This integration empowers you to provide efficient, secure, and quick transactions, all without the need for extensive KYC procedures

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 .

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

Libs.OxaPayLib.setMerchantKey("YOUR_MERCHANT_KEY");
Libs.OxaPayLib.setPayoutApiKey("YOUR_PAYOUT_API_KEY");

For testing purposes, you can use 'sandbox' as the merchant key to access the OxaPay merchant web service in a sandbox environment.

Try Out the Sample Bot

Experience the convenience of OxaPay integration by trying our sample bot. Install and test the demo bot using the OxapayLibSampleBot library.

Visit Store > Crypto > OxapayLibSampleBot to get started.

Calling API Methods

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

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

- `onSuccess`: Define your custom logic to handle the output of the method.

Available URLs

Here is a list of commonly used OxaPay endpoints:

- `/merchants/request`: Request crypto payments.

- `/merchants/request/whitelabel`: Request crypto payments with white-label options.

- `/merchants/request/staticaddress`: Request crypto payments with static addresses.

- `/merchants/revoke/staticaddress`: Revoke static addresses.

- `/merchants/inquiry`: Make inquiries about crypto payments.

- `/merchants/list`: Listof your crypto payments.

- `/merchants/allowedcoins`: Get a list of your allowed cryptocurrencies.

- `/merchants/rate`: Check exchange rates.

- `/api/send`: Send crypto payments.

- `/api/list`: List of your pauout transactions.

- `/api/balance`: Check your account balance.

- `/api/currencies`: Get a list of supported cryptocurrencies by OxaPay.

- `/api/networks`: List of supported networks.

- `/monitor`: Monitor OxaPay service availability.

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.

Creating White-Label Payment

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

- Provide necessary options such as amount, currency, payCurrency, lifeTime, orderId, and onCallback.

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

Command /paytrx

let options = {
  url: "merchants/request/whitelabel",
  fields: {
    amount: 100,
    currency: "TRX",
    payCurrency: "TRX",
    lifeTime: 90,
    orderId: "ORD-124",
    onCallback: "/onCallbackPayment",
  },
  onSuccess: "/onCreatePaymentWithTRX",
};

Libs.OxaPayLib.apiCall(options);

command /onCreatePaymentWithTRX

if (!options) { return }

if (options.result!= 100) {
  // not success
  Bot.sendMessage(options.message);
  return
}

// result is 100 / success
let toDate = new Date(options.expiredAt * 1000).toISOString();
let caption = 
  "📨Address <code>" + options.address + "</code>" +
  "\<br>Coin" + options.currency +
  "\<br>Network" +
  "\<br>" + options.network +
  "\<br>Amount <code>" + options.payAmount + "</code> " + 
    options.payCurrency + "" +
  "\<br>‼️ Sending less may result fund loss" +
  "\<br>‼️ Please only send " + options.currency + " on " + options.network +
  "\n network to the address until " + toDate

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

Payment Callback

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

command /onCallbackPayment

const ADMIN_TELEGRAM_ID = "PUT YOUR TELEGRAM ID HERE";

if (!options) return;

if (options.status == "Confirming"){
  Bot.sendMessage(
    `📢 Your paid ${options.payAmount} ${options.payCurrency} 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.trackId} and orderId ${options.orderId} ${options.status}`
});

Creating Payout

- Use the command /transfer to initiate a payout.

- Specify options like amount, currency, address, and onCallback.

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

commend /transfer

let amount = 10;
let options = {
  url: "api/send",
  fields: {
    amount: amount,
    currency: "TRX",
    address: "YOUR_PRIVATE_ADDRESS",
    onCallback: "/onCallbackPayout",
  },
  onSuccess: "/onTransfer " + amount +" TRX",
};
Libs.OxaPayLib.apiCall(options);

command /onTransfer

if (!options) return;
if (options.result == 100){
  Bot.sendMessage(
    `Send ${params} was submited!\nYour trackId: ${options.trackId}`
  );
} else {
  Bot.sendMessage(`Your send request failed. ${options.message}`);
}

if (options.status == "complete"){
  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 == 'Complete'){
  Bot.sendMessage(`📢 Your withdrawal was successfully complete!`)
}

Api.sendMessage({
  chat_id: ADMIN_TELEGRAM_ID,
  text: "📢 Your client withdraw " +
   `${options.amount} ${options.currency} ${options.status} `
})

- `url`: Specify OxaPay endpoints, such as '/merchants/request' or '/api/send' (refer to the OxaPay for a full list of endpoints).

OxaPay
OxaPay Getting Started Guide
documentation
Page cover image