My bank has an API so I built online banking

I recently attended Mondo’s second Hackathon, and it was incredibly insightful. My first hackathon, and moreover, my first time working with a RESTful API.

For the last 10 days I’ve been Alpha testing Mondo with their bright pink prepaid MasterCard, and it’s been an incredible experience. Speedy purchase notifications, geotagged transactions and automatic categorisation have really shown up the standard UK banking industry.

Last night I thought I’d have another play around with the Mondo API. I had already used the API at the hackathon 10 days ago, however the novelty of seeing banking transactions pop up in Postman had been renewed by the fact that this was my data, my real transactions.

Image for post
Image for post

I wanted to create my own web client on Mondo’s API, so I could check my balance, today’s spend, and a list of transactions from my computer. I went for raw Bootstrap for speedy front-end design, and did the backend work in PHP, with standard PHP sessions. I envisioned the following flow:

  1. Login

Authentication

Image for post
Image for post

Currently, Access Tokens expire after 6 hours, so I hacked together the following function:

function tokenExpired($accesstoken) {
// GET accounts
$crl = curl_init();

$headr = array(
‘Content-type: application/json’,
‘Authorization: Bearer ‘.$accesstoken
);

curl_setopt($crl, CURLOPT_URL, “https://production-api.gmon.io/accounts");
curl_setopt($crl, CURLOPT_HTTPHEADER, $headr);
curl_setopt($crl, CURLOPT_RETURNTRANSFER, TRUE);
$rest = curl_exec($crl);

curl_close($crl);

$json = json_decode($rest, true);

if(empty($json[‘accounts’][0][‘account_number’])) {
return true;
}
else {
return false;
}
}

Mondo’s infrastructure will support multi accounts under the same login credentials in the future, but for now I could just check the response returned an account_number for the first account, which isn’t returned if the access token has expired. A pretty gross but quick way of whipping this up.

Main View

Transactions I had display in a boring, regular table. I also mimicked the way Mondo show their Balance and Spend Today counter in their iOS app.

Image for post
Image for post
The finished product
Image for post
Image for post

I’m in the process of adding some cool looking charts at the moment, so the user can visualise their expenditure sorted by category, sort of like this maybe.

All I have left to say is I’m looking forward to Mondo’s full release, where we’ll all be able to see the full potential of API banking.

James

Title courtesy of @jonas :)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store