INVOICE PROCESSING

Nightly Batch Three-Way Match with Snowflake Audit Trail

On a nightly schedule, pulls all unmatched invoices from Postgres, runs the three-way match in bulk, releases clean payments via Stripe.

CategoryInvoice Processing
Enginesim
Difficultyintermediate
Triggerschedule
Steps6
Setup~15 min

How it runs

The automated pipeline, trigger to output.

  • TriggerNightly schedule after ERP batch post
  • ActionFetch all PENDING_MATCH invoices with PO and receiptPostgreSQLPostgres
  • LogicMatch in bulk; partition pass vs fail
  • ActionRelease payments for passing invoices via StripeStripeStripe
  • ActionWrite row-level audit records to SnowflakeSnowflakeSnowflake
  • OutputEmit paid/held/exposure summary for finance

What it does

This batch job clears the day's invoice backlog overnight. It matches every pending invoice against its PO and receipt, pays the ones that pass, holds the ones that fail, and lands a row-level audit trail in Snowflake so finance can report match rates and exception trends.

When to use it

Choose this over event-driven matching when your ERP posts invoices in bulk and you want one predictable nightly reconciliation rather than constant trickle processing. It is ideal when finance needs warehouse-grade reporting on AP throughput and exception causes.

How it works

  1. 1A nightly cron trigger fires after the ERP batch posts.
  2. 2Postgres returns all invoices in PENDING_MATCH status with their PO and receipt links.
  3. 3A logic step matches each invoice and partitions results into pass and fail buckets.
  4. 4Stripe releases payments for every passing invoice in the batch.
  5. 5Each invoice's outcome, variances, and decision basis are written as audit rows to Snowflake.
  6. 6A summary of paid, held, and total exposure is emitted for the finance dashboard.

Set it up

What you configure once, before turning it on.

  1. 1
    Connect PostgresAny Postgres URL — query, write, migrate.
  2. 2
    Connect StripeCustomers, subscriptions, payments.
  3. 3
    Connect SnowflakeWarehouses, queries, shares.
  4. 4
    Set each agent's modelWe leave models unset so you pick the tier — fast + cheap, or top-quality.
  5. 5
    Tune it to your dataEdit the prompts, filters, and field mappings so it matches how your team works.
  6. 6
    Test, then turn it onRun once against a sample, confirm the output, then enable the trigger.

Run this workflow in your colony.

14-day trial. No DevOps. No Sales call. Provisioned in under a minute.