How to build an invoicing app

How to support invoicing functionality with unified APIs

In this guide, you'll learn how to quickly build an invoicing app that you're proud of with the help of Unified.to's unified accounting API. When building invoicing into your product, you'll need to exchange data with multiple accounting systems, particularly the accounting systems your customers are already using. Unified.to speeds up development by enabling you to build once to deploy multiple accounting integrations simultaneously.

Prerequisites

If you're planning on trying out Unified.to, go ahead to create a free account now and check out this handy guide that walks you through our onboarding. It will also help you activate accounting integrations in your Unified.to tester account.

The next step is to deploy the Unified.to Embedded Authorization widget in your product's user interface (UI). Check out our embedded authorization video tutorial to learn more.

Overview

Here are the steps that you will need to support to build your invoicing app:

  1. create an invoice

  2. pay an invoice or cancel an invoice

Let's go into more detail for each.

Step 1: Create an invoice

To generate an invoice, gather specific details from your end user, including essential information like the amount, line items/products, due date, and customer details.

Unified.to can help with two of those values: customer and product.

Customers

To get a list of existing customers from your end user's accounting system, simply call the listCustomers API endpoint.

import Unified from 'unified-ts-client';
import { IAccountingCustomer } from 'unified-ts-client/lib/src/accounting/types/UnifiedAccounting';

const unifiedClient = new Unified ({ api_token: process.env.UNIFIED_TOKEN });

export async function getCustomers(connection_id: string) {
    return await unifiedClient.accounting(connection_id).customer.getAll();
}

The connection_id comes in from your end user's authorization of their accounting app and is stored on your end.

If you need to create a new customer, use our createCustomer API endpoint.

A Customer will have specific fields such as name , emails, billing_address, and tax information that will be relevant to your software.

Products

Much like getting a list of existing customers, it is easy to get a list of existing products in your end user's accounting app using the listItems API endpoint. We call a product, an Item, and you can find the full data model in our API docs.

import Unified from 'unified-ts-client';
import { IAccountingItem } from 'unified-ts-client/lib/src/accounting/types/UnifiedAccounting';

const unifiedClient = new Unified ({ api_token: process.env.UNIFIED_TOKEN });

export async function getItems(connection_id: string) {
    return await unifiedClient.accounting(connection_id).item.getAll();
}

Chart of accounts & tax rates

Each line item in an invoice will be associated with a customer, item, account and tax rate in your end user's accounting application.

You can get a list of accounts by calling our listAccounts API endpoint which returns a list from their "Chart of Accounts".

You can also get a list of tax rates by calling our listTaxrates API endpoint.

Invoices

Once the end user has created an invoice, you will want to send that invoice into their accounting system as well.

import Unified from 'unified-ts-client';
import { IAcocuntingInvoice } from 'unified-ts-client/lib/src/accounting/types/UnifiedAccounting';

const unifiedClient = new Unified ({ api_token: process.env.UNIFIED_TOKEN });

export async function createInvoice(connection_id: string, invoice: IAccountingInvoice) {
    const result = await unifiedClient.accounting(connection_id).invoice.createInvoice(invoice);
    return result?.id;
}

This is easily accomplished by using the createInvoice API endpoint.

Step 2: Paying invoices

Once that invoice is paid, you will need to communicate this to the accounting application. This is accomplished by using the createPayment API endpoint which associates a payment with an invoice.

At a minimum, a Payment will need an invoice_id , a customer_id and an amount. Some integrations may require additional values to be present, so review the integration's feature support page in your Unified.to account. For example, Quickbooks also requires a currency field.

Conclusion

It's easy to support multiple accounting systems in your invoicing app and allow your end user to seamlessly move data between the two. By using Unified.to unified accounting API, you can add accounting integrations to your product and support an invoicing use case for your customers in a matter of days.

What is Unified.to?

Unified.to makes shipping the integrations your customers need easy. We’ve transformed a complex development process into an afternoon project. With our unified APIs, software teams can launch integrations in hours, connecting your SaaS to your customers’ critical recruitment, selling, and workforce data so you can build better products and solve bigger challenges for your users.

Create a free tester account