SNC-WF-062 · Free Tier · Profitability & Reporting

Calculate true landed margin and unit economics per SKU automatically.

SNC-WF-062 · Daily Landed Unit Economics & Gross Margin Reconciler (Free Tier)

A self-hosted Python workflow that reconciles order revenue against SKU costs, packaging, payment processor fees, and courier freight to uncover true contribution margin per SKU.

PRODUCT SUMMARY AT A GLANCESNC-WF-062
Primary OutcomeReconciles daily orders against SKU costs, packaging, gateway fees, and courier freight to reveal true contribution margin per SKU.
How It RunsSelf-Hosted Python 3.9+ (Runs on your own computer or server)
Setup ExpectationsFree to self-host on your own hardware. Free workflows never run on Sanocea infrastructure. Optional assisted setup available via WhatsApp.
Verification StatusCode & Logic Tested: Tested with full/partial refunds, multi-item discounts, and COD fees
The 3-Step Process in Simple English
1. Input

Daily order export JSON/CSV, product cost master CSV, and processor fee rules.

2. Transformation

Joins orders with COGS catalog, calculates gateway and freight allocations, evaluates contribution margin, and isolates loss-making SKUs.

3. Output

Executive HTML dashboard, SKU profitability CSV ranking, unmapped SKU queue, and updated SQLite ledger.

100% Free to self-host. Want Sanocea to set it up? Request Assisted Setup or Customisation.

Setup scope covers installation on customer-controlled infrastructure, configuration of authorised integrations, functional testing and handover.

Hosting, third-party charges and ongoing support are excluded unless separately agreed. Free workflows run on customer hardware; Sanocea does not provide free VPS hosting.

Direct Download or Assisted Setup: Download the free toolkit below, or contact engineering on WhatsApp to request assisted setup or customisation.

What Goes Wrong in an Ordinary Working Day

Store dashboards report gross revenue, but founders frequently lose money on high-volume items after courier shipping, payment gateway fees, packaging, and coupon discounts are deducted.

The Impact on Your Business & Customers

Selling high order volumes at negative contribution margin bleeds cash reserves. Daily SKU margin visibility ensures you adjust pricing or discontinue unprofitable variations immediately.

What This Tool Does & What Changes for You

Ingests your daily order exports or webhooks, joins them against your SKU cost master and processor fee rules, allocates freight and discounts, and writes an executive profitability audit.

What Changes in Practice:

You see the true net profitability of every product sold today, enabling instant decisions on pricing, ad spend, and promotion strategy.

Concrete Before & After Example (Actual Code Output)

Demonstrates order-level landed margin calculation for a multi-item discounted order.

INPUT: Multi-Item Order (Jeans ₹1,499 + T-Shirt ₹649, Discount ₹200, Stripe Gateway, Freight ₹110)Input File
Order: #1002 | Gross Items: ₹2,148.00 | Discount: ₹200.00 | Net: ₹1,948.00 | Stripe Fee: ₹56.79 | Freight: ₹110.00
OUTPUT: Reconciled Landed Unit Economics per SKUnormalized_inventory.csv
SKU-JEANS-BLU-32: Net Rev ₹1,359.00 | COGS ₹650.00 | Pkg ₹25.00 | Gateway ₹39.63 | Freight ₹78.57 | Landed Margin: ₹565.80 (41.6%)
SKU-TSHIRT-BLK-L: Net Rev ₹589.00 | COGS ₹230.00 | Pkg ₹15.00 | Gateway ₹17.16 | Freight ₹31.43 | Landed Margin: ₹295.41 (50.1%)

Reveals true net margin after all operational deductions rather than inflated top-line figures.

What Changed vs. What Remained Unchanged

✓ What Changed (Normalized):
  • Calculated exact net contribution margin per SKU instead of relying on top-line estimates
  • Allocated courier freight by weight and gateway transaction fees by net revenue
  • Exported executive HTML dashboard and granular CSV spreadsheet
ℹ What Remained Unchanged:
  • Order data and customer records preserved without modification
  • 100% self-hosted local execution with zero cloud data transmission

What You Need Before Getting Started

  • Standardized order export JSON/CSV from Shopify or WooCommerce.
  • Your product cost master CSV (sku, unit_cost, packaging_cost).
  • Payment processor fee percentages and courier freight costs.

Technical Setup Guidance:

Setup Difficulty & Expected Time

Step-by-Step Run Instructions (Zero-Code Terminal Run)

  1. Download and extract snc-wf-062-daily-landed-margin-reconciler.zip.
  2. Place your product costs in fixtures/cogs_master.csv.
  3. Run: python3 reconciler.py --orders fixtures/sample_orders.json --cogs fixtures/cogs_master.csv --gateways fixtures/gateway_rules.json --out-dir reports.
  4. Open reports/landed_margin_report_YYYY-MM-DD.html in any browser.

What You Receive in the Download Archive

Every deliverable is clean, self-contained, and ready for immediate deployment. You receive the complete files, configuration templates, setup guides, and automated tests.

File NameDeliverable Description
reconciler.pyStandalone Python execution engine (standard library only)
tests/test_reconciler.pyAutomated hermetic test suite with 15 passing tests
fixtures/cogs_master.csvSKU cost master fixture with unit costs and packaging
fixtures/gateway_rules.jsonPayment processor fee rule schedules
fixtures/freight_rules.jsonWeight and zone-based courier freight rules
fixtures/sample_orders.jsonDiverse test order fixture
README.mdComplete setup guide and operational documentation
SETUP.md5-minute quickstart and cron execution instructions

Architecture Diagram & Tested Capabilities

For technical teams or developers assisting your business, below is the visual execution architecture and automated verification breakdown:

Calculate true landed margin and unit economics per SKU automatically. Architecture Pipeline Diagram
⚡Deterministic execution flow: runs on your own compute without telemetry tracking.

Verification Disclosure

Hermetically verified with automated test suites covering multi-item discount distributions, freight weight allocations, unmapped SKU isolation, and full refund cost reversals.

Documented Limitations & Third-Party Costs

We believe in complete transparency. Review the documented technical boundaries and external service fee breakdown below prior to obtaining the package:

⚠️Documented Boundaries & Considerations

  • File-based ingestion: accepts standardized order JSON or CSV exports. Direct live API polling requires scheduled connector setup.
ComponentEstimated CostDetails & Free Tier Allowances
Software License₹0 (Free & Open Source)
Hosting / Cloud Runtime₹0 (Runs locally on merchant machine or cron)
Optional Assisted Setup₹500 one-time via WhatsApp

Platform Compatibility & Technical Specifications

Operating System
Linux, macOS, Windows
Runtime / Python
Python 3.9+
Supported Platforms
Shopify, WooCommerce, Magento, Custom E-Commerce
Required Inputs
  • Order JSON or CSV containing line items, selling prices, discounts, and payment methods
  • cogs_master.csv containing SKU unit costs and packaging allowances
  • gateway_rules.json defining payment processor transaction fee schedules
Generated Outputs
  • landed_margin_report_YYYY-MM-DD.html executive visual dashboard with KPI cards and SKU ranking
  • sku_profitability_YYYY-MM-DD.csv detailed accounting spreadsheet export
  • unmapped_skus.csv queue of unlisted items requiring cost input
  • margin_reconciliation.sqlite persistent local historical ledger
Free Self-Hosted SoftwareInstant Free Download · Request Customisation

Download or Set Up SNC-WF-062

Receive the complete distributable archive containing reconciler.py, step-by-step setup guides, mock fixtures, and automated test suites.

Free to self-host. Want Sanocea to set it up? Request Assisted Setup or Customisation.

Setup scope covers installation on customer-controlled infrastructure, configuration of authorised integrations, functional testing and handover.

Hosting, third-party charges and ongoing support are excluded unless separately agreed. Free workflows must never run on Sanocea-hosted infrastructure.

SIGN IN TO DOWNLOADRequest Customisation on WhatsAppWe reply within 2 business days (Monday to Saturday, 9:00 AM to 9:00 PM IST)

Frequently Asked Questions

How does this tool calculate true landed contribution margin per SKU?

For every order line item, the engine calculates net selling price (gross price minus allocated discounts) and subtracts direct unit product COGS, packaging cost, allocated payment processor fees, and allocated courier freight. The remaining amount is your true landed gross contribution margin.

How are payment gateway fees and courier freight allocated across multi-item orders?

Payment gateway fees are allocated across line items proportionally based on their net revenue contribution. Courier freight is allocated based on individual line-item weight, or proportionally by item price if product weights are not provided.

What happens when an order includes an SKU that is missing from the COGS master file?

The reconciler flags the line item with status UNMAPPED and logs it directly to unmapped_skus.csv with order details. It processes the rest of the order without crashing, allowing your merchandising team to add the missing cost and re-run.

Ecommerce Landed Gross Margin & Unit Economics: Order-Level Financial Reconciliation

How order-level courier freight, payment gateway charges, packaging costs, and discounts erode gross profit, and how automated reconciliation isolates loss-making SKUs.

Read Field Guide on Sanocea Insights →

Explore Related Self-Hosted Tools

SNC-WF-061Self-Hosted Python 3.8+

Get a Daily Executive Sales & Gross Margin Digest on Telegram

Daily Executive Sales & Gross Margin Digest to Telegram (Free Tier)

A free, local Python financial digest tool. It reads your previous day's store order export, calculates total revenue, prepaid vs. COD share, average order value (AOV), returns, and gross product margins, formatting the results into a crisp morning briefing sent directly to your phone via Telegram.

SNC-WF-022Self-Hosted Python 3.8+

Extract Payment Gateway Notifications into a Clean Reconciliation Ledger

Payment-Email Inbound Rail & Receipt Audit Ledger (Free Tier)

A free, local Python tool that turns messy payment confirmation emails into a structured financial ledger. It extracts transaction IDs, customer details, gross amounts, MDR processing fees, and net payouts from email exports (.eml or text dumps)—creating a unified reconciliation CSV ready for your accounting team.

C02Python 3.10+

See Where Every Order's Money Went & Recover Lost Marketplace Revenue

E-Commerce Settlement & Fee Matcher

An enterprise marketplace reconciliation engine that automatically audits bank payout sheets from Amazon, Flipkart, and Myntra against your original order records. It isolates commission overcharges, unexpected weight penalties, uncredited customer returns, and missing remittances—generating ready-to-file dispute spreadsheets that recover thousands of rupees in lost margin every month.