Installation & Configuration

The official Node.js SDK for the Felloh payments API. Use it to manage bookings, transactions, payment links, and all other Felloh resources from your server.

- NPM Package

- Github Repository


Installation

The SDK requires Node.js 18 or later.

Install the SDK

npm install @felloh-org/node-sdk

Quick Start

Import the FellohClient class and create an instance with your API keys. The client handles authentication, token management, retries, and pagination automatically.

Your API keys can be created and managed from the Felloh dashboard. See the API Keys resource for managing keys programmatically.

Quick Start

import { FellohClient } from '@felloh-org/node-sdk';

const client = new FellohClient({
  publicKey: process.env.FELLOH_PUBLIC_KEY,
  privateKey: process.env.FELLOH_PRIVATE_KEY,
});

// List bookings
const bookings = await client.bookings.list({
  organisation: 'your-org-id',
});
console.log(bookings.data);

Configuration Options

The FellohClient constructor accepts a configuration object with the following options.

Parameters

  • Name
    publicKeyrequired
    Type
    string
    Description

    Your Felloh public API key.

  • Name
    privateKeyrequired
    Type
    string
    Description

    Your Felloh private API key.

  • Name
    baseUrl
    Type
    string
    Description

    Base URL for the Felloh API. Defaults to https://api.felloh.com.

  • Name
    timeout
    Type
    integer
    Description

    Request timeout in milliseconds. Defaults to 30000 (30 seconds).

  • Name
    maxRetries
    Type
    integer
    Description

    Number of automatic retries on 5xx or network errors. Defaults to 2. Uses exponential backoff.

  • Name
    tokenRefreshBuffer
    Type
    integer
    Description

    Seconds before token expiry to proactively refresh. Defaults to 60.

  • Name
    logger
    Type
    function
    Description

    Optional callback invoked after every HTTP request for logging and observability. Receives a LogEntry object.

Full Configuration

import { FellohClient } from '@felloh-org/node-sdk';

const client = new FellohClient({
  publicKey: 'your-public-key',
  privateKey: 'your-private-key',
  baseUrl: 'https://api.felloh.com',
  timeout: 30000,
  maxRetries: 2,
  tokenRefreshBuffer: 60,
  logger: (entry) => {
    console.log(
      `${entry.method} ${entry.url}${entry.statusCode} (${entry.durationMs}ms)`
    );
  },
});

Token Management

The SDK automatically handles JWT token acquisition and refresh. Tokens are cached in memory and proactively refreshed before expiry based on the tokenRefreshBuffer setting. No manual token management is needed.

If a request receives a 401 response, the SDK will automatically refresh the token and retry the request once.


Available Resources

Every resource on the Felloh API is accessible through a property on the client instance.

ResourceClient PropertyDocumentation
Organisationsclient.organisationsOrganisations
Bookingsclient.bookingsBookings
Booking Componentsclient.bookingComponentsBooking Components
Transactionsclient.transactionsTransactions
Customersclient.customersCustomers
Payment Linksclient.paymentLinksPayment Links
Ecommerceclient.ecommerceEcommerce
Refundsclient.refundsRefunds
Chargesclient.chargesCharges
Chargebacksclient.chargebacksChargebacks
Credit Notesclient.creditNotesCredit Notes
Suppliersclient.suppliersSuppliers
Beneficiariesclient.beneficiariesBeneficiaries
Disbursementsclient.disbursementsDisbursements
Ledgerclient.ledgerLedger
Acquirer Settlementclient.batchesAcquirer Settlement
API Keysclient.apiKeysAPI Keys
Auditclient.auditAudit
AISPclient.aispAISP
Scheduled Paymentsclient.scheduledPaymentsScheduled Payments
Enumsclient.enumsEnums