Bots.Business - Help
Ask or search…
K

OxaPay

With the OxaPay 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 OxaPay Getting Started Guide.
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:
- `url`: Specify OxaPay endpoints, such as '/merchants/request' or '/api/send' (refer to the OxaPay documentation for a full list of endpoints).
- `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
1
let options = {
2
url: "merchants/request/whitelabel",
3
fields: {
4
amount: 100,
5
currency: "TRX",
6
payCurrency: "TRX",
7
lifeTime: 90,
8
orderId: "ORD-124",
9
onCallback: "/onCallbackPayment",
10
},
11
onSuccess: "/onCreatePaymentWithTRX",
12
};
13
14
Libs.OxaPayLib.apiCall(options);
command /onCreatePaymentWithTRX
1
if (!options) { return }
2
3
if (options.result!= 100) {
4
// not success
5
Bot.sendMessage(options.message);
6
return
7
}
8
9
// result is 100 / success
10
let toDate = new Date(options.expiredAt * 1000).toISOString();
11
let caption =
12
"📨Address <code>" + options.address + "</code>" +
13
"\<br>Coin" + options.currency +
14
"\<br>Network" +
15
"\<br>" + options.network +
16
"\<br>Amount <code>" + options.payAmount + "</code> " +
17
options.payCurrency + "" +
18
"\<br>‼️ Sending less may result fund loss" +
19
"\<br>‼️ Please only send " + options.currency + " on " + options.network +
20
"\n network to the address until " + toDate
21
22
Api.sendPhoto({
23
photo: options.QRCode,
24
caption: caption,
25
parse_mode: "HTML",
26
});

Payment Callback

- When payment status changes, the `/onCallbackPayment` command processes the status and notifies users accordingly.
command /onCallbackPayment
1
const ADMIN_TELEGRAM_ID = "PUT YOUR TELEGRAM ID HERE";
2
3
if (!options) return;
4
5
if (options.status == "Confirming"){
6
Bot.sendMessage(
7
`📢 Your paid ${options.payAmount} ${options.payCurrency} is confirming...`
8
);
9
}else if (options.status == "Paid") {
10
Bot.sendMessage(`📢 Your payment was successful`);
11
}
12
13
Api.sendMessage({
14
chat_id: ADMIN_TELEGRAM_ID,
15
text: "📢 Your invoice with trackId " +
16
`${options.trackId} and orderId ${options.orderId} ${options.status}`
17
});
18

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
1
let amount = 10;
2
let options = {
3
url: "api/send",
4
fields: {
5
amount: amount,
6
currency: "TRX",
7
address: "YOUR_PRIVATE_ADDRESS",
8
onCallback: "/onCallbackPayout",
9
},
10
onSuccess: "/onTransfer " + amount +" TRX",
11
};
12
Libs.OxaPayLib.apiCall(options);
command /onTransfer
1
if (!options) return;
2
if (options.result == 100){
3
Bot.sendMessage(
4
`Send ${params} was submited!\nYour trackId: ${options.trackId}`
5
);
6
} else {
7
Bot.sendMessage(`Your send request failed. ${options.message}`);
8
}
9
10
if (options.status == "complete"){
11
Bot.sendMessage("Your transfer was successful");
12
}

Payout Callback

The /onCallbackPayout command reacts to payout status changes and keeps users informed.
command /onCallbackPayout
1
if (!options) return
2
3
const ADMIN_TELEGRAM_ID = 'PUT YOUR TELEGRAM ID HERE'
4
5
if (options.status == 'Confirming'){
6
Bot.sendMessage(`📢 Your withdrawal is confirming...`)
7
} else if(options.status == 'Complete'){
8
Bot.sendMessage(`📢 Your withdrawal was successfully complete!`)
9
}
10
11
Api.sendMessage({
12
chat_id: ADMIN_TELEGRAM_ID,
13
text: "📢 Your client withdraw " +
14
`${options.amount} ${options.currency} ${options.status} `
15
})