Accounting

This guide is intended for developers building an integration between Float and an external accounting system. You’ll learn about the relevant endpoints and important Float interactions to consider.

What You Can Build

Float offers a REST API to power real-time syncing between Float and your accounting platform. With this API you can:

  • Pull Float transactions daily into your accounting system (or weekly, monthly, etc)
  • Reconcile expenses with receipts and coding
  • Maintain your chart of accounts in Float automatically

Relevant Endpoints

EndpointUse
GL CodesManage GLs for coding card transactions, bills, and reimbursements.
Custom FieldsManage Custom Fields for coding card transactions, bills, and reimbursements.
VendorsManage Vendors for coding card transactions, bills, and reimbursements.
Tax CodesManage Tax Codes for coding card transactions, bills, and reimbursements.
Card TransactionsPull metadata and coding for card transactions.
Account TransactionsPull metadata for all account transactions such as funding or cashback.
BillsPull metadata and coding for Bill Pay.
ReimbursementsPull metadata and coding for Reimbursements.
PaymentsPull payments associated with Bills or Reimbursements.

Float and Accounting Integrations

This guide is written assuming the Float account is not connected to an Accounting Integration, ie Netsuite, QBO, or Xero. If the Float account is connected, be mindful of the following:

  1. Float’s integrations automatically sync GLs, vendors, custom fields, and tax codes from the accounting system.
  2. Card transactions are exported to accounting systems by Float users in the web app.
  3. Reimbursements are exported to accounting systems by Float users in the web app. As the payment is completed in Float, the reimbursement will be updated to paid in the accounting system.
  4. Bills are automatically synced to QBO or Xero when they are approved in the Float app as Unpaid bills. As the payment is completed in Float, the bill will be updated to paid in the accounting system.

Building an Accounting Integration

To build an integration between Float and an accounting system, you must build the following 3 processes:

  1. Accounting Object Sync
  2. Card Transaction Sync
  3. Reconciliation Sync

1) Accounting Object Sync

There are 4 types of accounting objects to create and maintain within Float. These are used to categorize card transactions, bills, and reimbursements in Float. The relevant endpoints are listed below.

EndpointUse
GL CodesManage GLs for coding card transactions, bills, and reimbursements.
Custom FieldsManage Custom Fields for coding card transactions, bills, and reimbursements.
VendorsManage Vendors for coding card transactions, bills, and reimbursements.
Tax CodesManage Tax Codes for coding card transactions, bills, and reimbursements.

Create Accounting Objects

How to create a GL code:

let float_api_token = "XXXXXX"

let new_gl_code = {
    external_id: "12345",
    account_type: "EXPENSE",
    name: "My New GL Code"
}

let request_body = {
    items: [ new_gl_code ],
    notification_preferences: [
        { url: "https://example.com/gl-code-create-webhook" }
    ]
}

let gl_code_create_result = await fetch(
    "https://api.floatfinancial.com/v1/gl-codes/",
    {
        method: "POST",
        headers: {
            "accept": "application/json",
            "content-type": "application/json",
            "authorization": "Bearer " + float_api_token
        },
        body: JSON.stringify(request_body)
    }
)

if (202 == gl_code_create_result.status) {
    console.log("Success!")
} else {
    console.log("Failure!")
    console.log(gl_code_create_result)
}

How to create a vendor:

let float_api_token = "XXXXXX"

let new_vendor = {
    name: "My New Vendor"
}

let request_body = {
    items: [ new_vendor ],
    notification_preferences: [
        { url: "https://example.com/vendor-create-webhook" }
    ]
}

let vendor_create_result = await fetch(
    "https://api.floatfinancial.com/v1/vendors/",
    {
        method: "POST",
        headers: {
            "accept": "application/json",
            "content-type": "application/json",
            "authorization": "Bearer " + float_api_token
        },
        body: JSON.stringify(request_body)
    }
)

if (202 == vendor_create_result.status) {
    console.log("Success!")
} else {
    console.log("Failure!")
    console.log(vendor_create_result)
}

How to create a tax code (with components):

let float_api_token = "XXXXXX"

let new_tax_code = {
    name: "HST - Ontario",
    components: [
        {
            name: "Federal",
            rate: "0.10"
        },
        {
            name: "Provincial",
            rate: "0.03"
        }
    ]
}

let request_body = {
    items: [ new_tax_code ],
    notification_preferences: [
        { url: "https://example.com/tax-code-create-webhook" }
    ]
}

let tax_code_create_result = await fetch(
    "https://api.floatfinancial.com/v1/tax-codes/",
    {
        method: "POST",
        headers: {
            "accept": "application/json",
            "content-type": "application/json",
            "authorization": "Bearer " + float_api_token
        },
        body: JSON.stringify(request_body)
    }
)

if (202 == tax_code_create_result.status) {
    console.log("Success!")
} else {
    console.log("Failure!")
    console.log(tax_code_create_result)
}

How to create a custom field:

let float_api_token = "XXXXXX"

let new_custom_field = {
    name: "My Custom Field",
    type: "string"
}

let request_body = {
    items: [ new_custom_field ],
    notification_preferences: [
        { url: "https://example.com/custom-field-create-webhook" }
    ]
}

let custom_field_create_result = await fetch(
    "https://api.floatfinancial.com/v1/custom-fields/",
    {
        method: "POST",
        headers: {
            "accept": "application/json",
            "content-type": "application/json",
            "authorization": "Bearer " + float_api_token
        },
        body: JSON.stringify(request_body)
    }
)

if (202 == custom_field_create_result.status) {
    console.log("Success!")
} else {
    console.log("Failure!")
    console.log(custom_field_result)
}

2. Card Transaction Sync

Card transactions are categorized by Spenders in the Float app, then reviewed by Bookkeepers and Admins. Bookkeepers and Admins also move transactions through the accounting stages on the Transaction Export page (seen below).

We recommend (a) pulling transactions and (b) setting the accounting stage to “EXPORTED” when they are successfully imported to the accounting system.

EndpointUse
Card TransactionsPull metadata and coding for card transactions.
Update transaction accounting stageManage accounting stage of the transaction.

a. Pull Transactions

let float_api_token = "XXXXXX"

let created_at__lte = new Date()
let created_at__gte = new Date(created_at__lte)
created_at__gte.setMonth(created_at__lte.getMonth() - 1)

for (let page_num = 1; true; page_num++) {
    let query_parameters =
        "?page=" + page_num +
        "&created_at__lte=" + created_at__lte.getTime() +
        "&created_at__gte=" + created_at__gte.getTime()
    let card_transactions_response = await fetch(
        "https://api.floatfinancial.com/v1/card-transactions/" + query_parameters,
        {
            method: "GET",
            headers: {
                "accept": "application/json",
                "authorization": "Bearer " + float_api_token
            }
        }
    )

    if (200 == card_transactions_response.status) {
        let page = await card_transactions_response.json()
        for (const card_transaction of page.items) {
            console.log(card_transaction)
        }
        if (page.pages <= page_num) {
            break
        }
    } else {
        console.log("Failure!")
        console.log(card_transactions_response)
        break
    }
}

b. Manage accounting state

Setting the accounting stage of a transaction via API will move the transaction to the corresponding stage on the Transaction Export page:

Accounting_stageTransaction Export Tab
IN_REVIEWConfirm
READY_TO_EXPORTReady to Export
EXPORTEDExport History
let float_api_token = "XXXXXX"

let request_body = {
    ids: [
        "146de36a-1d16-42ee-b0ac-2239d45b393a",
        "e4c7bb26-3bc6-4bfe-8bb9-26bf45cc6d17",
        "f103ddc9-4a5f-47e1-8750-5533040cffbd"
    ],
    data: {
        accounting_stage: "EXPORTED"
    }
}

let card_transactions_response = await fetch(
    "http://api.floatfinancial.com/v1/card-transactions/",
    {
        method: "PATCH",
        headers: {
            "accept": "application/json",
            "content-type": "application/json",
            "authorization": "Bearer " + float_api_token
        },
        body: JSON.stringify(request_body)
    }
)

if (200 == card_transactions_response.status) {
    console.log("Success!")
} else {
    console.log("Failure!")
    console.log(card_transactions_response)
}

3. Reconciliation

In order to complete reconciliation with Float, you’ll need to pull account level transactions such as cash back and funding payments to your Float account. We recommend using the Account Transactions endpoint to get these transactions.

How to pull account transactions:

let float_api_token = "XXXXXX"

let created_at__lte = Date.now()

for (let page_num = 1; true; page_num++) {
    let query_parameters = "?page=" + page_num + "&created_at__lte=" + created_at__lte
    let account_transactions_response = await fetch(
        "https://api.floatfinancial.com/v1/account-transactions/" + query_parameters,
        {
            method: "GET",
            headers: {
                "accept": "application/json",
                "authorization": "Bearer " + float_api_token
            }
        }
    )

    if (200 == account_transactions_response.status) {
        let page = await account_transactions_response.json()
        for (const account_transaction of page.items) {
            console.log(account_transaction)
        }
        if (page.items.length < page.page_size) {
            break
        }
    } else {
        console.log("Failure!")
        console.log(account_transactions_response)
        break
    }
}