-
-
A buyer haggles in Spanish and agrees at $65; Bhav sends a PayPal invoice with a QR code
-
The seller's dashboard in Hindi: the same conversation translated, the deal at $65.00 and the invoice sent
-
A buyer pushes to $59 in Japanese; the stall holds at the $60 floor, which lives in Go code, not the prompt
-
Floor-only mode: no model at all, template replies, same floor
Inspiration
Bhav is Hindi for the price you arrive at by talking. Picture a teak furniture exporter in Indonesia, 45 staff and $70k a month through PayPal, that haggles every container by email with buyers in Australia and Germany, and its sales staff give away 3% to close: about $1,500 a container. A Japanese knife maker's test for any tool is "one yen off list and I am finished." Seven of nine sellers in a simulated discovery programme (personas, not customers) wanted the same thing: a floor nobody can cross and a translator, with a human in control. So Bhav puts the floor in Go code, ships a floor-only mode where the model never speaks, and lets the seller turn Claude's drafting on when they want the words handled too. The deal closes on a PayPal invoice with a QR code, priced in the seller's currency and shown to the buyer in theirs. The autonomous 3am haggle with a Japanese buyer still works; it is the flourish, not the default.
What it does
A buyer opens the stall, picks an item, and writes in whatever language they like. In floor-only mode (Replies: Floor only in the seller header, or LLM_MODE=off), no model is called: the engine reads the buyer's number, accepts at or above the floor, steps toward it otherwise, and answers with a fixed template in English plus the Hindi line for the seller; each reply is badged template or model. With replies on, Claude detects the language, replies in it like a friendly market seller, and translates both sides into Hindi for the seller's dashboard. It proposes prices as structured data, and the haggle engine owns the money: the seller's floor is enforced in code, counters are clamped to it, concessions only go down, a sub-floor "accept" is refused and the model's text discarded, and an offer at the standing price closes the deal. On agreement, Bhav creates a PayPal invoice in the seller's currency with the buyer's local figure alongside, generates the QR code, and shows both. The buyer pays from the QR or the hosted page; the page polls PayPal and flips to paid; the seller sees भुगतान प्राप्त हुआ.
How I built it
Go, Preact, Postgres, the shared paypalgo library. The LLM returns one JSON object per turn: detected language, reply, reply in the seller's language, the buyer's offer, the counter, accept/walk flags. internal/haggle applies the floor rules and is unit-tested. Invoices are sent with send_to_recipient=false, so an address typed into a public form can never make PayPal send email; the buyer pays from their own screen. Public endpoints are rate limited per client and globally.
Challenges
PayPal's own recipient_view_url 404s in the sandbox; the older payerView page renders the invoice with a PayPal button, so Bhav links that. The QR endpoint returns multipart form data with the image as a base64 part. And the model, left alone, happily mentions that a floor exists; the prompt and the clamp handle that now.
Accomplishments
A Spanish buyer: $90 → $84 → $78, a $55 push held at the $60 floor, deal at $65, a real €59.80 invoice with QR. A Japanese buyer: a ¥4,228 invoice from the same loop.
What I learned
Put the number in code and the personality in the model, and make the personality optional. The result is a stall that can be charming and still cannot give away the stock, and that works with the model switched off.
What's next
Voice (streaming STT/TTS in the buyer's language), a live rate feed instead of the labelled table, and Render Workflows running the negotiation turns as durable jobs
Built With
- claude
- docker
- go
- paypal-invoicing-v2
- paypal-webhooks
- postgresql
- preact
- render