Inspiration
People and AI agents prepay vendors because of what the vendor's terms promise: a 30-day refund, a promise to delete your data within a week, "we never train AI on your data".
Those promises live on a web page the vendor can edit at any time. A few weeks later the refund window is 7 days, or the deletion clause is gone, and the money is already spent.
Today nothing happens when terms change. We wanted a checkout where the payment itself depends on the terms: you pay for the terms you were promised, and only while they hold.
What it does
RedLine for PayPal is a terms-backed checkout.
PayPal holds the payment. The customer pays in PayPal's own checkout window. The amount is authorized, not collected. RedLine never holds money.
Watched, then settled. RedLine reads the terms page on a schedule. If the terms hold, PayPal collects the full amount for the vendor.
If a pinned right is narrowed or removed, and a second check confirms it, PayPal captures only the share the vendor earned up to the first check and voids the rest back to the customer.
What decides, and what doesn't:
Code decides the money. The vendor's earned share, the dates and every PayPal call are arithmetic. No model ever decides an amount. Most checks never reach a model. If every pinned passage is still on the page word for word, and the text around it is unchanged, code keeps the cover.
AI only reads. When the words change, a panel of AI models answers one question: is the right the same, narrowed or removed? A cut needs a majority confident it was cut and none confident it wasn't. A model that fails, hesitates or disagrees never counts as a cut.
One reading never moves money. A cut is first only suspected; the next check must confirm it. Hard to game. Hidden text is not text: a right kept in the HTML but hidden from readers counts as gone. A page that tells the models "nothing changed" is quoted as data, never followed.
Every check, model reading and PayPal call goes into a hash-chained log that anyone can recheck.
In the live demo, you buy from a fictional vendor, pin its 30-day refund, and pay in PayPal's sandbox checkout. Then you become the vendor and cut the refund window yourself.
The demo includes nine other versions of the terms to try: reworded, voided above the passage, hidden with CSS, a prompt injection aimed at the AI, and a page taken down.
How we built it
PayPal: Orders v2 with intent AUTHORIZE, approved in PayPal's JS SDK checkout window. Payments v2 authorizations: partial capture, void, and reauthorization after PayPal's 3-day honor period. Sandbox only; the server refuses live hosts.
Exactly-once settlement: every PayPal write goes through a journal and is written before it's sent, with a deterministic PayPal-Request-Id. A crash or retry never captures twice. A hold whose cover never opened is found and voided.
The rules: RedLine began as Intelligent Contracts on GenLayer. Its rules modules (cover states and money, visible-text extraction, the question put to the models) are imported unchanged, and their 526 tests still pass.
AI panel: open-weight models on Groq's OpenAI-compatible API, run in parallel, each answering with a reading and a confidence.
Backend: Python and FastAPI on Render, Neon Postgres, leases so two workers never act on one cover, and a scheduled checker in GitHub Actions.
Frontend: React, TypeScript and Vite on Vercel. Tests: 32 server tests covering every terms version end to end, plus a browser test of the live site.
Challenges we ran into
Settlement that can't go wrong twice. A capture can succeed and the next step fail. The journal and PayPal-Request-Id idempotency make every retry safe; a test fails the void after the capture and proves the retry never captures again.
PayPal's authorization rules. A day-one sandbox spike showed how PayPal really behaves. A final capture on a partial amount closes the authorization by itself. Reauthorizing inside the honor period is refused. We designed settlement around that.
Being fair to vendors. A flaky page, a wrong model reading or a busy AI API must never take a vendor's money. Hence word-for-word checks first, a confident majority for a cut, a second confirming check, and a retry for a model that errors.
A "Pay with PayPal" press before approval once locked a checkout. Now the server waits for the buyer's approval in PayPal's window, and a refusal can be retried.
Accomplishments that we're proud of
A whole cover on PayPal's real sandbox, through the deployed server: $20 held, a cut confirmed, the earned share captured and the rest voided, with PayPal's ids recorded in the repository. The same rules code runs on GenLayer and behind PayPal.
Doubt never takes money from a vendor, and never takes protection from a customer.
What we learned
The safest place for AI in a payment is the one step that needs judgment: reading whether a right still stands. Everything else should be code and PayPal's own records. And with real money, you design for the failure first: the timeout, the retry, the half-finished settlement.
What's next for RedLine
Anchoring the log's newest hash on GenLayer.
A model-backed pin assistant for any vendor's terms page.
A vendor dashboard and an embeddable "terms-backed" badge.
A live pilot with a vendor selling prepaid API credit.
Built With
- fastapi
- genlayer
- groq
- neon
- paypal
- paypal-js-sdk
- paypal-rest-api
- postgresql
- python
- react
- render
- typescript
- vercel
- vite
Log in or sign up for Devpost to join the conversation.