Inspiration
A potter in the UK sells a $38 mug to a buyer in Ohio. The buyer pays $38 plus shipping at checkout. Days later the courier knocks and asks for import duty the buyer never saw. Many buyers refuse the parcel. The seller loses the sale and pays shipping twice.
Sellers know about the problem but not what to do about it. Tariff schedules run to thousands of lines, and one wrong customs code can change the duty a lot. We saw the same gap in the tools: a shipping platform's default code for the mug charged 28% duty, when the right code gives 20%. That is $6.84 too much on a $38 mug. Landfall exists to close that gap.
What it does
Landfall adds the import duty to the PayPal order, so the parcel lands and there is nothing to pay at the door.
- A seller connects the store they already have. Landfall reads the store's product feed (photos included) and keeps in step with it every night.
- The AI recommends. For each product it recommends a customs code and country of origin, with its reasoning, official sources and a confidence band. It asks the seller a question only when the answer would change the price, at most four per product.
- The seller decides. One click to Accept or Override, once per product, with versioned fine print. Evidence upload is optional and never required. The AI carries no risk.
- Checkout makes no AI call. The merchant's checkout asks Landfall for a quote, which is a lookup in a dated register of official tariff rules. The duty goes into the PayPal order as
amount.breakdown.tax_totalplus a per-itemtax, so it shows on the buyer's own PayPal receipt. PayPal does the currency exchange; we never convert money. - Landfall never holds PayPal credentials or touches the money. After the buyer approves, the merchant's server asks Landfall to check the PayPal order against its signed quote, and only then captures the payment.
How we built it
- AI: Claude Haiku 5.5 only, thinking disabled. When it seemed weak we improved the harness instead of the model. The model chooses from a closed candidate list taken from the register, with retrieved explanatory notes. Two independent calls must agree, output is checked against a JSON schema, and confidence bands are set by rules, not by the model's own score. It reads product photos once, as text, for labels and origin marks.
- Rate register: bitemporal (valid time and known time) and append-only; rows are never updated in place. It is fed nightly from official sources: the US tariff schedule, the UK Trade Tariff, EU VAT rates and Federal Register notices. If it has not synced for 7 days, duties-included pauses rather than guess.
- Stack: Next.js, React, TypeScript, TanStack Table and Recharts on the front; Python, FastAPI, SQLAlchemy and PostgreSQL behind it; a worker for the nightly sync; Playwright for shareable images; Docker Compose on one VPS.
- A real merchant to test against: Kiln & Co., a make-believe pottery shop with its own back office, product photos, checkout and PayPal sandbox credentials. Its only link to Landfall is the public HTTP API with its own key.
- Tests first: golden duty cases written as data before the engine existed, recorded fixtures instead of the live internet, and Playwright journeys that walk every screen as a first-time user, including phone width.
- Open source: every dependency is permissive (MIT, Apache-2.0, BSD, ISC and similar), and CI fails on anything else.
Challenges we ran into
- Tariffs are not one table. US duty depends on the code, the country of origin and which special measures apply on the date. The Time Machine only works because the register remembers what was true and when it was known.
- Being honest about what the AI knows. On our 200-listing set Haiku matched the exact 6-digit code in about 96.5 to 97.5% of cases, with its two calls agreeing 99% of the time. That is not broker-verified, and run-to-run noise is 3 to 7 points, so we state accuracy as a range with its method and never as a guarantee.
- Wide coverage without guessing. Country-specific duties, exemption lists and goods Landfall refuses all had to be handled so that an unpriced product says "not priced" instead of getting a guess.
- Verifying a PayPal order, not trusting it. The browser can alter what PayPal shows, so the merchant's server checks the approved order against Landfall's signed quote before it captures anything.
Accomplishments that we're proud of
- A real PayPal sandbox order with duty as a tax line, matching the quote to the cent.
- An AI that recommends and never rules, and is built so the seller can always override it.
- Checkout with no model call, so it stays fast and gives the same answer for the same cart.
- A harness around a small model (Haiku) that reaches high exact-code accuracy at about $0.003 per product
- Over 380 Python tests, a Playwright suite that covers every screen, and a licence gate that keeps the whole project open-source clean.
What we learned
- A small model plus a good harness beats a bigger model with a loose prompt. A closed candidate list and rules-based confidence did more than any prompt tweak.
- Trust comes from saying plainly what the AI did not do: a "recommendation", a visible Accept or Override, and fine print that is versioned.
- Money flows are easier to trust when the platform never touches them. Landfall quotes and verifies; the merchant captures.
- Testing through the real UI finds things API tests never will.
What's next for Landfall
- Verify the codes with a licensed customs broker and publish post-review accuracy.
- Add Canada and the goods with extra steel, aluminium and similar duties (Section 232), which Landfall does not price yet.
- Replace the hand-curated Australia table with an official feed.
- Shopify and WooCommerce plug-ins, so a store connects in one click. Today Landfall reads any Shopify-style product feed.
- Connect real prepaid-duty carriers and brokers. In this demo, paying customs is simulated, and we say so.
Built With
- alembic
- anthropic
- apscheduler
- claude-haiku
- docker
- fastapi
- httpx
- lxml
- next.js
- node.js
- paypal
- playwright
- postgresql
- pydantic
- python
- react
- recharts
- sqlalchemy
- tanstack-table
- typescript