Inspiration

Are you also that one person who is in charge of planning things? But when it comes to money everyone becomes quiet? Having to jump through hoops and hurdles just to get everyone to pay for their portion. I personally have continuously found myself in this scenario, and I am tired. This led me to create Rivulet.

What It Does

Rivulet allows individuals to quickly provide a easy language what they are doing and how much everything will be split. Given a deadline and send it out and you are golden. No one can say they did not see it, because you can keep track of who sees and who needs to see it again (if you know you know).

Once it is sent out the parties can then open the link and they are automatically sent to the payment portal, no ifs, no buts just payment.

It is also very fair, everyone can see who all has paid what so no one can say they paid more or less. When trying to keep everyone on a deadline, go ahead a state when everyone must be paid, if the deadline is not meet, everyone is refunded and must start anew. That is indeed one may to make sure when we make plans, we DO INDEED make plans.

How We Built It

This was built using Nextjs, Typescript, Clerk, Amazon Bedrock, Supabase for storage, Vercel for deployment. Amazon Nova Lite for the LLM model. I utilized tool calling agents such as find_contacts, check_recipient and create_flow.

  • Guard rails live in code, not the prompt. Amounts must sum to the goal to the cent, recipients are validated, a payout can't be created as already paid, and payouts must name who receives money, not the contributors. Running the agent against live Bedrock showed a small model will invent a deadline, a payout date, group members or a release condition, so every one of those must trace back to the user's own words, checked in code. A date the user typed that didn't make it into the flow, or a "pay once…" that became an immediate payout, is reported as a warning instead of passing silently.
  • Tested. npm test runs 62 unit tests over the money rules (idempotent capture, one-time payout trigger, deadlines, refunds, shares, roster, re-split arithmetic, scheduled release, reversed payments, currency formatting), the invoice reader's handling of untrusted model output, and the AI guard rails.
  • AG Grid Community 33.3 for the Flows, Payments, People and payouts tables, with a shared theme, live updates, pinned totals, and date sort/filter.

PayPal Developer Platform

API Used for
Orders v2 (create, get, capture) A separate order per contributor, tagged with the flow id and verified at capture
Payouts v1 Paying vendors when the goal is met
Payments v2 refunds Returning each payment in full; the request id is derived from the capture id so a retry can't refund twice
Webhooks Signature-verified payout confirmations and failure handling, plus refunded, reversed and disputed payments
Transaction Reporting Payments ledger and activity feed
Checkout on the pay page

Making the money safe

Many people paying into one flow at once is the hard part:

  • An order that no longer fits (flow filled, or deadline passed) is refused before the contributor is charged.
  • A payout lock prevents two payout runs, or a payout and a refund, on the same flow.

- Public pages expose only a whitelist of flow data: no owner id, no recipient addresses.

Challenges We Ran Into

  • One order, one capture. PayPal orders are single-use, so every contributor gets their own order, and capture verifies it belongs to the flow.
  • Concurrent payers. Two people can approve orders that individually fit but together don't. We recheck at capture and leave the second order uncaptured.
  • Keeping the AI honest. A small model drifts. Moving the rules into code and returning their errors to the model made it reliable without making it trusted.

Accomplishments

  • A complete, tested loop on the live site: AI plan → contributor pays → payout → webhook confirms (SUCCESS) → separate refund test, which recorded a real PayPal refund id and reset the flow to Refunded. Utilized webhooks to continuously push notifications back and forth, utilization of Supabase for storage that can handle multiple of transactions across multiple users. ## What We Learned Payments are mostly about trust and edge cases, not API calls. The interesting work was deciding what must never happen (double payout, charging an order that doesn't fit, refunding after payout) and making the code, not the AI, enforce it.

What's Next

  • Production PayPal accounts, and phone-number payouts (production only).
  • Receipt scanning to split a dinner bill.
  • Multi-currency.

Built With

  • aggrid
  • amazon-bedrock
  • nextjs
  • nova-lite
  • paypal
Share this project:

Updates

Submission history