This is a staging build of the docs. Do not share the link externally.
Skip to main content

Bank Feeds API for bank transaction reconciliation in QBO

Example-based tutorial on reconciling bank transactions with QuickBooks Online using Codat's Bank Feeds API

Integrations and languages

This tutorial focuses on reconciling bank feeds with QuickBooks Online (QBO), and uses our Bank Feeds client library. The Bank Feeds library is available in C#, TypeScript, Python and Go.

Summary

🎯 Our QuickBooks Online Bank Feeds integration makes it possible for your customers to connect bank accounts from your application to QBO. See how you can support your users by syncing their bank transaction data to QBO Bank Feeds, ensuring the records match each other.

⏳ Estimated time to review: 10-15 minutes

Why reconcile bank transactions

Traditionally, bank reconciliation is done by comparing a bank statement to the ledger entries. However, outdated methods like manual data processing and screen scraping no longer satisfy SMBs' demand for efficient, effortless processes.

Help your SMB customers sync their bank statements digitally to their accounting software and automatically reconcile transactions, therefore removing manual effort, reducing potential for errors, and facilitating transaction matching.

This saves your customers time and gives them the context they need to properly analyze and optimize their spend.

Solution overview

We have done the heavy lifting for you by building bank feeds integrations with a standardized data model to the accounting platforms your customers already use. This gives you access to real-time data that you can fetch, create, or update to support your customers. In this tutorial, we focus on our QuickBooks Online Bank Feeds integration.

Prerequisites
  1. Make sure you have enabled the QuickBooks Online Bank Feeds integration. You can do that in the Codat Portal, or read more for detailed instructions.

  2. Intuit must have approved your company to appear in the QuickBooks Online bank selection screen. Submit a request to Codat so that we can organize this with Intuit on your behalf.

We also expect that your application has a UI that your SMB users interact with.

Preparation

Use our SDKs to easily implement the bank feeds solution in your app. We strongly recommend utilizing our SDKs to make your build simple to implement and easy to maintain.

First, install the client library:

    dotnet add package Codat.BankFeeds

Next, import the package and add your Base64 encoded API key within an authorization header. You can copy your authorization header in the Developers section of the Codat Portal. In our example, we chose to call the client library bank_feeds_client.

using Codat.BankFeeds;
using CodatPlatform.Models.Shared;

var bankFeedsClient = new CodatBankFeedsSDK(
security: new Security() {
AuthHeader = "Basic BASE_64_ENCODED(API_KEY)",
}
);

Bank feeds process flow

Solution walkthrough

Provide your users with a link or a button in your app so they can trigger the connection of their bank accounts to QBO Bank Feeds. Use an appropriate call-to-action, such as Connect account to QuickBooks.

When an SMB user clicks the button or link you added, initiate the process described below to create a Codat company with a QBO Bank Feeds connection and provide opportunity to authorize that connection.

Create a company with a QBO Bank Feeds connection

Use our Create company endpoint to trigger company creation, which will represent your SMB customer in Codat. In response, you will receive a company Id, which is required by subsequent endpoints.

var companyCreatedRes = await bankFeedsClient.Companies.CreateAsync(new CompanyRequestBody() {
Name = "Elaborate Events, Inc",
});

if(companyCreatedRes.Company != null) {
var company = companyCreatedRes.Company;
logger.LogInformation('{CompanyId} {CompanyName}', company.Id, company.Name);
}

Next, call the Create connection endpoint to establish a data link to QBO Bank Feeds for the company. We pass the response from the previous endpoint in the request, and also include the platform key, which for QBO Bank Feeds is hcws.

var connectionCreatedRes = await bankFeedsClient.Connections.CreateAsync(new CreateConnectionRequest() {
RequestBody = new CreateConnectionRequestBody() {
PlatformKey = "hcws", // Codat's platform key for QBO Bank Feeds
},
CompanyId = companyCreatedRes.Company.Id,
});

Create bank feeds bank accounts

Now, use the Create source account endpoint to add your SMB's source bank accounts to Codat. These are the accounts the SMB user will be able to connect to QBO Bank Feeds. In the response, you will receive the source account created in the connected platform.

var accountCreatedRes = await bankFeedsClient.SourceAccounts.CreateAsync(new CreateSourceAccountRequest() {
SourceAccount = new SourceAccount() {
AccountName = "Account 002",
AccountNumber = "12345670",
AccountType = "Debit",
Balance = 6531.4,
Currency = "GBP",
SortCode = "123456",
},
CompanyId = companyCreatedRes.Company.Id,
ConnectionId = connectionCreatedRes.Connection.Id,
});

Authorize the connection

Finally, use our Generate source account credentials endpoint to authorize the previously created data connection. Embed the call to this endpoint in the UI flow the user triggered when choosing to link their bank accounts.

In response, you will receive login credentials that your user needs to enter in QBO Banking to link a bank account. Share them with the user, and consider providing instructions on steps to take in QBO. For example, this is how we manage it in our QBO Link flow:

var credentialsRes = await bankFeedsClient.SourceAccounts.GenerateCredentialsAsync(new GenerateCredentialsRequest() {
CompanyId = companyCreatedRes.Company.Id,
ConnectionId = connectionCreatedRes.Connection.Id,
});

var companyCredentials = credentialsRes.BankAccountCredentials;
logger.LogInformation("{Username} {Password}", companyCredentials.Username, companyCredentials.Password);

When completing the authorization in QBO Banking, your user chooses the bank accounts they want to connect. At the same time, they also choose a feed_start_date value that is then used to limit the load of historic transactions to seven days.

Once this is complete, you can sync transactions between the bank and Codat. QBO will then poll Codat periodically to pull these transactions to their bank feed.

Sync bank feeds bank transactions

Bank transactions guidelines
  • You can push historic (back-dated) transactions that are up to seven days old based on the feed_start_date, as chosen by the SMB user in the QBO UI.
  • Syncing future-dated transactions to QBO is not supported.
  • You can only sync bank transactions from one connected account at a time.
  • Bank transactions must be synced in chronological order (from earliest to latest) based on the cleared_on_date.
  • Bank transactions can't be older than the most recent transaction available on the destination bank account.
  • Up to 1000 bank transactions can be synced at a time.

Use the Create bank transactions endpoint to post your SMB user's bank transactions to Codat.

Because of the way bank transactions work, we recommend you post seven days of transactions on the initial sync. For subsequent syncs, we recommend you post daily transaction data.

var res = await bankFeedsClient.Transactions.CreateAsync(new CreateBankTransactionsRequest() {
CreateBankTransactions = new CreateBankTransactions() {
AccountId = accountCreatedRes.Account.Id,
Transactions = new List<CreateBankTransaction>() {
new CreateBankTransaction() {
Amount=2088.76M,
Date="2022-10-23T00:00:00.000Z",
Description="HSBC Covent Grdn ATM W",
Id = "fa946773-9251-4aa5-ac3f-5ad019da1ffe",
},
new CreateBankTransaction() {
Amount=4686.51M,
Date="2022-10-23T00:00:00.000Z",
Description="Forbes subscription",
Id = "097b0074-f154-471b-9e6e-13b99d488e1e",
},
new CreateBankTransaction() {
Amount=5759.47M,
Date="2022-10-23T00:00:00.000Z",
Description="Wholesale Balloons, Ltd",
Id = "450ad2ab-d442-4698-82d5-02a94bb4f63c",
},
},
},
AccountId = accountCreatedRes.Account.Id,
CompanyId = companyCreatedRes.Company.Id,
ConnectionId = connectionCreatedRes.Connection.Id,
});


Repeat the request for the remainder of the SMB user's source bank accounts. Keep the bank transactions in Codat up to date, as QBO polls Codat periodically to pull these transactions to their bank feeds.

Recap

That's it - you have followed Codat's bank transactions reconciliation process flow and understood how to implement it in code. You can now use this tutorial as a basis for your application.



Was this page useful?
❤️
👍
🤔
👎
😭