Test TrueLayer

When you've set up and enabled TrueLayer in UAT, you can test your integration. You'll need to:

  • Set up a test company.
  • Generate a Link URL to the TrueLayer environment.
  • Connect to a bank account.

You can then retrieve and check data from the connected bank account.

Set up a test company and generate a Link URL

Before you start, decide the type of bank data source that you would like to test. The following instructions show you how to generate a Link URL for a demo bank account. You'll need to adapt these instructions if you choose to use an alternative banking data source.

Find the platform key of the data source you want to use.

  1. Log in to the Codat portal.
  2. Open the GET /integrations endpoint.
  3. Send your request to return a list integrations.
  4. Search for Demo Bank, or the alternative data source you're interested in. All banking integrations have a sourceType of Banking.
{
    "key": "demobank_truelayer",
    "logoUrl": "https://static.codat.io/public/platforms/demobank_truelayer.png",
    "name": "Demo Bank",
    "enabled": true,
    "sourceId": "22222222-7778-46cc-8544-952fe34a5e3a",
    "integrationId": "22222222-b2bf-4213-b594-1fb9474cbaf0",
    "sourceType": "Banking"
  }

Now, use these details to create a company with the Link URL you need for testing.

  1. Open the POST /companies endpoint.
  2. Enter a name for your test company and add the platform key for your chosen data source:
{
  "name": "companyname",
  "platformType": "demobank_truelayer"
}
  1. Send your request to create the test company, and the Link URL for that company.
    The response will look something like this:
{
  "id": "22222222-9b99-475f-b7e8-4f9a09b9289d",
  "name": "companyname",
  "platform": "TrueLayer Open Banking",
  "redirect": "https://link-uat.codat.io/link/start/22222222-9b99-475f-b7e8-4f9a09b9289d/00dbe10e-8f4a-43c2-935f-45d474576fb7",
  "status": "PendingAuth",
  "dataConnections": [
    {
      "id": "22222222-8f4a-43c2-935f-45d474576fb7",
      "integrationId": "22222222-b2bf-4213-b594-1fb9474cbaf0",
      "sourceId": "22222222-7778-46cc-8544-952fe34a5e3a",
      "platformName": "TrueLayer Open Banking",
      "linkUrl": "https://link-uat.codat.io/link/start/22222222-9b99-475f-b7e8-4f9a09b9289d/00dbe10e-8f4a-43c2-935f-45d474576fb7",
      "status": "PendingAuth",
      "created": "2020-06-24T11:13:27.6232806Z"
    }
  ],
  "created": "2020-06-24T11:13:25.8263019Z"
}

Copy the JSON, you'll need it for testing.

Connect to a bank account

📘

Bank account log in details

If you've chosen to connect to a bank data source other than Demo Bank, you'll need log in details for an account at that institution.

For testing only, you'll follow the process that your customers normally use to authorise a connection to their bank accounts.

  1. Copy the linkUrl value from the JSON you saved earlier into your browser. The link takes you to a TrueLayer landing page.
  2. Select ALLOW to link the Demo Bank account, or any other bank account type that you're testing.
    A login page is displayed.
  3. For Demo Bank, enter the test credentials shown on the login page. Otherwise, use your own login details.
    The account is linked automatically and you return to the Codat link site.

You're ready to start testing.

Check your banking data

You can check data from Demo Bank account in two ways.

To do a quick check from the Codat portal.

  1. Open the Codat portal and log in.
  2. In the left pane, select Companies, and search for the test company that you created.
  3. Select View Data next to the company name.
  4. On the company's Data page, select Bank Statements to see accounts and related transaction data.

To retrieve the same data from Codat's API, you need the JSON from step 6 of Set up a test company and generate a Link URL.

To retrieve account details.

  1. Open the GET /companies/{companyId}/connections/{connectionId}/data/bankAccounts endpoint.
  2. Replace {companyId} with the id of your test company, from the JSON you copied earlier.
  3. Replace {connectionId} with the id from dataConnections.
  4. Also add the number of pages that you want to return.
  5. Send your request to return a list of account details.
{
  "results": [
    {
      "id": "2cbf9b6063102763ccbe3ea62f1b3e72",
      "accountName": "CREDIT CARD 1",
      "currency": "GBP",
      "balance": 35,
      "availableBalance": 85,
      "modifiedDate": "2020-06-24T12:32:29.09Z",
      "sourceModifiedDate": "2020-06-24T12:31:41Z"
    },
    {
      "id": "328df3a40b828340fa4c3100e17de121",
      "accountName": "SAVINGS ACCOUNT 2",
      "sortCode": "01-21-31",
      "accountNumber": "40000000",
      "iBan": "CPBKGB00",
      "currency": "GBP",
      "balance": 100,
      "availableBalance": 470,
      "modifiedDate": "2020-06-24T12:32:29.09Z",
      "sourceModifiedDate": "2020-06-24T12:31:41Z"
    }
  1. The use the GET /companies/{companyId}/data/bankAccounts/{accountId}/transactions endpoint in the same way to retrieve the transactions for each account.

When you're ready, you can move to Codat's Production environment.


Did this page help you?