Accounting
Automate Expense Data Sync from Payroll to ERP
Implementation: Sync Expense Data from Payroll to ERP
Step 1: Extract Approved Expense Data from Payroll System
When expense reports reach "Approved" status in your payroll platform, extract the structured expense data including employee details, expense amounts, categories, dates, and receipt documentation. This data becomes the source of truth for creating matching records in the customer's ERP.
// Example: Extract approved expenses from your payroll system
const approvedExpenses = await payrollSystem.getExpenses({
status: 'approved',
dateRange: {
start: '2025-01-01',
end: '2025-01-31'
}
});
// Each expense contains:
// - employeeId: Internal employee identifier
// - amount: Expense total
// - category: Expense type (travel, meals, equipment)
// - expenseDate: Date expense was incurred
// - receipts: Array of receipt URLs
// - description: Expense description or notes
Step 2: Map Expense Categories to Chart of Accounts Codes
Each ERP system uses different account code structures. Use your customer's configuration to map your standardized expense categories to their specific GL account codes. This ensures expenses are posted to the correct accounts for financial reporting.
// Example: Category mapping configuration
const categoryMapping = {
'travel': {
accountCode: '6100', // Customer's travel expense GL code
accountName: 'Travel & Transportation'
},
'meals': {
accountCode: '6150', // Customer's meals & entertainment GL code
accountName: 'Meals & Entertainment'
},
'equipment': {
accountCode: '6200', // Customer's equipment GL code
accountName: 'Office Equipment'
}
};
// Map payroll categories to ERP account codes
const mappedExpense = {
...approvedExpenses[0],
accountCode: categoryMapping[approvedExpenses[0].category].accountCode
};
Step 3: Push Expense Records to ERP via Create Expense API
Use Knit's unified expense creation API to post expense records to the customer's connected ERP system. Knit handles platform-specific requirements, authentication, and data format transformations automatically.
API Endpoint: POST https://api.getknit.dev/v1.0/accounting.expense.create
// Example: Create expense in ERP using Knit API
const knitResponse = await fetch('https://api.getknit.dev/v1.0/accounting.expense.create', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_KNIT_API_KEY',
'X-Knit-Integration-Id': 'CUSTOMER_INTEGRATION_ID',
'Content-Type': 'application/json'
},
body: JSON.stringify({
employeeId: mappedExpense.employeeId,
amount: mappedExpense.amount,
currency: 'USD',
expenseDate: mappedExpense.expenseDate,
accountCode: mappedExpense.accountCode,
category: categoryMapping[mappedExpense.category].accountName,
description: mappedExpense.description,
receiptUrl: mappedExpense.receipts[0],
// Platform-specific metadata for QuickBooks
metaData: {
PaymentType: 'CreditCard', // Required for QuickBooks
AccountRef: mappedExpense.accountCode
}
})
});
const result = await knitResponse.json();
console.log('Expense created in ERP:', result);
Platform-Specific Considerations:
- QuickBooks: Requires
metaData.PaymentType(Cash, Check, or CreditCard) andmetaData.AccountReffor account reference - Odoo Accounting:
metadata.nameis mandatory;lineItemsarray is not supported (use single expense amount) - Odoo Currency Handling: Currency field requires
currencyIdrather than ISO currency code—fetch this via the List Currencies endpoint - NetSuite & Sage Intacct: Standard fields supported without additional metadata requirements
Key APIs and Data Models
| API/Endpoint | Description | Key Fields |
|---|---|---|
POST /accounting.expense.create |
Creates expense record in connected ERP | employeeId, amount, currency, expenseDate, accountCode, category, description, receiptUrl |
GET /accounting.accounts |
Retrieves chart of accounts for GL code mapping | accountCode, accountName, accountType, category |
GET /accounting.currencies |
Lists available currencies (required for Odoo) | currencyId, currencyCode, currencyName |
POST /accounting.expense.update |
Updates existing expense record | expenseId, updated field values |
GET /accounting.expenses |
Retrieves expense records from ERP for reconciliation | Query parameters: startDate, endDate, employeeId |
Supported ERP Platforms:
QuickBooks, NetSuite, Sage Intacct, Odoo Accounting Online, Xero, Oracle Cloud ERP, SAP Business One, FreshBooks, Zoho Books, Wave Accounting
Data Model Notes:
- Employee IDs must match between payroll and HRIS systems—use Knit's employee data sync to maintain consistent identifiers
- Receipt URLs should be publicly accessible or use temporary signed URLs for secure access
- Account codes vary by customer—always fetch the customer's chart of accounts before mapping categories
- Multi-currency support available but requires currency ID lookup for certain platforms
Wrapping Up: Eliminate Manual Expense Data Entry and Accelerate Financial Close
Expense data shouldn't live in silos between payroll and accounting systems. With Knit's expense automation, approved expenses flow seamlessly from your payroll platform into customers' ERP systems—complete with proper categorization, GL mapping, and supporting documentation. This eliminates manual data entry, accelerates financial close processes, and ensures finance teams have real-time visibility into expense liabilities.
Key capabilities unlocked:
- One integration, 10+ ERP systems: Build expense sync once, support every major accounting platform
- Automatic GL mapping: Route expenses to correct account codes based on category classifications
- Platform-specific handling: Knit manages QuickBooks metadata requirements, Odoo currency lookups, and other platform quirks automatically
- Real-time financial visibility: Expenses appear in ERPs immediately after payroll approval
- Reduced reconciliation errors: Eliminate manual data transfer mistakes between systems