figo Node.js SDK is a package that contains a set of wrappers for figo Connect API and enables you to start creating applications in a Node.js environment immediately.
figo Connect API allows you easily access bank accounts including payments submitting and transaction history. Our main goal is to provide banking applications with rich user experience and seamless integration.
For more information please check our website.
To get started with figo Connect you have to register your application first. Request your personal credentials using our online application form or just email us and we will be more than happy to provide you with a client ID and a secret without any bureaucracy.
The latest version of this SDK can be found in GitHub repository.
Detailed API reference is available online on our website.
To install the SDK via npm use following command:
npm install figo@latest
Just clone our repository with your preferred method. For example:
git clone git://github.com/figo-connect/node-figo.git
Make a connection:
var figo = require('figo');
// Demo client
var client_id = 'CaESKmC8MAhNpDe5rvmWnSkRE_7pkkVIIgMwclgzGcQY'; // Demo client ID
var client_secret = 'STdzfv0GXtEj_bwYn7AgCVszN1kKq5BdgEIKOM_fzybQ'; // Demo client secret
var connection = new figo.Connection(client_id, client_secret);
where client_id
and client_secret
are your application's credentials obtained from figo.
And create the first figo user:
// User personal data
var name = 'John Doe';
var email = 'john.doe@example.com';
var password = 'Swordfish';
var language = 'en';
connection.create_user(name, email, password, language, null, function(error, recovery_password) {
if (error) {
console.error(error);
} else {
console.log(recovery_password);
}
});
From the figo Connect API reference:
“In order to access any information belonging to a user, a client has to authenticate with a token linking itself to the user. This token is called an access token and contains information on the client, the user and the level of access the client has to the users data.”
Log in to obtain such access token:
var access_token = '';
connection.credential_login(username, password, null, null, null, null, function(error, token) {
if (error) {
console.error(error);
} else {
access_token = token.access_token;
}
});
Once you have an access token you can perform the rest of operations with the API.
But first create a session using the access token from the previous step:
var session = new figo.Session(access_token);
To get all the bank accounts user has chosen to share with your application use get_accounts
function:
session.get_accounts(function(error, accounts) {
if (error) {
console.error(error);
} else {
accounts.forEach(function(account) {
// Do whatever you want
console.log(account.account_number);
console.log(account.balance.balance);
});
}
});
session.get_transactions(null, function(error, transactions) {
if (error) {
console.error(error);
} else {
transactions.forEach(function(transaction) {
// Do whatever you want
console.log(transaction.name);
});
}
});
session.get_standing_orders(false, function(error, standingOrders) {
if (error) {
console.error(error);
} else {
standingOrders.forEach(function(standingOrder) {
// Do whatever you want
console.log(standingOrder.standing_order_id, standingOrder.purpose, standingOrder.amount);
});
}
});
session.get_securities(null, function(error, securities) {
if (error) {
console.error(error);
} else {
securities.forEach(function(security) {
// Do whatever you want
console.log(security.security_id, security.amount, security.currency);
});
}
});
// Retrieve all available payments
session.get_payments(null, function(error, payments) {
if (error) {
console.error(error);
} else {
payments.forEach(function(payment) {
console.log(payment.payment_id, payment.amount, payment.currency, payment.purpose);
})
}
});
figo Connect API allows you not only to get an information related to bank accounts, but also to submit wire transfers on behalf of the account owner which is a two-step process:
- First, you have to compile a payment object and submit it to the figo Connect API.
- Second, you need to submit the newly created payment to the bank itself via the figo Connect API. Although any interaction with the API is done live, customer bank's servers might take some time to reply. In order to handle this figo Connect API will create a background task and will return a task token to your application on step two. Using this task token you can later poll the result of the task execution.
Make sure you have all the necessary dependencies:
npm install
You need to set the following environment variables:
FIGO_CLIENT_ID
FIGO_CLIENT_SECRET
FIGO_API_ENDPOINT
(optional, defaults tohttps://staging.figo.me/v3
)
npm test
figo Node.js SDK is released under the MIT License.
- rolled back to Winston 2.4.4 for compatibility
- updated dependencies to current stable versions
- Dropped support for node.js 4.0
- removed cert-pinning to support new figo infrastructure
- Use SHA-256 to validate certificate fingerprint (
5496e58
) - Node.js versions 0.10 and older are no longer supported (
afeb565
)
- Create a
.stack
property onFigoError
object: figo-connect#27
- Minor feature
- Minor bugfix
- Code beautified
- Minor bugfix
- Minor bugfix
- Certificate fingerprint update
- Errors are now instances of JavaScript standard built-in
Error
object
-
Added wrappers for the following API calls
- Authentication: Credential Login, Unlock a figo account;
- User Management: Start forgot password process, Re-send unlock code, Re-send verification email;
- Accounts: Set bank account sort order;
- Account setup & synchronization: Retrieve list of supported banks, credit cards, other payment services, Retrieve list of supported credit cards and other payment services, Retrieve list of all supported banks, Retrieve login settings for a bank or service, Setup new bank account;
- Transactions: Modify a transaction, Modify all transactions of one or all accounts, Delete a transaction;
- Standing Orders: Retrieve standing_orders of one or all accounts;
- Securities: Retrieve a security, Retrieve securities of one or all accounts, Modify a security, Modify all securities of one or all;
- Payments: Retrieve payment proposals;
- Task Processing: Begin task, Poll task state, Cancel a task;
- Business Process System: Begin process, Create a process;
-
Minor fixes
Previous release which was done before starting to maintain the above changelog.
Please submit bug reports and your suggestions to the GitHub issue tracker. Feel free to add pull requests as well.