Inspiration
9.6 million US adults have travelled abroad for dental treatment, mostly to save money (CareQuest Institute, 2026). For the 35 million people in the Indian diaspora, the obvious place is home: one Toronto patient paid CAD 1,500 for a whole trip to India against CAD 2,500 quoted at home for a single crown (The Quint).
The dentistry is rarely the problem. The money is. Patients wire the full amount before the first visit, read quotes with missing items, and have no way back when something fails after they fly home. 86% of UK dentists who saw dental tourists had to treat complications, and nearly all worried about follow-up care and redress (British Dental Association). An implant takes two trips with months of healing in between, so a single upfront payment is the wrong shape for the treatment.
What it does
- Reads the clinic's quote. Gemini extracts every line, linked to the exact text in the quote. Then deterministic code, not the model, redoes the arithmetic and checks for missing items. On the demo quote it catches that the lines add up to $1,390 while the quote says $1,450, and that the crown has no lab fee. The plan can be explained in Hindi, Kannada, Malayalam, Tamil and other languages.
- Pay in stages with PayPal. A booking deposit through PayPal Checkout (Orders v2). Each later stage gets a PayPal invoice only when it is due. The amount is always set on the server from the plan, every PayPal write carries an idempotency key, and a stage can only be marked paid once. A verified PayPal webhook marks invoices paid even when the patient pays from email.
- A clinic assistant with hard limits. The clinic's AI assistant can send invoices, move trips and refund warranty claims, but it only proposes. Rules in code check each proposal: the healing gap is kept, the stage is not already paid, a refund is not more than what is left, it is inside PayPal's 180-day refund window, and the same item is never refunded twice. A person approves, and the PayPal Agent Toolkit executes it (
create_invoice,send_invoice,cancel_sent_invoice,create_refund). - Both trips on a timeline. The clinic console uses Bryntum Scheduler Pro. The healing time is a dependency with a lag, so the scheduling engine itself refuses to put trip two before the implant has healed. Dragging a stage asks the assistant to propose the move.
- An aftercare guarantee. When something fails at home, the patient's own dentist writes a short note. The AI checks it against the clinic's written warranty and quotes the clause it used; code computes the refund from the item's price ("50% of the crown fee" is 50% of the crown, not the whole stage); the clinic approves, and the refund goes back through PayPal. A sports-injury claim is declined, quoting the exclusion.
How we built it
Next.js 16 and React 19 with TypeScript, Supabase Postgres, and Vercel. PayPal REST: Orders v2 for Checkout, Invoicing v2, Payments refunds, and verified webhooks, plus the PayPal Agent Toolkit for the agent's actions. The Vercel AI SDK with Gemini, with structured output validated by zod, for quote reading, translation and warranty review. Bryntum Scheduler Pro for the clinic timeline.
The design follows one rule: the model reads and proposes; code decides and moves money. Every amount is computed in code from the quote's own lines. Every agent action passes rule checks before a person can approve it, and the checks run again at approval time.
Evaluation
npm run eval scores quote reading on 20 fictional quotes in five layouts (dotted price lists, dash lists, tables, letters in prose, rupee notation), each with an answer key committed before the model ever ran. A regex parser is the baseline.
| Totals right | Every problem found, none invented | |
|---|---|---|
| Regex baseline | 17/20 | 10/20 |
| Danta | 20/20 | 20/20 |
Danta got the number of trips wrong on 2 of 20 quotes, and both are listed in the results. The quotes are synthetic and written by us, so this shows the model reads varied layouts correctly, not real-world accuracy. 25 unit tests cover the quote checks, the payment schedule and every agent limit. The model outputs are committed, so the numbers reproduce without an API key.
Challenges we ran into
- Gemini 3 and multi-step tool calls. The assistant failed on its first live run because Gemini 3 rejects a second tool step without "thought signatures". We made the assistant take one model step and write its reply from the rule results, so the explanation of a block always matches the check that made it.
- Invoicing permissions. The sandbox app had Invoicing switched on, but PayPal kept issuing an access token from before the change. A guarded diagnostics endpoint showed the token's scopes, and a fresh app fixed it.
- Live testing found real bugs. A second claim on the same crown was also covered, so a new rule now allows one refund per item. The claim form kept pointing at an older stage after a new one was paid.
Accomplishments that we're proud of
The whole money flow works end to end in the PayPal sandbox: a deposit through Checkout, two invoices sent by the Agent Toolkit (one cancelled and reissued after a reschedule), webhook confirmation, and a warranty refund at 50% of the crown fee. Every step is checked by a rule before money moves.
What we learned
Agents are most useful in payments when their power is narrow and visible: propose, show which rule passed or failed, and let a person approve. Putting the arithmetic in code instead of the prompt made the AI part easier to trust and to test.
What's next for Danta
- Show it to the two dental clinics I already work with through another project and ask for a pilot.
- Clinic onboarding with their own warranty terms.
- Multi-currency pricing for UK, Canadian and Gulf patients.
- Routing claims older than PayPal's 180-day refund window to clinic-funded payouts.
Business model: clinics pay a small fee per completed international case; patients pay nothing extra.
Try it yourself (for judges)
Video: https://youtu.be/N88chP8PPpU
- Open https://danta-inky.vercel.app and click Open the live demo. You get your own copy of a fictional patient's case.
- Pay the booking deposit with the PayPal sandbox buyer account:
- Email:
[email protected] - Password: in the testing instructions for judges
- Email:
- Open the Clinic console. Click Bring trip 2 forward to three weeks after trip 1 (a rule blocks it), then Invoice the next stage that is due and Approve.
- Back on the patient page, click Pay the PayPal invoice and pay it. The webhook marks it paid. Repeat for trip 2.
- Use Aftercare guarantee → Use a sample note → Send claim to the clinic, then Approve the refund in the clinic console.
Everything runs in the PayPal sandbox; no real money moves.
Built With
- bryntum
- bryntum-scheduler-pro
- gemini
- nextjs
- paypal
- paypal-agent-toolkit
- paypal-checkout
- postgresql
- react
- supabase
- typescript
- vercel
- vercel-ai-sdk
- vitest
- zod