Skip to content

Latest commit

 

History

23 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multi-Gateway Financial Reconciliation System

n8n Stripe PayPal Shopify QuickBooks JavaScript

Nodes Architecture Status License

Automates financial reconciliation across Stripe, PayPal, and Shopify into QuickBooks.

No manual exports. No copy-paste. No reconciliation headaches.


The Problem

Companies operating across multiple payment platforms face a critical financial operations bottleneck:

Pain Point Business Impact
Stripe, PayPal, and Shopify each send different JSON schemas Manual field mapping required per platform
Multi-currency transactions across GBP, EUR, AED Manual FX conversion introduces rate errors
No cross-platform duplicate detection Double-entries appear in accounting records
Manual QuickBooks data entry 40+ hours per month of accountant time
No refund automation Credit notes created manually per refund event
No error visibility into the pipeline Silent failures result in missing transactions

Finance closing took 4,5 business days. Audit mismatches were common. Accountant bandwidth was consistently exhausted.


The Solution

A structured automation pipeline built on n8n that:

  • captures transactions in real time
  • standardizes data across all platforms
  • applies live currency conversion
  • prevents duplicate entries
  • syncs directly into QuickBooks
  • maintains a complete audit trail

Everything runs automatically once a payment event is triggered.

Trigger  |  Normalize  |  Convert FX  |  Deduplicate  |  QuickBooks Sync  |  Audit Log  |  Alerts

Architecture Overview

High-level flow of the system:

  • Incoming payment events from multiple gateways
  • Data normalization into a single schema
  • Currency conversion and validation
  • Duplicate detection before any write operation
  • Automated accounting sync in QuickBooks
  • Persistent audit logging
  • Alerting for failures and monitoring
flowchart LR
    A[Stripe Webhook] --> D[Schema Normalizer JS]
    B[PayPal Webhook] --> E[Schema Normalizer JS]
    C[Shopify Webhook] --> F[Schema Normalizer JS]
    D --> G[Merge Stream]
    E --> G
    F --> G
    G --> H[Live FX Conversion\nexchangerate-api.com]
    H --> I[Duplicate Check\nAirtable Lookup]
    I -->|New| J[Create PENDING Record]
    I -->|Duplicate| K[Stop Silently]
    J --> L{Payment or Refund?}
    L -->|Payment| M[QB: Create Customer]
    L -->|Refund| N[QB: Credit Note]
    M --> O[QB: Create Invoice]
    O --> P[QB: Mark Paid]
    P --> Q[Update to SYNCED]
    N --> Q
    Q --> R[Slack: Success Alert]
    style K fill:#ff6b6b
    style R fill:#51cf66
Loading

Layer-by-Layer Breakdown

Layer 1 Trigger

Three independent webhooks, one per platform. Returns 200 OK immediately to prevent gateway timeout retries. All processing happens asynchronously from this point.

Layer 2 Schema Normalization

Each platform sends fundamentally different structures. Stripe sends amounts in cents, PayPal uses a nested payer object with decimal values, and Shopify sends a full order object with a line items array. A custom JavaScript node normalizes all three into one unified transaction format:

{
  "transaction_id": "pi_3abc...",
  "amount": 29.99,
  "currency": "USD",
  "customer_email": "reyes@example.com",
  "source_platform": "STRIPE",
  "transaction_type": "PAYMENT",
  "timestamp": "2024-04-11T10:30:00Z"
}

Layer 3 Live FX Conversion

Fetches real-time rates from exchangerate-api.com and converts all non-USD amounts to USD. Both the original amount and the conversion rate are stored for full audit trail. If a rate is unavailable, the system logs a warning and continues rather than crashing.

Layer 4 Duplicate Prevention

Queries Airtable by transaction_id before any write operation. If a record already exists, execution stops silently. If the transaction is new, a PENDING record is created before proceeding. This prevents double-booking from webhook retry storms common across all three gateways.

Layer 5 QuickBooks Sync

Payment path (3 API calls):

  1. POST /customer: create or update customer record by email
  2. POST /invoice: create invoice with line item and audit note in PrivateNote field
  3. POST /payment: mark invoice as paid and link to invoice ID

Refund path (1 API call):

  1. POST /creditmemo: create Credit Note referencing the original transaction ID

Layer 6 Audit Log

Updates the Airtable record from PENDING to SYNCED. Stores the QuickBooks reference ID, sync timestamp, and USD amount. The full log is queryable at any time for compliance or audit purposes.

Layer 7 Error Handling

The errorTrigger node catches all failures across the entire workflow. A Slack alert fires immediately with the Execution ID, failed node name, and error type. The system then waits 15 minutes to handle API rate limits or temporary downtime before auto-retrying the original payload.


Results

Operational impact after automation:

Metric Before After
Finance closing time 4–5 business days 10 minutes
Manual data entry 40+ hours per month 0 hours
Error rate 5–10% human error 0%
Monthly transaction capacity ~500 10,000+
Refund processing Manual credit note creation Fully automated
Audit readiness 2–3 days to compile Real-time

Quick Start

See docs/setup-guide.md for the complete installation and configuration walkthrough.

Minimum requirements:

  • n8n instance (self-hosted or cloud)
  • Stripe, PayPal, Shopify, and QuickBooks accounts
  • Airtable account and Slack workspace
  • Free API key from exchangerate-api.com

Security

  • All API keys and OAuth tokens are stored in n8n's encrypted credential store — never in the workflow JSON
  • The .gitignore in this repository excludes all .env files and local credential configs
  • Airtable stores only transaction metadata — no card numbers or sensitive payment data beyond customer email
  • For production deployments, enable n8n's built-in webhook authentication to prevent unauthorized triggers

Repository Structure

n8n-financial-reconciliation/
├── workflow/
│   └── financial_reconciliation_workflow.json
├── docs/
│   ├── setup-guide.md
│   └── architecture.md
├── examples/
│   ├── sample-input-stripe.json
│   ├── sample-input-paypal.json
│   └── sample-output.json
├── README.md
├── .env.example
├── .gitignore
└── LICENSE

Tech Stack

Category Technology
Automation Platform n8n
Payment Gateways Stripe API, PayPal API, Shopify Admin API
Accounting QuickBooks Online API
Audit Database Airtable
FX Rates exchangerate-api.com
Alerting Slack API
Custom Logic JavaScript

License

MIT License. Free to use, modify, and distribute. See LICENSE for full terms.


Why This Project Matters

This project is not just an automation workflow.

It represents how financial operations can be redesigned as systems instead of manual processes.

Instead of:

  • exporting data
  • cleaning spreadsheets
  • manually reconciling transactions

The system handles everything in real time with full traceability.

This reduces operational load and increases accuracy at scale.

Author

Hamid Reyes
Automation Systems Builder
Focused on financial operations, workflows, and scalable backend systems Pakistan Available for remote engagements globally

Gmail GitHub LinkedIn


Built to eliminate manual finance operations at scale.

Releases

Packages

Contributors