Finance Engineering & Data Infrastructure
The five layers of ecommerce finance integration, from source data to general ledger
Seamline Editorial · Finance content team · Updated
TL;DR
A direct source-to-ERP link breaks the moment one payout spans orders, refunds and fees. Layering splits the problem into five seams: source, ingest, warehouse, reconciliation, ledger. Each seam has one job and one invariant: idempotent ingest, a declared grain, control totals, one definition of revenue. The ledger then receives one honest number instead of four dashboard opinions.
Why layers beat a direct link
The tempting design is a straight line from Shopify or Amazon into the ERP. It works right up to the first payout that contains a sale, a refund, a fee and a deferred transaction at the same time. Then the single number posted to the ledger turns out to be a blend of things that happened on different dates and mean different things.
Layering is not architecture ceremony. It is a way to put a contract at every seam. Each layer promises one thing to the next and fails loudly when that promise breaks, so you can debug one seam without rewriting the whole pipeline. Five small contracts are easier to defend than one large assumption.
Layer 1, Source: platform, payment, ads, 3PL
The source layer is where the raw records live: Shopify orders and Shopify Payments payouts, Amazon settlement data, ad-platform spend, 3PL invoices. These systems were built to run operations, not to feed your general ledger. Their units, timing and idea of “revenue” all differ.
Shopify describes a payout as funds transferred to your bank account for a set of transactions, with an activity report that breaks out transactions, fees and payouts. Amazon’s Payments Summary decomposes a settlement into beginning balance, sales, refunds and expenses, advertising cost included, plus account-level reserves. Treat each source as a distinct dialect, not a single truth.
| Source | Unit it speaks | Common failure at this seam |
|---|---|---|
| Shopify Payments | Payout to a bank account, with fees and refunds inside | Reading the payout as gross sales, ignoring what it nets out |
| Amazon Seller Central | Settlement: balance, sales, refunds, expenses, reserves | Treating “sales” as collectible cash; overlooking deferred transactions |
| Ad platforms | Spend by campaign and date | Attributing spend on click date, not the date the platform charged it |
| 3PL | Invoice lines for storage, fulfillment, adjustments | Mixed billing periods and credit notes that arrive late |
Layer 2, Ingest: land it once, idempotently
Ingest copies source records into your own store without changing their meaning. Keep the source id, keep the raw payload, and make a re-run a no-op by upserting on that source id. Transformation belongs to the next layer; if ingest starts cleaning numbers, you lose the ability to go back and check what the source actually said.
The usual failures are mechanical: a webhook retries and double-counts, a refund lands three weeks after the sale, a source silently adds a field. None of these should corrupt the landed set. Make the load repeatable and record its metadata: source, cursor, row counts and run time. Every downstream figure can then be traced to the run that produced it.
Same load, same records, every time
Running the same load twice, in any order, with any overlap, must produce the same landed records. If it does not, you cannot trust anything built on top.
Layer 3, Warehouse: one declared grain
Here raw records become a model. The strongest base for money truth is a fact table at one declared grain, one row per financial event, with dimensions for currency, time and legal entity. The grain is the most consequential decision in the whole design, and it must be written down before the first load, not discovered in a dashboard argument later.
Failure modes are predictable: joining on amounts or customer emails instead of platform ids, mixing order grain with event grain, or mutating a row when a refund arrives instead of appending a new negative event. The invariant is that grain stays stable and definitions are unified: “revenue” means one thing, in one currency basis, across every source.
| Field | Type | Why it is there |
|---|---|---|
| event_id | string (PK) | Idempotency key; one upsert per source event |
| source | enum | Which system produced it; scopes the join keys |
| source_ref | string | Platform-minted id, never an amount or an email |
| occurred_at | timestamp | When the event happened, distinct from load time |
| amount_gross / fee / net | decimal(18,4) | Money columns at source currency |
| currency | char(3) | Dimension so totals never silently mix currencies |
| payout_ref | string (nullable) | Ties the event to the cash that carried it |
Layer 4, Reconciliation & metrics: make the table check itself
This layer turns a model into a number you can defend. The core check is a control total: group events by payout reference and sum the net column; the sum must equal the payout amount, to the cent. Add a gross-minus-fee-equals-net identity per event and a daily source-count check, and the table audits itself rather than waiting for a month-end surprise.
Amazon’s structure makes the identity concrete: beginning balance, plus sales, less refunds and expenses, adjusted for reserves, should reconcile to the disbursement for the settlement period. The failure here is definitional, with each team computing margin or ROAS from a different base, or operational, doing this check once instead of every day. The invariant: control totals tie out, and every metric has one documented definition traced to the fact table.
- Net events per payout = payout amount, to the cent.
- Gross − fee = net on every event row; no silent residuals.
- One documented definition per metric, with its base table named.
- Every failure is a finding: a load gap or a data bug, never noise.
Layer 5, Reports & ledger: one number into the ERP
The final layer posts a single reconciled journal into the general ledger, Kingdee or whatever ERP you run, with an audit trail back through every layer. It consumes the reconciled metric; it does not re-derive revenue from raw sources. That separation is the whole point: the ledger gets one number, and that number has a provenance chain.
The failure is a second source of truth: numbers re-keyed into the ERP by hand, or account mappings drifting as new fee types appear, until the ledger and the warehouse tell different stories. The invariant is simple to state and hard to break casually: the ledger entry equals the reconciled control total, and each line is traceable from source event, through payout, to journal. This is the layer Seamline’s published reconciliation detectors operate on: mismatches surfaced per transaction and traced to the event behind them.
The point of layering
A direct link hides its assumptions inside itself. Layers make each assumption a contract you can test. You are not building five systems for the price of one; you are building one pipeline that can tell you where it broke.
FAQ
Why not connect Shopify or Amazon straight to the ERP?
Because a payout is not a sales invoice. It contains sales, refunds, fees and reserves across different dates. A direct link has to make all those decisions implicitly, inside a connector you cannot easily audit. Layers put each decision at a seam with its own contract and check.
Where do ad spend and 3PL invoices fit?
They are sources in layer 1, with their own units and billing dates. They land at their own grain, land idempotently, and are unified only in the warehouse, as cost dimensions and events, so that spend and fulfillment fees can sit beside revenue in one reconciliation.
What is a control total, concretely?
An independent number that the detailed rows must add up to. For payments, the strongest one is the payout amount: sum the net of every event carried by that payout and you must land on the same figure the processor actually sent. If you do not, the load is incomplete or duplicated.
Does this require a data warehouse?
No. The five seams are a separation of responsibilities, not a product requirement. At small volume they can live in one database. The warehouse is a scaling decision; the grain, idempotency and control totals are correctness decisions. Get those right first.
See the pipeline checks on real-shaped data
The demo runs Seamline’s published reconciliation detectors over sample store data: control totals, fee residuals and refund gaps, each traced back to the transaction behind it.