
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
flutterwave-node-v4
Advanced tools
The unofficial Flutterwave Node.js SDK for v4 APIs. This library provides a simple and intuitive way to integrate Flutterwave payment services into your Node.js applications.
# Using npm
npm install flutterwave-node-v4
# Using yarn
yarn add flutterwave-node-v4
# Using pnpm
pnpm add flutterwave-node-v4
import { Flutterwave } from 'flutterwave-node-v4';
// Initialize with individual parameters
const flutterwave = new Flutterwave(
'your_client_id',
'your_client_secret',
'your_encryption_key', // optional
'sandbox', // 'sandbox' or 'live'
);
// Or initialize with options object
const flutterwave = new Flutterwave({
clientId: 'your_client_id',
clientSecret: 'your_client_secret',
encryptionKey: 'your_encryption_key', // optional
environment: 'sandbox', // 'sandbox' or 'live'
});
// Make your first API call
const banks = await flutterwave.api.banks.list('NG');
console.log(banks);
The SDK can be configured using environment variables or by passing options directly:
// Using environment variables
// CLIENT_ID=your_client_id
// CLIENT_SECRET=your_client_secret
// ENCRYPTION_KEY=your_encryption_key
// ENVIRONMENT=sandbox # or 'live'
const flutterwave = new Flutterwave();
// Pass credentials as individual parameters
const flutterwave = new Flutterwave(
'your_client_id',
'your_client_secret',
'your_encryption_key', // optional
'sandbox', // optional: 'sandbox' or 'live', defaults to 'live'
);
// Or pass as an options object
const flutterwave = new Flutterwave({
clientId: 'your_client_id',
clientSecret: 'your_client_secret',
encryptionKey: 'your_encryption_key', // optional
environment: 'sandbox', // optional: 'sandbox' or 'live', defaults to 'live'
});
The SDK automatically handles authentication using your client credentials. All API requests are authenticated, and the SDK manages token refresh automatically.
const transfer = await flutterwave.api.transfers.directTransfer({
action: 'instant',
reference: 'unique-ref-' + Date.now(),
narration: 'Payment for services',
type: 'bank',
payment_instruction: {
source_currency: 'NGN',
destination_currency: 'NGN',
amount: {
value: 10000,
applies_to: 'source_currency',
},
recipient: {
bank: {
account_number: '0690000031',
code: '044',
},
},
sender: {
name: {
first: 'John',
last: 'Doe',
},
},
},
});
console.log('Transfer ID:', transfer.id);
console.log('Status:', transfer.status);
const result = await flutterwave.api.transfers.list(
{
page: 1,
size: 20,
},
'trace-id', // optional
);
console.log(`Found ${result.data.length} transfers`);
const transfer = await flutterwave.api.transfers.retrieve(
'transfer_id',
'trace-id', // optional
);
const virtualAccount = await flutterwave.api.virtualAccounts.create({
reference: 'va-ref-' + Date.now(),
customer_id: 'customer_id_here',
amount: 1000,
currency: 'NGN',
account_type: 'static',
});
console.log('Account Number:', virtualAccount.account_number);
console.log('Bank Name:', virtualAccount.bank_name);
const accounts = await flutterwave.api.virtualAccounts.list({
page: 1,
size: 10,
});
// Get balance for specific currency
const ngnBalance = await flutterwave.api.wallets.balance('NGN');
console.log('Available:', ngnBalance.available_balance);
console.log('Total:', ngnBalance.total_balance);
// Get all balances
const allBalances = await flutterwave.api.wallets.balances();
const account = await flutterwave.api.wallets.accountResolve({
account_number: '0690000031',
bank_code: '044',
});
console.log('Account Name:', account.account_name);
const banks = await flutterwave.api.banks.list('NG');
banks.forEach((bank) => {
console.log(`${bank.name} - ${bank.code}`);
});
const branches = await flutterwave.api.banks.branches('bank_id');
const result = await flutterwave.api.settlements.list(
{
page: 1,
size: 20,
},
'trace-id', // optional
);
const settlement = await flutterwave.api.settlements.retrieve(
'settlement_id',
'trace-id', // optional
);
The SDK provides custom exceptions for different error scenarios:
import {
BadRequestException,
UnauthorizedRequestException,
ForbiddenRequestException,
} from 'flutterwave-node-v4';
try {
const transfer = await flutterwave.api.transfers.create({
// ... transfer data
});
} catch (error) {
if (error instanceof BadRequestException) {
console.error('Invalid request:', error.message);
} else if (error instanceof UnauthorizedRequestException) {
console.error('Authentication failed:', error.message);
} else if (error instanceof ForbiddenRequestException) {
console.error('Access denied:', error.message);
} else {
console.error('An error occurred:', error);
}
}
Validate webhook signatures to ensure they're from Flutterwave:
import { WebhookValidator } from 'flutterwave-node-v4';
const validator = new WebhookValidator('your_secret_hash');
// In your webhook endpoint
app.post('/webhook', (req, res) => {
const signature = req.headers['verif-hash'];
if (validator.validate(signature)) {
// Process the webhook
const event = req.body;
console.log('Webhook event:', event);
res.sendStatus(200);
} else {
res.sendStatus(401);
}
});
The SDK provides access to all Flutterwave v4 APIs:
flutterwave.api.banksflutterwave.api.chargesflutterwave.api.chargebacksflutterwave.api.customersflutterwave.api.feesflutterwave.api.mobileNetworksflutterwave.api.orchestrationflutterwave.api.ordersflutterwave.api.paymentMethodsflutterwave.api.refundsflutterwave.api.settlementsflutterwave.api.transferRatesflutterwave.api.transferRecipientsflutterwave.api.transfersflutterwave.api.transferSendersflutterwave.api.virtualAccountsflutterwave.api.walletsFor detailed API documentation, visit https://flutterwave.toneflix.net
This SDK is written in TypeScript and provides comprehensive type definitions:
import type {
ITransfer,
IVirtualAccount,
IDirectTransferForm,
} from 'flutterwave-node-v4/contracts';
const transferData: IDirectTransferForm = {
action: 'instant',
payment_instruction: {
// TypeScript will provide autocomplete and type checking
},
};
We welcome contributions! Please see our Contributing Guide for details.
# Clone the repository
git clone https://github.com/toneflix/flutterwave-4-nodejs-sdk.git
cd flutterwave-4-nodejs-sdk
# Install dependencies
pnpm install
# Run tests
pnpm test
# Build
pnpm build
This project is licensed under the MIT License - see the LICENSE file for details.
Maintained by Toneflix
Note: This is an unofficial SDK. For the official Flutterwave SDK and documentation, visit Flutterwave Developers.
FAQs
Flutterwave v4 payment APIs SDK for Node.JS.
The npm package flutterwave-node-v4 receives a total of 2 weekly downloads. As such, flutterwave-node-v4 popularity was classified as not popular.
We found that flutterwave-node-v4 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.