Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.monei.cc/llms.txt

Use this file to discover all available pages before exploring further.

Overview

The Offramp Services provides a full suite of services for converting crypto to fiat, tracking transactions, and managing payout accounts. Included services:
  • Exchange — retrieve assets, get quotes, and initiate swaps
  • Ledger — view transaction history and track orders
  • Payouts — retrieve supported banks and verify bank accounts
All services require a properly configured MoneiClient instance.

Offramp Exchange

monei.offrampExchange allows you to retrieve available assets, get crypto-to-fiat quotes, and initiate swaps.

Get Offramp Assets

Retrieve a list of assets available for offramp transactions.
const assets = await monei.offrampExchange.getAssets();

console.log(assets);

Get Crypto-to-Fiat Quote

Retrieve a quote for swapping crypto to fiat.
const quoteRequest = {
  crypto: "USDT",
  fiat: "NGN",
  amount: 100
};

const quote = await monei.offrampExchange.getQuote(quoteRequest);

console.log(quote);

Initiate Swap

Initiate a crypto-to-fiat swap.
const swapData = {
  crypto: "USDT",
  fiat: "NGN",
  amount: 100,
  destinationBankAccount: "1234567890"
};

const order = await monei.offrampExchange.initiateSwap(swapData);

console.log(order);

Offramp Ledger

monei.offrampLedger provides methods to track transaction history and order statuses.

Get Offramp Transactions

Retrieve a paginated list of offramp transactions.
const requestData = {
  userId: "user-123",
  page: 1,
  limit: 10
};

const transactions = await monei.offrampLedger.getTransactions(requestData);

console.log(transactions);

Track Order

Track an individual order by reference.
const reference = "order-123";

const orderDetails = await monei.offrampLedger.trackOrder(reference);

console.log(orderDetails);

Offramp Payouts

monei.offrampPayouts provides methods to retrieve supported banks and verify payout accounts.

Get Offramp Banks

Retrieve a list of supported payout banks.
const banks = await monei.offrampPayouts.getBanks();

console.log(banks);

Verify Offramp Bank Account

Verify a bank account before initiating a payout.
const verifyData = {
  accountNumber: "0123456789",
  bankCode: "057"
};

const verification = await monei.offrampPayouts.verifyBankAccount(verifyData);

console.log(verification);

Working with Response Objects

All methods return objects with property access:
// Get assets response
const assets = await monei.offrampExchange.getAssets();
assets.data.forEach(asset => {
  console.log(asset.symbol);      // Asset symbol (e.g., "USDT")
  console.log(asset.name);        // Asset name (e.g., "Tether USD")
  console.log(asset.decimals);    // Token decimals
  console.log(asset.minAmount);   // Minimum swap amount
  console.log(asset.maxAmount);   // Maximum swap amount
});

// Get quote response
const quote = await monei.offrampExchange.getQuote({
  crypto: "USDT",
  fiat: "NGN",
  amount: 100
});
console.log(quote.cryptoAmount);     // Amount of crypto to send
console.log(quote.fiatAmount);       // Expected fiat amount
console.log(quote.exchangeRate);     // Exchange rate
console.log(quote.fee);              // Service fee
console.log(quote.totalAmount);      // Total fiat after fees
console.log(quote.expiresAt);        // Quote expiration time

// Initiate swap response
const order = await monei.offrampExchange.initiateSwap({
  crypto: "USDT",
  fiat: "NGN",
  amount: 100,
  destinationBankAccount: "1234567890"
});
console.log(order.id);               // Order ID
console.log(order.reference);        // Order reference
console.log(order.status);           // Order status
console.log(order.cryptoAmount);     // Crypto amount
console.log(order.fiatAmount);       // Fiat amount
console.log(order.bankAccount);      // Destination bank account
console.log(order.createdAt);        // Creation date

// Get transactions response
const transactions = await monei.offrampLedger.getTransactions({
  userId: "user-123",
  page: 1,
  limit: 10
});
transactions.data.forEach(tx => {
  console.log(tx.id);               // Transaction ID
  console.log(tx.reference);        // Transaction reference
  console.log(tx.type);             // Transaction type
  console.log(tx.cryptoAmount);     // Crypto amount
  console.log(tx.fiatAmount);       // Fiat amount
  console.log(tx.status);           // Transaction status
  console.log(tx.createdAt);        // Creation date
});
console.log(transactions.pagination); // Pagination info

// Track order response
const orderDetails = await monei.offrampLedger.trackOrder("order-123");
console.log(orderDetails.id);           // Order ID
console.log(orderDetails.reference);    // Order reference
console.log(orderDetails.status);       // Current status
console.log(orderDetails.cryptoAmount); // Crypto amount
console.log(orderDetails.fiatAmount);   // Fiat amount
console.log(orderDetails.bankAccount);  // Destination bank account
console.log(orderDetails.txHash);       // Transaction hash
console.log(orderDetails.confirmations); // Block confirmations
console.log(orderDetails.updatedAt);    // Last update date

// Get banks response
const banks = await monei.offrampPayouts.getBanks();
banks.data.forEach(bank => {
  console.log(bank.name);           // Bank name
  console.log(bank.code);           // Bank code
  console.log(bank.country);        // Country code
});

// Verify bank account response
const verification = await monei.offrampPayouts.verifyBankAccount({
  accountNumber: "0123456789",
  bankCode: "057"
});
console.log(verification.accountNumber);  // Verified account number
console.log(verification.accountName);    // Account holder name
console.log(verification.bankName);       // Bank name
console.log(verification.bankCode);       // Bank code
console.log(verification.verified);       // Verification status

Response Types

AssetDto

{
  symbol: string;
  name: string;
  decimals: number;
  minAmount: number;
  maxAmount: number;
}

OfframpQuoteResponseDto

{
  cryptoAmount: number;
  fiatAmount: number;
  exchangeRate: number;
  fee: number;
  totalAmount: number;
  expiresAt: string;
}

OfframpOrderResponseDto

{
  id: string;
  reference: string;
  status: 'pending' | 'processing' | 'completed' | 'failed';
  cryptoAmount: number;
  fiatAmount: number;
  bankAccount: string;
  createdAt: string;
}

OfframpTransactionDto

{
  id: string;
  reference: string;
  type: string;
  cryptoAmount: number;
  fiatAmount: number;
  status: string;
  createdAt: string;
}

BankDto

{
  name: string;
  code: string;
  country: string;
}

VerifyBankAccountResponseDto

{
  accountNumber: string;
  accountName: string;
  bankName: string;
  bankCode: string;
  verified: boolean;
}

Error Handling

All offramp service calls may throw an error if the request fails.
import { MoneiError } from 'monei-sdk';

try {
  const quote = await monei.offrampExchange.getQuote({
    crypto: "USDT",
    fiat: "NGN",
    amount: 100
  });
  console.log(quote.fiatAmount);
} catch (error) {
  if (error instanceof MoneiError) {
    console.error(error.statusCode);  // HTTP status code
    console.error(error.message);     // Error message
    console.error(error.code);        // Error code
  }
}

Service Overview

ServiceMethodDescription
ExchangegetAssets()Retrieve available assets
getQuote(request)Get crypto-to-fiat quote
initiateSwap(data)Initiate crypto-to-fiat swap
LedgergetTransactions(request)Get offramp transactions
trackOrder(reference)Track order by reference
PayoutsgetBanks()Get supported payout banks
verifyBankAccount(data)Verify bank account

Notes

  • All requests require a properly configured MoneiClient with authentication
  • Always validate input data and ensure the correct crypto/fiat codes before initiating swaps
  • Quotes expire after a certain period - obtain a fresh quote before swapping
  • Bank account verification is recommended before initiating payouts
  • All responses are strongly typed objects with property access