Code Monkey home page Code Monkey logo

nordigen-node's Introduction

Nordigen Node.js Library

This is official Node client library for Nordigen.

For a full list of endpoints and arguments, see the docs.

Before starting to use API you will need to create a new secret and get your SECRET_ID and SECRET_KEY from the Nordigen's Open Banking Portal.

Requirements

  • Node >= 12.0

Installation

Install library via npm:

npm install nordigen-node --save
# or
yarn add nordigen-node

Example application

Express example application can be found in example directory

Quickstart

// Get secretId and secretKey from ob.nordigen.com portal and pass to NordigenClient or load from .env file
const client = new NordigenClient({
    secretId: process.env.SECRET_ID,
    secretKey: process.env.SECRET_KEY
});

// Generate new access token. Token is valid for 24 hours
const tokenData = await client.generateToken();

// Get access and refresh token
// Note: access_token is automatically injected to other requests after you successfully obtain it
const token = tokenData.access;
const refreshToken = tokenData.refresh;

// Exchange refresh token. Refresh token is valid for 30 days
const newToken = await client.exchangeToken({refreshToken: refreshToken});

// Use existing token
client.token = process.env.TOKEN;

// Get list of institutions
const institutions = await client.institution.getInstitutions({country: "LV"});

// Institution id can be gathered from getInstitutions response.
// Example Revolut ID
const institutionId = "REVOLUT_REVOGB21";

// Initialize new bank session
const init = await client.initSession({
    redirectUrl: "https://nordigen.com",
    institutionId: institutionId,
    referenceId: randomUUID()
})

// Get link to authorize in the bank
// Authorize with your bank via this link, to gain access to account data
const link = init.link;
// requisition id is needed to get accountId in the next step
const requisitionId = init.id;

After successful authorization with a bank you can fetch your data (details, balances, transactions)

Fetching account metadata, balances, details and transactions

// Get account id after completed authorization with a bank
const requisitionData = await client.requisition.getRequisitionById(requisitionId);
// Get account id from the list
const accountId = requisitionData.accounts[0];

// Instantiate account object
const account = client.account(accountId);

// Fetch account metadata
const metadata = await account.getMetadata();
// Fetch account balances
const balances = await account.getBalances();
// Fetch account details
const details = await account.getDetails();
// Fetch account transactions
const transactions = await account.getTransactions();
// Optional. You can filter transactions by specific date range
await account.getTransactions({dateFrom: "2021-12-01", dateTo: "2022-01-30"});

Premium endpoints

In order to access Premium API endpoints, please contact us at [email protected]

// country parameter can be omitted but when used you will get more precise results
const details = await account.getPremiumDetails('LV');
// date and country parameters are optional
const transactions = await account.getPremiumTransactions({
  dateFrom: '2021-12-01',
  dateTo: '2022-01-30',
  country: 'LV',
});

Support

For any inquiries please contact support at [email protected] or create an issue in repository.

nordigen-node's People

Contributors

victory-sokolov avatar antoineandrieu avatar dipo avatar dependabot[bot] avatar epicivo avatar seba-t avatar asamsig avatar daniellinna avatar desclapez avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.