nuBlock Business API
Complete API reference for viewing enabled currencies, sending payments, and swapping cross-chain currencies.
https://apipayments.nublock.xyz/api/business/v1/enabledCurrencies?businessId=:businessIdParameters
The unique identifier for the account
Example Request
// Get enabled currencies for an account
const response = await fetch(
'https://apipayments.nublock.xyz/api/business/v1/enabledCurrencies?businessId=:businessId',
{
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
}
);
const response = await response.json();
// Response: { _id, name, symbol, decimals, price }
console.log(response.data);/Request Body
Example Request
// Send a payment
const response = await fetch(
'',
{
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: 1500,
currencyId: '67ceda3edaadb',
user_address: '0xabcd...ef12',
recipientWallet: '0xabcd...ef12',
apiKey: '68c8ed6be1d147a
})
}
);
const payment = await response.json();
console.log(payment.success, payment.data.to, payment.data.data, payment.data.value, payment.data.approve);
// When approve address is provided you need to approve it for token transfer
/Request Body
Example Request
// Swap
const response = await fetch(
'',
{
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: 1500,
inputCurrencyId: '67ceda3edaadb',
outputCurrencyId: '67ceda3edaadb',
user_address: '0xabcd...ef12',
apiKey: '68c8ed6be1d147a
})
}
);
const swap = await response.json();
console.log(swap.success, swap.data.to, swap.data.data, swap.data.value, swap.data.approve);
// When approve address is provided you need to approve it for token transfer
/The Checkout Widget allows you to embed a secure checkout experience directly into your website using a simple JavaScript integration.
Prerequisites
- Valid API Key
- Basic knowledge of HTML & JavaScript
- Access to edit your website's source code
Step 1: Include the Script
Add the widget script before the closing </body> tag.
<script src="https://auth.nublock.xyz/assets/js/pages/checkout-widget.js?businessId=:apiKey"></script>Step 2: Add Button Container
Create a container where the checkout button will be rendered.
<div id="my_checkout" data-checkout-widget
data-amount="49.99"
data-currency="USD"
data-name="John Doe"
data-email="john@example.com"
data-phone="+1234567890"
data-account-id="API KEY"></div>Step 3: Initiaze nuBlock Widget
window.nuBlockInitWidget()Step 4: Read Transaction Status
window.addEventListener("message", handleMessage);
const handleMessage = (event: MessageEvent) => {
// ✅ Only accept messages from popup
if (!event.data || !event.data.status) return;
if (event.data.status === "success") {
console.log("Success:", event.data);
} else if (event.data.status === "failure") {
alert("Payment Failed!");
console.error("Failure:", event.data);
}
};
Source Code : https://gitlab.com/nuBlock/checkout_example_products_shoppingcart
Overview
The nuBlock Business API implements rate limiting to ensure fair usage and maintain service stability. Rate limits are applied on a per-account basis.
Platform Fees
A platform fee of 15 basis points (0.15%) is applied to each transaction. This fee is automatically deducted from the transaction amount.
Example: For a $1,000 transaction, the platform fee would be $1.50
Rate Limit Tiers
Suitable for most integrations
Response Headers
Every API response includes headers with rate limit information:
| Header | Description |
|---|---|
| X-RateLimit-Limit | Maximum requests allowed per minute |
| X-RateLimit-Remaining | Number of requests remaining in current window |
| X-RateLimit-Reset | Unix timestamp when the rate limit resets |
Handling Rate Limit Errors
When you exceed the rate limit, the API returns a 429 Too Many Requests response:
{
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Too many requests. Please retry after 60 seconds.",
"retryAfter": 60
}
}Best Practice: Implement exponential backoff when retrying requests after receiving a 429 response.