npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@finix-payments/finix

v3.0.1

Published

The Finix API library for NodeJS

Readme

Finix Node.js API Library

This is the official Finix Node.js API Library

Installation

Prerequisites

  • Node.js 16 or higher
  • Suggested: Your own API credentials. Our tests use the API credentials from Finix's public documentation, however you need your own credentials to submit requests.

NPM

npm install --save @finix-payments/finix

Using the Library

Initialization

Provide your api username and password as well as the environment you are interacting with.

import {Client, Environment, Models} from '@finix-payments/finix';

const userName = 'USsRhsHYZGBPnQw8CByJyEQW';
const password = '8a14c2f9-d94b-4c72-8f5c-a62908e5b30e';

const client = new Client(userName, password, Environment.Sandbox);

Example API

Here is an example creating a Transfer:

const createTransferRequest: Models.CreateTransferRequest = {
             currency: Models.Currency.Usd,
             merchant: "MUeDVrf2ahuKc9Eg5TeZugvs",
             tags: {
                 "test": "sale"
             },
             source: "PIe2YvpcjvoVJ6PzoRPBK137",
             amount: 662154,
         };
const transfer = await client.Transfers.create(saleRequest);

Retrieving List

finixList serves as the return type for all functions that involve retrieving a list. Here is an example of retrieving a list of transfers with and without query paramters, and a demonstration of the properties of finixList.

// Retrieving list of all transfers 
const transfersList : Models.finixList<Models.Transfer> = await client.Transfers.list();

// Retrieving list of transfers with the following filters: 
// List limit: 2
// Amount less than 100
// Transfer type: Debits 
const transfersListWithFilter = await client.Transfers.list({
    limit: 2,
    amountLt: 100,
    type: "Debits"  
});

// Accessing transfers in the list and print out value
for (let currTransfer of transfersList){
        console.log(currTransfer);
}

// Get the size of the current list 
const transferListSize : number = transfersList.size;

// Get the page object that contains properties including offset/nextCursor, limit.
// Note: refer to the specific api to see if the page object associated is of type pageCursor or pageOffset
const page : Models.PageCursor = transfersList.page;

// Get the links 
const links : Models.ListLinks = transfersList.links;

// Check if there is more to list, value equals to False if end of list has been reached 
const hasMore : Boolean = transfersList.hasMore;

// Get the next list 
const nextTransfersList : Models.finixList<Models.Transfer> = await transfersList.listNext();

Uploading file

Files are expected to be of the type fs.ReadStream. Below is an example of uploading a dispute evidence file.

import * as fs from 'fs';

const fileName : string = __dirname.concat("/test.png");
const fileObject: fs.ReadStream = fs.createReadStream(fileName);
const uploadedDisputeEvidence = await client.Disputes.createDisputeEvidence(disputeId, {
    file: fileObject});

Error handling

Errors can be caught and handled with try-catch blocks. Below is an example of catching an error and accessing its information.

const userName = 'USsRhsHYZGBPnQw8CByJyEQW';
const wrongPassword = '123';

try{
    const invalidClient = new Client(userName, wrongPassword, Environment.Sandbox);
    let transferList = await invalidClient.Transfers.list();
}catch(error){
    // Print basic http information of the error
    console.log(error.statusCode);
    console.log(error.headers);

    // Print message of each error 
    for (let e of error.body){
        console.log(e.message);
    }

    // Access raw http incoming message of the error 
    const errorRawResponse = error.response;
}

Supported APIs

  • Transfers
  • Authorizations
  • Identities
  • Merchants
  • Payment Instruments
  • Instrument Updates
  • Balance Transfers
  • Devices
  • Disputes
  • Files
  • Settlements
  • Webhooks
  • Verifications
  • Merchant Profiles
  • Fee Profiles
  • Onboarding Forms
  • Compliance Forms