Inspiration
Small merchants owe suppliers on a schedule while their own clients pay late, and nothing watches the gap. Paying out money you haven't received puts the merchant out of pocket. Research into merchant and freelancer complaints, and into stories of AI agents spending money without approval, led me to one idea: money in should release money out, inside rules the merchant controls.
What it does
InOut Pilot is a cash-flow guardian for small merchants.
- Type a request in plain language ("Invoice Gamma Co for $60", "Pay $20 to Singha Supplies once Gamma Co pays").
- It sends PayPal invoices and chases late clients with AI-written reminders, earlier and firmer for clients with a poor payer score (Reliable, Watch or Risky).
- Pay-when-paid: a supplier payout waits until the linked client invoice is paid (PayPal webhook), then goes through an Auto / Ask / Block policy.
- If a client is late and a supplier is due soon, it alerts the merchant: pay now, pay part, or send an AI-drafted extension request.
- On the Bryntum timeline, dragging a client's invoice date moves the supplier payouts linked to it and flags any that now fall after the supplier's due date.
How we built it
Node.js and Express with Supabase. PayPal sandbox: Invoicing v2, Payouts v1 and Webhooks. An OpenAI-compatible LLM (Groq gpt-oss-120b) turns requests into actions and drafts wording, but never decides whether money moves: plain code in a policy engine validates everything and decides. The merchant sees it all in an AG Grid dashboard, and Bryntum Scheduler Pro, Gantt, Calendar and TaskBoard views show how client payments release supplier payouts over time.
Challenges we ran into
- Sandbox region limits: India-region sandbox accounts can't send invoices to customers in India, so I rebuilt my test setup on US sandbox accounts.
- Making the AI dependable: the model sometimes asked needless questions or returned cut-off drafts. I added code checks on every AI output (it must state the real amount, with no links, fees or threats) and fall back to fixed templates.
- Duplicate events: PayPal can send the same webhook twice, so releases use conditional database updates and each payout uses a unique batch id, so nothing is paid twice.
- Messy data in charts: payouts without dates or links broke the timeline views until I added a date fallback chain.
Accomplishments that we're proud of
- A full working loop on the real PayPal sandbox: invoice sent, client pays, the webhook arrives, the waiting supplier payout is released and paid.
- The AI never controls the money. Every payment passes through code-based limits, with a logged reason for each decision.
- Dragging an invoice on the timeline visibly moves the dependent payouts, which makes the link between money in and money out easy to see.
- Unit tests for the policy engine, payer score, reminder checks, status summaries and payout shifting.
What we learned
This was my first time building a project around a smooth flow of money. By building it on PayPal's APIs I learned how money actually moves from one account to another: invoices, payouts and the webhooks that confirm each step. I also learned how AI can ease a merchant's work when they deal with many different clients, as long as code, not the model, makes the final call on money.
What's next for InOut Pilot
- Per-supplier terms: strict pay-when-paid for some suppliers, pay-on-due-date for others.
- Multiple merchant accounts with their own logins, instead of a single admin key.
- Moving beyond the sandbox once live PayPal access is available. ## What it does
Built With
- ag-grid
- bryntum
- cloudflare-tunnel
- express.js
- groq
- javascript
- node.js
- openai-api
- paypal
- paypal-payouts
- paypal-webhooks
- postgresql
- supabase