Control your money programmatically, build your own features, and securely integrate with other services. Fetch
transactions, view balances, make payments, or update beneficiaries - all wrapped behind an easy to use REST
API.
No XML, we promise.
PAYMENTS
TRANSACTIONS
CARDS
CONTACTS
// Require the Root library and initiate with a test key
const root = require('root-banking')('test_key_tYILz1640w9q5n5kNQUZ');
// Fetch all the bank transactions for your account
const transactions = root.transactions.all();
// Require the Root library and initiate with a test key
const root = require('root-banking')('test_key_tYILz1640w9q5n5kNQUZ');
// Create and send the transfer
const transaction = await root.eft({
amount: 250 * 100, // cents
description: 'Apartment Rent',
theirReference: 'Sam Harper',
contactName: 'Rent - Lee',
bankName: 'ABSA',
bankNumber: '1337098765',
saveContact: false
});
// Require the Root library and initiate with a test key
const root = require('root-banking')('test_key_tYILz1640w9q5n5kNQUZ');
// Create a new virtual card
const card = await root.cards.createVirtualCard('Food Delivery', '31337');
// Set card limits
await root.cards.update(card.cardId, {
dailyLimit: 500 * 100, // cents
monthlyLimit: 2000 * 100
});
// Lock the card
await root.cards.lockCard(card.cardId)
// Require the Root library and initiate with a test key
const root = require('root-banking')('test_key_tYILz1640w9q5n5kNQUZ');
// Create a beneficiary contact
const contact = root.contacts.create({
name: 'Sam Harper',
bankNumber: '719038123',
bankName: 'Standard Bank SA',
email: 'sam@example.com'
});
Programmable Cards
Your Root account comes with a programmable Mastercard
® - and many more virtual ones.
These work at any shop that accepts Mastercard. Take full control of your online payments by creating
a unique card number for every shop - all available through the API.
Introducing RootCode
Build your own rules and limits using RootCode - securely hosted Javascript cloud functions that execute during
your card transactions. Limit your fast-food spend, track your coffee intake on the fly, or send money to
your favourite charity on every swipe - anything goes.
// This runs before checking the balance
function beforeTransaction(transaction) {
const fastFoodCategory = 'Fast Food Restaurants';
const limit = 1000; // R1k
if (transaction.merchant.category !== fastFoodCategory)
return true; // Approve transaction
// Fetch and filter all transactions
const transactions = root.transactions.all()
.filter(tx => tx.method === 'card')
.filter(tx => isThisMonth(tx.created_at))
.filter(tx => tx.merchant.category === fastFoodCategory);
// Sum spending
let totalFastFoodSpend = transactions
.reduce((sum, tx) => sum + tx.amount, 0);
totalFastFoodSpend += transaction.amount;
// Approve (true) if within limit
return Math.abs(totalFastFoodSpend) < limit * 100;
}
// This runs before checking the balance
function beforeTransaction(transaction) {
const merchant = transaction.merchant.name.toLowerCase();
const allowedMerchants = ['takealot', 'orderin'];
return allowedMerchants.indexOf(merchant) >= 0;
}
// This runs after a successful transaction
function afterTransaction(transaction) {
// Lock the card after it's been used
root.cards.lockCard(transaction.card_id);
}
// This runs after a successful transaction
function afterTransaction(transaction) {
// Fetch and filter transactions for this month
const transactions = root.transactions.all()
.filter(tx => tx.method === 'card')
.filter(tx => isThisMonth(tx.created_at));
const groceries = filterAndSum(transactions, 'Grocery Stores');
const restaurants = filterAndSum(transactions, 'Restaurants');
const books = filterAndSum(transactions, 'Book Stores');
const message =
`> Groceries: R${groceries}\n` +
`> Restaurants: R${restaurants}\n` +
`> Books: R${books}`;
root.sendPush('Week Summary', message);
}
LIMIT SPENDING ON PRODUCTS, LIKE FAST FOOD
Control at which merchants or what categories your card can be used, and code custom limits.
CREATE ONCE OFF VIRTUAL CARDS
Tap into your Root account’s APIs from within RootCode, updating limits or locking the card.
SETUP CUSTOM BUDGETING & NOTIFICATIONS
Send push notifications, SMS or emails straight from your card, creating full custom experiences.
See what other developers are doing with RootCode
I’ve used RootCode to run a script every time I buy a cup of coffee with my Root card. It matches the amount I spend at any
coffee shop and automatically donates it to my local animal welfare by sending off an EFT.
I’ve enhanced my card notifications to include the amount I’m spending per day on certain things, such as coffee or meals.
I now know when I’m overspending.
I also tried to make the push notifications a bit quirky, so that I actually read and take note
of them.
Instead of constantly having to check cryptocurrency exchanges, I’ve added the current market price of various cryptos to
the notification I get when I swipe my Root card.
Next I want to round up my transactions to the nearest note with the excess transferred to my
Luno wallet.
WHAT’S NEW
Blog
Get more information on what we’re currently working on, what the community is building or simply get access to how-to guides
for your Root account.