Inspiration
Commercial disputes are still surprisingly manual.
A shipment arrives short. Some goods are damaged. The buyer and supplier disagree about what happened. Then someone has to go through purchase orders, delivery notes, inspection reports, photos, emails, calculations, approvals, and payment records just to work out what should happen next.
We wanted to see whether AI could help with the difficult parts without giving AI control over the money.
That led to one rule that shaped DealDone:
- AI can read evidence.
- AI can explain what it finds.
- AI agents can negotiate.
- Code controls the financial limits.
- Humans make the final approval.
- PayPal executes the payment.
We built DealDone around that separation.
What it does
DealDone turns a commercial dispute into an evidence-backed settlement that both sides can approve and execute through PayPal.
Our demo follows DEAL-1048, an $18,000 order between Acme Manufacturing and Nova Packaging.
1. Evidence review
DealDone works with the actual documents behind the dispute:
- Purchase order
- Delivery note
- Inspection report
- Warehouse photo
- Email thread
The AI compares those sources and identifies:
- 1,000 units ordered
- 940 units received
- 60 units missing
- 70 units reported damaged
- 55 damaged units supported by the available evidence
2. Deterministic settlement
The AI does not decide how much money should move.
DealDone uses deterministic code to calculate the settlement from the validated facts:
- Original amount: $18,000
- Payable units: 885
- Settlement: $15,930
- Authorization release: $2,070
3. Agent negotiation
DealDone then runs separate buyer and supplier agents.
- The buyer agent has a maximum amount it is allowed to accept.
- The supplier agent has a minimum amount it is allowed to accept.
- Both agents can negotiate inside those boundaries.
- Neither agent can move outside its authorization limit.
For the demo, the two sides converge at $15,930.
4. Dual human approval
The negotiated proposal is then locked.
- Buyer signs in with an authenticated buyer account.
- Buyer approves the exact $15,930 proposal.
- Supplier signs in separately.
- Supplier approves the same proposal.
- DealDone will not execute payment until both approvals exist.
The approval role is determined on the server rather than being selected by the user in the browser.
5. PayPal settlement
Once both sides approve:
- DealDone executes the settlement through PayPal Sandbox.
- $15,930 is captured.
- The remaining $2,070 authorization is released.
- DealDone independently checks the final PayPal state.
- PayPal order, authorization, and capture IDs are stored in the payment record.
The result is a complete trail from evidence to negotiation to approval to payment.
How we built it
Frontend
- Next.js 16
- React
- TypeScript
- Tailwind CSS
- A light enterprise SaaS interface designed around one clear dispute workflow
AI
We use Gemini for evidence extraction.
Instead of asking the model to make the financial decision, we use it to extract structured facts and supporting evidence.
Those facts are then passed into deterministic logic.
Agent negotiation
We built separate buyer and supplier agents with different mandates.
The negotiation flow includes:
- Opening proposals
- Bounded counteroffers
- Final authorized offers
- Hard buyer maximum
- Hard supplier minimum
- Agreement detection
The agents can reason and negotiate, but DealDone code enforces the boundaries.
Proposal integrity
Each negotiated proposal is tied to:
- The deal
- The evidence analysis
- The current demo run
- Buyer and supplier authorization limits
- Final settlement amount
We generate a proposal fingerprint so the settlement being approved is tied back to the evidence and negotiation that created it.
Authentication and approvals
We use Supabase for:
- Authentication
- Buyer/supplier role mapping
- Settlement records
- Approval state
- Evidence analysis records
- Demo run state
- PayPal audit records
Approval permissions are enforced server-side.
PayPal
The settlement flow uses PayPal Sandbox APIs for:
- Order creation
- Authorization
- Partial capture
- Remaining authorization release
- Order status verification
- Authorization status verification
- Webhook verification
We wanted PayPal to be part of the actual transaction flow rather than just appearing at the end of the demo.
Challenges we ran into
Keeping AI away from direct financial authority
This was one of the biggest design decisions.
It would have been much easier to ask a model to read the dispute and return a settlement number.
We decided not to do that.
Instead:
- AI extracts and explains
- Deterministic code calculates
- Agent mandates limit negotiation
- Humans approve
- PayPal executes
That made the system more complicated, but also much safer and easier to audit.
Making negotiation more than two chatbots talking
We did not want the agent section to be a scripted conversation.
We added:
- Separate buyer and supplier mandates
- Hard authorization boundaries
- Multiple negotiation rounds
- Bounded concessions
- A clear condition for whether an agreement is actually possible
Making approvals trustworthy
Originally, it would have been easy to let the browser tell the API whether the user was the buyer or supplier.
We changed that.
DealDone now:
- Authenticates the user through Supabase
- Looks up their role server-side
- Records approval against the exact proposal
- Requires both sides before settlement can execute
Making the demo repeatable
A payment demo becomes difficult after the first successful run because the previous approvals and transaction already exist.
We built a demo-run system that can:
- Start a fresh run
- Generate a new run ID
- Preserve previous settlement history
- Keep each new negotiation separate
- Prevent old approvals from appearing in the current run
Keeping state consistent across the product
Evidence, negotiation, approvals, PayPal, completion, and the payment record all depend on each other.
We spent a lot of time making sure the interface did not claim something had happened before the backend had actually confirmed it.
Accomplishments that we're proud of
The part we are most proud of is that the demo is not just a set of screens.
We completed the full workflow:
- Evidence is analyzed.
- Discrepancies are extracted.
- A deterministic $15,930 settlement is calculated.
- Buyer and supplier agents negotiate.
- A proposal is created and fingerprinted.
- Buyer authenticates and approves.
- Supplier authenticates and approves.
- PayPal executes the settlement.
- $15,930 is captured.
- $2,070 is released.
- DealDone verifies the final PayPal state.
- The transaction and approval trail remain available in the payment record.
We also built:
- Real evidence documents for the dispute
- Source-linked evidence findings
- Server-enforced user roles
- Dual approval
- Proposal integrity checks
- Repeatable demo runs without deleting historical records
- A working PayPal Sandbox settlement flow
- A final audit-style payment record
The sentence that best describes the architecture is:
AI proposes and negotiates. Deterministic code controls money. Authenticated humans authorize. PayPal executes.
What we learned
AI is more useful when it has boundaries
The strongest part of the project was not giving the model more control.
It was deciding exactly where AI should stop.
AI was useful for:
- Reading unstructured evidence
- Comparing sources
- Explaining discrepancies
- Negotiating between two positions
It was less appropriate for:
- Unrestricted financial decisions
- Approving a settlement
- Triggering payment without human authorization
Agentic systems need controls, not just agents
Building two agents was straightforward.
Making sure they could not exceed their mandates was the more important problem.
We learned to separate:
- Agent reasoning
- Business rules
- Human permissions
- Payment execution
Payment makes an AI workflow much more real
Before PayPal execution, the project could still be viewed as an analysis tool.
Once the approved agreement actually resulted in a PayPal capture and authorization release, the workflow became much more tangible.
Good demos expose system state
We also learned that a strong demo should make it obvious what has and has not happened yet.
For example:
- Evidence starts unanalyzed.
- Negotiation only follows evidence analysis.
- Approval only follows negotiation.
- Payment only becomes available after both approvals.
- Completion only appears after PayPal verification.
That made the final workflow much clearer.
What's next for Dealdone
The hackathon version focuses on proving one dispute-resolution workflow end to end.
Next, we would expand it into a broader commercial resolution system.
More dispute types
- Quality failures
- Partial shipments
- Late delivery
- Pricing discrepancies
- Missing documentation
- Contract or order mismatches
Better evidence handling
- Larger document sets
- Email and communication integrations
- More image evidence
- Automatic evidence timelines
- Better citation and provenance views
Configurable negotiation mandates
- Different companies should be able to define:
- Maximum settlement authority
- Minimum acceptable recovery
- Escalation thresholds
- Rules requiring additional human approval
Multi-user workflows
- Finance
- Procurement
- Operations
- Legal
- Supplier representatives
- Different approval limits by role
Integrations
We would connect DealDone with the systems companies already use rather than trying to replace them:
- ERP systems
- Procurement platforms
- Order management systems
- Supplier records
- Inspection systems
- PayPal payment workflows
The long-term idea is simple:
A commercial problem should not end with an AI-generated recommendation.
DealDone should help move it all the way from evidence → resolution → approval → settlement.
Built With
- gemini
- next.js
- node.js
- paypal
- react
- supabase
- typescript
- vercel