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

fintoc

v1.9.0

Published

The official Node client for the Fintoc API.

Readme

Table of Contents

Installation

Install using npm! (or your favourite package manager)

# Using npm
npm install fintoc

# Using yarn
yarn add fintoc

Note: This SDK requires Node 10+.

Usage

The idea behind this SDK is to stick to the API design as much as possible, so that it feels ridiculously natural to use even while only reading the raw API documentation.

Quickstart

To be able to use this SDK, you first need to get your secret API Key from the Fintoc Dashboard. Once you have your API key, all you need to do is initialize a Fintoc object with it and you're ready to start enjoying Fintoc!

import { Fintoc } from 'fintoc';

const fintocClient = new Fintoc('your_api_key');

// List all succeeded payment intents since the beginning of 2025
const paymentIntents = await fintocClient.paymentIntents.list({ since: '2025-01-01' });
for await (const pi of paymentIntents) {
  console.log(pi.created_at, pi.amount, pi.status);
}

// Get a specific payment intent
const paymentIntent = await fintocClient.paymentIntents.get('pi_12312312');
console.log(paymentIntent.created_at, paymentIntent.amount, paymentIntent.status);

Calling endpoints

The SDK provides direct access to Fintoc API resources following the API structure. Simply use the resource name and follow it by the appropriate action you want.

Notice that not every resource has all of the methods, as they correspond to the API capabilities.

list

You can use the list method to list all the instances of the resource:

const webhookEndpoints = await fintocClient.webhookEndpoints.list();

The list method returns an async generator with all the instances of the resource. This method can also receive the arguments that the API receives for that specific resource. For example, the PaymentIntent resource can be filtered using since and until, so if you wanted to get a range of payment intents, all you need to do is to pass the parameters to the method:

const paymentIntents = await fintocClient.paymentIntents.list({
  since: '2019-07-24',
  until: '2021-05-12',
});

Notice that, in order to iterate over the async generator, you need to await the generator itself and then each of the instances:

const paymentIntents = await fintocClient.paymentIntents.list({
  since: '2019-07-24',
  until: '2021-05-12',
});

for await (const paymentIntent of paymentIntents) {
  console.log(paymentIntent.id);
}

You can also pass the lazy: false parameter to the method to force the SDK to return a list of all the instances of the resource instead of the generator. Beware: this could take very long, depending on the amount of instances that exist of said resource:

const paymentIntents = await fintocClient.paymentIntents.list({ lazy: false });

Array.isArray(paymentIntents); // true

get

You can use the get method to get a specific instance of the resource:

const paymentIntent = await fintocClient.paymentIntents.get('pi_8anqVLlBC8ROodem');

create

You can use the create method to create an instance of the resource:

const webhookEndpoint = await fintocClient.webhookEndpoints.create({
  url: 'https://webhook.site/58gfb429-c33c-20c7-584b-d5ew3y3202a0',
  enabled_events: ['link.credentials_changed'],
  description: 'Fantasting webhook endpoint',
});

The create method of the managers creates and returns a new instance of the resource. The attributes of the created object are passed as an options object, and correspond to the parameters specified by the API documentation for the creation of said resource.

update

You can use the update method to update an instance of the resource:

const webhookEndpoint = await fintocClient.webhookEndpoints.update(
  'we_8anqVLlBC8ROodem',
  {
    enabled_events: ['account.refresh_intent.succeeded'],
    disabled: true,
  },
);

The update method of the managers updates and returns an existing instance of the resource using its identifier to find it. The first parameter of the method corresponds to the identifier being used to find the existing instance of the resource. The attributes to be modified are passed as an options object, and correspond to the parameters specified by the API documentation for the update action of said resource.

delete

You can use the delete method to delete an instance of the resource:

const deletedIdentifier = await fintocClient.webhookEndpoints.delete('we_8anqVLlBC8ROodem');

The delete method of the managers deletes an existing instance of the resource using its identifier to find it and returns the identifier.

Webhook Signature Validation

To ensure the authenticity of incoming webhooks from Fintoc, you should always validate the signature. The SDK provides a WebhookSignature class to verify the Fintoc-Signature header

WebhookSignature.verifyHeader(
    req.body,
    req.headers['fintoc-signature'],
    'your_webhook_secret'
)

The verifyHeader method takes the following parameters:

  • payload: The raw request body as a string
  • header: The Fintoc-Signature header value
  • secret: Your webhook secret key (found in your Fintoc dashboard)
  • tolerance: Number of seconds to tolerate when checking timestamp (default: 300)

If the signature is invalid or the timestamp is outside the tolerance window, a WebhookSignatureError will be raised with a descriptive message.

For a complete example of handling webhooks, see examples/webhook.js.

Idempotency Keys

You can provide an Idempotency Key using the idempotency_key argument. For example:

const transfer = await fintoc.v2.transfers.create({
    idempotency_key: '12345678',
    amount: 54123,
    currency: 'mxn',
    account_id: 'acc_12345678',
    counterparty: {
      account_number: '012969100000000026',
    },
    metadata: {
      customer_id: '19385014'
    }
  });

Serialization

Any resource of the SDK can be serialized! To get the serialized resource, just call the serialize method!

const account = (await link.accounts.list({ lazy: false }))[0];

const serialization = account.serialize();

The serialization corresponds to an object with only simple types, that can be JSON-serialized.

Acknowledgements

The first version of this SDK was originally written by @daleal as a port (carbon copy) of @nebil’s (original version of) fintoc-python.