Using PSD2 APIs with Temenos

by Chris Harrold in Guides July 18, 2019

PSD2 APIs represent a set of guidelines that offer a way for banks to standardize communications. The specification includes a lot of information including process and functionality recommendations and guidance. One key part of this guidance is a specification for producing and consuming APIs that can be used to support PSD2 processes. This set of guidelines allows providers (like Temenos) and consumers (anyone who wants to connect to our application) a standard definition of the data that is sent and received between the consumer and provider.

You can read our PSD2 API Spec in the API Catalog , but this brief guide will help you get a basic understanding of where PSD2 APIs can be useful and how to explore the responses for application to more complex use cases.

The code below is written in Python and uses a simple API call to return all the information provided by the PSD2 accounts API. This is one of the PSD2 APIs that Temenos publishes to match the open banking PSD2 guidelines. Getting the account information of a consumer is generally one of the first steps in any transactional process under the PSD2 specification.

import requests
import json
account_number = input("Enter the account number to request:")
url = 'https://api.temenos.com/api/v1.0.0/holdings/PSD2/accounts/' + account_number
headers = {'Accept': 'application/json', 'apikey': '3PpeR3ij1nRw3k9cZOXya4H7NV0oUQWX'}
response = requests.get(url, headers=headers)
jData = json.loads(response.content)
if '404' in str(jData):
    print(jData) 
else:
    print(json.dumps(jData, sort_keys=True, indent=4, separators=(',', ': ')))

If you execute this code against the Temenos sandbox for example (or your own Transact instance) you would get something similar to the below:

Chriss-MBP-3:Pi-Projects charrold303$ python3 tcf_apicall_hold.py 
Enter the account number to request:10995
{
    "body": [
        {
            "BIC": "DEMOGBPX",
            "accountIBAN": "GB61DEMO60161300010995",
            "accountId": "10995",
            "accountStatus": "Active",
            "availableBalance": 13589692.01,
            "currency": "USD",
            "displayName": "COCA-COLA",
            "ledgerBalance": 13591299.78,
            "productId": "Current Account"
        }
    ],
    "header": {
        "audit": {
            "T24_time": 194,
            "parse_time": 0
        },
        "page_size": 99,
        "page_start": 1,
        "page_token": "201904170438656340.01,99",
        "total_size": 1
    }
}

The advantage of the sandbox functionality in this case is that you can see quickly and easily the data contained in the PSD2 API specification from Temenos Transact. Once you know what data will come back, you can start to build logic to handle the returned data. For example, I have manually entered the account number in this code example, but I could add the ability to collect it from the user via a web form. Also once the account is verified to exist and to have sufficient funds, you could render that information in your application or web page or use it to start a payment process.

You may also find that you need additional information beyond what PSD2 provides. This is why we also have a deeper and richer set of API data available via our provider APIs. Unlike the PSD2 specification, these APIs can return as much data as needed to provide more functionality to your app. In order to access and test these APIs you would need a BUILD membership with the developer community, but signing up for one takes just a couple of seconds.