Skip to main content

Configure customer in Codat

Create a company and its connection that form the structure required to execute the bill pay process

Overview

When implementing your Sync for Payables solution, you need to create your SMB customer as a company in Codat before registering their accounting software as a connection. You can do that when the customer starts interacting with your application.

We have highlighted this sequence of steps in our detailed process diagram below.

Detailed process diagram
Authorize your API calls

Remember to authenticate when making calls to our API. Navigate to Developers > API keys in the Portal to pick up your authorization header.

Create a company

Within Sync for Payables, a company represents your SMB customer that pays and manages their bills using your application. To create it, use our Create company endpoint. It returns the company schema containing the ID that you will use to establish a connection to an accounting software.

const companyResponse = payablesClient.companies.create({
name: companyName,
});

if(companyResponse.statusCode == 200){
throw new Error("Could not create company")
}

const companyId = companyResponse.company.id
console.log(companyId)

Create a connection

Next, use the Create connection endpoint to connect the company to an accounting data source via one of our integrations. This will allow you to synchronize data with that source, fetching or creating suppliers, bills, and payment methods.

In the request body, specify a platformKey of the accounting software you're looking to connect.

Accounting softwareplatformKey
MYOB Businesspdvj
Oracle NetSuiteakxx
QuickBooks Onlineqhyg
QuickBooks Desktoppqsw
Sage Intacctknfz
Xerogbol

As an example, let's create a QuickBooks Online (QBO) connection. In response, the endpoint returns a dataConnection object with a PendingAuth status and a linkUrl. Direct your customer to the linkUrl to initiate our Link auth flow and enable them to authorize this connection.

const connectionResponse = payablesClient.connections.create({
requestBody: {
platformKey: "qhyg",
},
companyId: companyResponse.company.id,
});

console.log(connectionResponse.connection.linkUrl)

Deauthorize a connection

If your customer wants to revoke their approval and sever the connection to their accounting software, use the Unlink connection endpoint.

You can learn more about connection management best practices and see how you can provide this functionality in your app's UI.

const unlinkResponse = payablesClient.connections.unlink({
requestBody: {
status: DataConnectionStatus.Unlinked
},
companyId: companyResponse.company.id,
connectionId: connectionResponse.connection.id,
});
Recap

You have created the structure of key objects required by Codat's Sync for Payables: a company and its connection to an accounting data source.

Next, you can choose to manage your customer's suppliers, bills or payment methods prior to paying the bills.



Was this page useful?
👏
👍
🤔
👎
😭