Inspiration

Expense reports die in the gap between "I paid for this" and "someone approved it". The employee forgets, the manager is busy, finance pays late, and the receipt lives in a chat thread. We wanted the whole loop — read the paper, enforce the policy, approve, pay — to happen in under a minute without anyone opening a spreadsheet.

What it does

The employee uploads a photo of a receipt and their PayPal email. A multimodal model reads the merchant, date, line items, total and currency, and returns a verdict against the company policy. Deterministic code then re-checks the same numbers: category limits, a 30-day window, IDR only, unreadable fields, and duplicate submissions.

If the receipt passes, the employee lands on a "waiting for manager approval" page with a tokenised link. The manager sees the claim, its line items and the USD payout, and one click converts IDR to USD and sends a PayPal Payout. The employee gets a paid page showing the batch id.

Replaying the link returns a 409 page — "this claim has already been paid" — instead of paying twice. A receipt over the limit is refused with a reason the employee can act on, e.g. "exceeds the meal limit of Rp 150.000".

How we built it

  • n8n as the whole backend. Four webhook chains in one workflow: form, submit, approve, pay. Every HTML page is rendered from a Code node and returned by respondToWebhook — no hosting.
  • Vision step. One HTTP Request node against an OpenAI-compatible chat endpoint (deepseek-flash, which accepts image input), receipt sent as a base64 data URL with a strict JSON schema in the system prompt.
  • Policy engine in code. A Code node takes the model's JSON and applies the limits the model cannot be trusted with, then computes the payout amount.
  • State without a database. $getWorkflowStaticData('global') holds pending claims keyed by a short ref plus a random token, and a seen-map for duplicate detection.
  • PayPal Payouts. One OAuth2 client-credentials credential, one POST /v1/payments/payouts with a dynamically built body, batch id surfaced back to the user.

Challenges we ran into

  • The model does not know today's date. Every 2026 receipt came back "future-dated" and was rejected until we injected TODAY: into the prompt. Five different model ids failed identically.
  • Explanations are not verdicts. Our first gate treated the model's policy_reasons as the rejection list, so a receipt the model approved — with helpful notes — was rejected. Notes had to move into their own field.
  • A 200 from PayPal is not money. The batch is created as PENDING; a payout to the sender's own account is accepted, then flips to DENIED / SELF_PAY_NOT_ALLOWED seconds later. We now verify the batch and use a second sandbox account as the receiver.
  • n8n's JSON body + expressions. The payout body returned 400 MALFORMED_REQUEST_JSON until it was built as one JSON.stringify(...) expression instead of raw JSON with {{ }} inside.
  • A throw is a UI decision. Throwing inside a loader node becomes raw {"message":"Error in workflow"} at status 500 in the user's browser. Loaders now return { ok: false, reason } and an IF routes to a light, human-readable page.
  • n8n serves pages with a CSP sandbox, so fetch() from the form was blocked as cross-origin. The form now submits natively and the response page is the actual pending page.

Accomplishments that we're proud of

  • Money actually moved: payout batch DJQNF3VB487C2 → SUCCESS, 10.44 USD delivered into a second sandbox account, visible in that account's activity.
  • The guardrails hold: replaying a paid approval link returns a 409 page and creates no second payout; an over-limit receipt is rejected with a readable reason.
  • Everything — UI, policy, approval, payout — lives in one 28-node n8n workflow with no server, no database and no hosted frontend.

What we learned

  • A vision model is a parser, not a judge: keep the money decisions in deterministic code and let the model only extract facts.
  • Provider "success" is often asynchronous — always verify the terminal state from the provider's own API before telling a user they were paid.
  • In low-code runtimes, the response headers (CSP, CORS) decide what the UI can do; the browser console is the fastest way to find that out.

What's next

Live FX rates, per-item category overrides, a manager dashboard listing pending claims instead of one link per claim, Slack/WhatsApp delivery of approval links, a payout-status poller that only marks a claim paid once PayPal reports SUCCESS, and multi-tenant policies per company.

Built With

Share this project:

Updates

Submission history