Skip to main content
After backfilling invoices and payments, compare your source system with Layer to confirm two things:

Data completeness

Every record in the intended date range was sent, without missing or duplicate invoices, refunds, or payments.

Data consistency

The financial totals calculated from those records agree across your system and Layer’s accounting representations.
Layer’s data sync validation endpoint returns a compact set of totals for this comparison.
Amounts returned by Layer are integer cents. Calculate your source-system totals in the same unit and use the exact same date boundaries for both sides of every comparison.

Validation workflow

1

Complete the backfill

Import the full set of invoices, refunds, payments, and related sales data for the period you want to validate. Record the exact start_date and end_date boundaries used for the backfill.See Sales / AR data for the available invoice, payment, refund, and payout workflows. For large imports, use Bulk create invoices and Bulk create invoice payments where appropriate.
2

Calculate invoice totals in your system

Pull every invoice or sales receipt in the synced period, regardless of payment status. Calculate the following totals:
  • TOTAL_SALES β€” Sum all invoice totals.
  • CUSTOMER_REFUNDS β€” Sum refunds issued against invoices. Do not include refunded payments that left the invoice open.
  • TIPS β€” Sum tips included on invoices.
  • DISCOUNTS β€” Sum invoice-level and line-item discounts.
  • SALES_TAXES β€” Sum sales taxes reported on invoices.
  • NET_REVENUE β€” Calculate TOTAL_SALES - CUSTOMER_REFUNDS - DISCOUNTS - TIPS - SALES_TAXES.
These fields use accrual accounting in Layer. They reflect invoiced activity during the period and do not depend on whether an invoice has been paid.
3

Calculate payment processing fees

Pull the payments collected in the synced period and sum the processing fees reported on those payments.Compare this result with PAYMENT_PROCESSOR_FEES. This field uses the cash basis because it reflects fees on collected payments. It does not include hypothetical fees on invoices for which no payment was collected.
4

Fetch and compare Layer's totals

Call the validation endpoint with the same boundaries used for your source-system calculations:
Request
The response identifies the report and accounting basis used for each total:
Response
Compare each field independently. Matching only NET_REVENUE can hide offsetting differences between sales, refunds, discounts, tips, or taxes.

Investigate a difference by bisecting the period

If a total differs, narrow the problem by repeatedly splitting the date range:
  1. Divide the mismatched period into two non-overlapping date ranges.
  2. Recalculate the source-system total and call the validation endpoint for each half.
  3. Keep the half containing the difference and split it again.
  4. Repeat until the range is small enough to inspect individual records.
This is well suited to an automated agent: give it the original boundaries, the mismatched field, and access to both totals, then have it bisect until it finds a small set of example records.
Use identical boundaries on both systems at every iteration. Check records exactly on each boundary, timezone conversion, duplicate or missing external IDs, refunds that leave invoices open, and payment fee values before treating a difference as an accounting issue.

Data sync validation API

Review request parameters and the complete response schema.

Import sales and AR data

Review how invoices, payments, refunds, and payouts flow into Layer.