Analyze spend
Your user authorizes your application to access their accounting service (e.g., QuickBooks Online, NetSuite) via an OAuth or similar authorization flow through Merge Link.
The following steps will cover the business logic you will need to configure in your backend to interact with Merge’s Unified API.
“Settings” or “Master” data refers to all information related to vendors, accounts, and (in some cases) tracking categories. To do this, we will access four endpoints:
- Sync your customer’s chart of accounts by using the GET /accounts endpoint.
-
You can use the
classificationandparent_accountfields to compile account types and hierarchy! - Follow the steps outlined in the Sync Customers or Suppliers” use case to sync vendors in your system with the third party.
- If your customer has classes, locations, or departments configured, you can retrieve them from the accounting platform with GET /Tracking Categories.
- Utilize the GET /items endpoint to pull in your customer’s products, goods, and services.
Retrieve all transactions in your customer’s ERP/Accounting platform related to spend by compiling data from the below endpoints:
- Use the GET /invoices endpoint to access all bills, and set the
typequery param =ACCOUNTS_PAYABLEto filter to only bills. - Use the GET /payments endpoint to access all payments related to bills.
- Use the GET /expenses endpoint to access any direct purchases your customer makes, such as a credit card transaction or check purchase.
- In some cases, your customer may record purchases as direct entries against the ledger, rather than a bill or expense. You should utilize the GET /journal-entries endpoint to retrieve these transactions and just look for ones that affect the appropriate general ledger accounts.
- (Optional) You can optionally pull in purchase orders to your application through the GET /Purchase-Orders endpoint.
Using the transactions retrieved in the prior step, you’ll be able to paint a full picture of your customer’s spend. You’ll be able to aggregate by Date, General Ledger Account, Vendor, Class, Department, Location, and more.
After the initial pull of data, you’ll need to keep your data up to date by regularly fetching data from Merge. The modified_after query parameter can be utilized on all of Merge’s GET endpoints to keep these subsequent processes more efficient. For a full overview of Merge’s syncing best practices, see our guide here!