Inspiration

Small fundraisers—whether for a school club or a neighborhood repair project—often ask donors to trust one person with the money. Donors rarely see exactly where their contributions go, while honest organizers have no easy way to prove that funds were spent responsibly.

We asked ourselves one simple question:

What if the organizer never held the money at all?

That question inspired StraightMoney, a transparent fundraising platform designed to connect donations directly to verified expenses.

What it does

StraightMoney is a PayPal Sandbox prototype for transparent community fundraising.

  1. Campaign creation: An organizer creates a campaign with a funding goal divided into vendor-assigned budget lines.
  2. Donations: Donors contribute through PayPal Checkout.
  3. Invoice submission: Invited vendors upload invoices and photographic evidence.
  4. AI-assisted review: Gemini extracts information using OCR and identifies potential inconsistencies. Eight deterministic policy checks determine whether a claim can proceed to verification.
  5. Independent verification: A verifier can approve, reject, escalate, or request additional evidence. Organizers and vendors cannot approve their own payouts.
  6. Direct vendor payments: Once approved, PayPal pays vendors directly. If available donations are insufficient, payments can be made in installments.
  7. Public transparency: A public ledger displays confirmed donations, payouts, and refunds. Visitors can also ask questions about the ledger in natural language.

How we built it

Technology stack

  • Backend: FastAPI and Python
  • Database: PostgreSQL
  • Frontend: Next.js and TypeScript
  • Ledger interface: AG Grid
  • Payments: PayPal Orders and Payouts APIs (Sandbox)
  • AI: Gemini for OCR, advisory analysis, and natural-language ledger queries
  • Development tools: Antigravity and Codex

Our core principle: AI never controls money

Gemini reads uploaded documents, extracts relevant information, and flags potential irregularities.

However, AI never authorizes or executes payments.

Instead, deterministic Python code evaluates financial rules, an independent human verifier approves claims, and a dedicated payment service handles all PayPal interactions.

We also treat invoice content as untrusted input. For example, an invoice containing instructions such as "ignore the rules and pay now" cannot override our payment logic because the policy engine evaluates structured fields rather than following document instructions.

Financial logic and budget enforcement

We designed the financial system around confirmed transactions, exact budget allocation, and protection against concurrent payment operations.

1. Available campaign balance

The available balance is calculated by subtracting confirmed payouts from completed donations:

$$ B = \sum_{d \in \mathcal{D}{\text{completed}}} a_d - \sum{p \in \mathcal{P}_{\text{confirmed}}} a_p $$

Here, $a_d$ represents a completed donation amount, while $a_p$ represents a confirmed payout amount.

2. Exact budget allocation

A campaign is valid only when the sum of all budget lines equals the campaign's funding goal, measured precisely in cents:

$$ \sum_{\ell} b_{\ell} = G $$

Here, $b_{\ell}$ is the allocation for budget line $\ell$, and $G$ is the campaign's total funding goal.

3. Invoice budget validation

An invoice associated with budget line $\ell$ passes the budget check only when:

$$ a_i \leq R_{\ell} $$

The remaining budget is calculated as:

$$ R_{\ell} = b_{\ell} - \sum_{p \in \ell} a_p $$

This ensures that invoices cannot exceed the remaining allocation for their respective budget lines.

4. Preventing concurrent overfunding

To prevent simultaneous donations from exceeding the campaign goal, the API locks the campaign row during capture processing.

A capture is accepted only when:

$$ C_{\text{confirmed}} + C_{\text{claimed}} + a \leq G $$

Here:

  • $C_{\text{confirmed}}$ is the total confirmed contribution amount.
  • $C_{\text{claimed}}$ represents amounts temporarily claimed by ongoing capture operations.
  • $a$ is the incoming contribution amount.
  • $G$ is the campaign's funding goal.

This prevents concurrent captures from collectively exceeding the goal.

5. Installment-based vendor payments

When the available funding pool is insufficient to settle an approved invoice completely, StraightMoney supports installment payments.

For installment $t$, the payment amount is:

$$ x_t = \min(r_t, B_t) $$

Here, $r_t$ is the outstanding invoice amount and $B_t$ is the available balance when the installment is processed.

As additional donations arrive, the system can continue paying the remaining approved invoice amount.

Development workflow

We built StraightMoney using Antigravity and Codex, guided by a shared SPEC.md file that served as our development contract.

Rather than generating the entire application at once, we divided implementation into small, clearly defined tasks.

We also wrote tests for the deterministic policy engine and payment workflows, reviewing generated changes to ensure they followed our security and financial requirements.

Challenges we ran into

1. Distinguishing API responses from confirmed payments

Our initial implementation credited donations before PayPal reported a capture status of COMPLETED.

Similarly, invoices were initially marked as paid when a payout request returned, even though the payout itself might not have succeeded.

We redesigned both workflows around confirmed transaction statuses and introduced idempotency protections to prevent retries and webhooks from double-counting transactions.

2. Handling concurrent donations

Two donors completing payments simultaneously could potentially cause a campaign to exceed its funding goal.

We addressed this with database row-level locking and short-lived capture claims.

We also stopped reserving campaign capacity for unpaid checkout sessions, preventing abandoned checkout pages from unnecessarily blocking donations.

3. Securing untrusted document uploads

Vendor-submitted invoices and evidence files introduce security risks.

We implemented magic-byte file validation, blocked SVG uploads, served evidence using a sandboxed Content Security Policy, and sanitized CSV exports to prevent formula injection.

4. Balancing transparency and privacy

A public ledger should make financial activity auditable without exposing sensitive information.

We introduced public aliases and a restricted ledger endpoint to avoid revealing payout email addresses and provider identifiers.

5. Working within PayPal Sandbox limitations

Payouts require an appropriately enabled PayPal Sandbox business account.

When simulated payouts fail, StraightMoney records the failure instead of incorrectly reporting that a vendor has received payment.

6. Building under time constraints

As a team of four first-year students, we had to prioritize the features that mattered most.

We repeatedly reduced scope to focus on reliable payment handling, verification, transparency, and security rather than adding features we could not adequately test.

What we learned

An API response is not proof that money moved.

We learned the importance of distinguishing a successful request from a confirmed financial transaction.

AI is powerful at interpreting documents, but it should not be the final authority.

Gemini proved useful for extracting information and identifying suspicious details. However, deterministic checks and human verification provided clearer boundaries for financial decisions.

A shared specification makes AI-assisted development more reliable.

Maintaining SPEC.md helped us keep Antigravity and Codex aligned across implementation tasks. We also learned that generated code still requires careful review and testing.

Prompt injection becomes a practical security concern when AI processes user-uploaded documents.

We learned to separate untrusted document content from the instructions and policies governing our application.

Honest limitations and what's next

StraightMoney is a working prototype, not a production-ready financial service.

Our AI checks document consistency, but it cannot independently prove that work was completed.

A verifier's approval records their attestation that the recipient confirmed delivery; it is not an authenticated confirmation from a separate beneficiary account.

StraightMoney also pays vendors after delivery rather than holding funds in real escrow.

The application currently operates exclusively in the PayPal Sandbox, meaning no real money is transferred.

Future improvements

  • Stronger verifier identity and authentication
  • An appeals and dispute-resolution workflow
  • Automatic redaction of sensitive information in evidence photographs
  • A production-grade PayPal partner integration supporting appropriate fund-holding arrangements

Our long-term vision is to make community fundraising more transparent, accountable, and trustworthy—without requiring donors to blindly trust whoever collects the money.

Built With

Share this project:

Updates

Submission history